AhaSend Go SDK
package main
import (
"context"
"fmt"
"log"
"github.com/AhaSend/ahasend-go/api"
"github.com/google/uuid"
)
func main() {
// Create API client with authentication
client := api.NewAPIClient(
api.WithAPIKey("aha-sk-your-64-character-key"),
)
accountID := uuid.New()
// Create context for the API call
ctx := context.Background()
response, httpResp, err := client.AccountsAPI.GetAccount(ctx, accountID)
if err != nil {
log.Fatalf("Error getting account: %v", err)
}
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Account retrieved. Status: %d\n", httpResp.StatusCode)
fmt.Printf("ID: %s\n", response.ID)
fmt.Printf("Name: %s\n", response.Name)
fmt.Printf("Owner ID: %s\n", response.OwnerID)
if response.Website != nil {
fmt.Printf("Website: %s\n", *response.Website)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
import { AhaSendClient } from "@ahasend/sdk";
const client = AhaSendClient.fromEnv();
const account = await client.accounts.get();
console.log("Account found.", { id: account.id, name: account.name });
curl --request GET \
--url https://api.ahasend.com/v2/accounts/{account_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ahasend.com/v2/accounts/{account_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ahasend.com/v2/accounts/{account_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.ahasend.com/v2/accounts/{account_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ahasend.com/v2/accounts/{account_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "account",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"parent_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"website": "<string>",
"about": "<string>",
"track_opens": true,
"track_clicks": true,
"reject_bad_recipients": true,
"reject_mistyped_recipients": true,
"message_metadata_retention": 123,
"message_data_retention": 123,
"owner_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}Accounts
Get Account Details
Returns account information
GET
/
v2
/
accounts
/
{account_id}
AhaSend Go SDK
package main
import (
"context"
"fmt"
"log"
"github.com/AhaSend/ahasend-go/api"
"github.com/google/uuid"
)
func main() {
// Create API client with authentication
client := api.NewAPIClient(
api.WithAPIKey("aha-sk-your-64-character-key"),
)
accountID := uuid.New()
// Create context for the API call
ctx := context.Background()
response, httpResp, err := client.AccountsAPI.GetAccount(ctx, accountID)
if err != nil {
log.Fatalf("Error getting account: %v", err)
}
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Account retrieved. Status: %d\n", httpResp.StatusCode)
fmt.Printf("ID: %s\n", response.ID)
fmt.Printf("Name: %s\n", response.Name)
fmt.Printf("Owner ID: %s\n", response.OwnerID)
if response.Website != nil {
fmt.Printf("Website: %s\n", *response.Website)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
import { AhaSendClient } from "@ahasend/sdk";
const client = AhaSendClient.fromEnv();
const account = await client.accounts.get();
console.log("Account found.", { id: account.id, name: account.name });
curl --request GET \
--url https://api.ahasend.com/v2/accounts/{account_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.ahasend.com/v2/accounts/{account_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ahasend.com/v2/accounts/{account_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.ahasend.com/v2/accounts/{account_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ahasend.com/v2/accounts/{account_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "account",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"parent_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"website": "<string>",
"about": "<string>",
"track_opens": true,
"track_clicks": true,
"reject_bad_recipients": true,
"reject_mistyped_recipients": true,
"message_metadata_retention": 123,
"message_data_retention": 123,
"owner_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}Authorizations
API key for authentication. Non-empty Security Requirement values are AhaSend API-key roles. Roles listed within one requirement object are jointly required; separate requirement objects are alternatives.
Path Parameters
Account ID
Response
Account details
Object type identifier
Available options:
account Unique identifier for the account
Parent account ID when this account is a sub account
When the account was created
When the account was last updated
Account name
Account website URL
Account description
Default open tracking setting
Default click tracking setting
Whether to reject bad recipients
Whether to reject mistyped recipients
Default message metadata retention in days
Default message data retention in days
Account owner user ID

