Skip to main content
GET
/
v2
/
accounts
/
{account_id}
/
sub-accounts
/
{sub_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()
  subAccountID := uuid.New()

  // Create context for the API call
  ctx := context.Background()

  // Get a single sub account by ID
  response, httpResp, err := client.SubAccountsAPI.GetSubAccount(
    ctx,
    accountID,
    subAccountID,
  )
  if err != nil {
    log.Fatalf("Error getting sub account: %v", err)
  }

  if httpResp.StatusCode == 200 {
    fmt.Printf("✅ Retrieved sub account. Status: %d\n", httpResp.StatusCode)
    if response != nil {
      fmt.Printf("ID: %s\n", response.ID)
      fmt.Printf("Name: %s\n", response.Name)
      fmt.Printf("Website: %s\n", response.Website)
      fmt.Printf("Status: %s\n", response.Status)
      fmt.Printf("Domain count: %d\n", response.DomainCount)
      fmt.Printf("Member count: %d\n", response.MemberCount)
    }
  } else {
    fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
  }
}
{
  "object": "sub_account",
  "id": "2f3c5d2a-9ef8-4c91-a5f4-79990c8c1d3a",
  "parent_account_id": "9d0cf9d0-4f5e-4674-bcf1-8ec39968b6e1",
  "name": "Acme Subsidiary",
  "website": "acme.example.com",
  "status": "active",
  "monthly_credit": 0,
  "created_at": "2024-01-01T00:00:00Z",
  "domain_count": 2,
  "member_count": 3,
  "last_activity_at": "2024-01-15T12:00:00Z"
}
Platform Partner feature: Sub Accounts is part of our Platform Partner capabilities and is currently in early access. Contact us to enable it on your account.

Authorizations

Authorization
string
header
required

API key for authentication

Path Parameters

account_id
string<uuid>
required

Parent account ID

sub_account_id
string<uuid>
required

Sub account ID

Response

Sub account details

object
enum<string>
required

Object type identifier

Available options:
sub_account
id
string<uuid>
required

Unique identifier for the sub account

parent_account_id
string<uuid>
required

Parent account ID

created_at
string<date-time>
required

When the sub account was created

name
string
required

Sub account name

website
string<fqdn>
required

Account website domain

Maximum string length: 255
status
enum<string>
required

Current sub-account status

Available options:
active,
suspended,
parent-suspended,
deleted
monthly_credit
integer<int64>
required

Optional monthly cap; 0 means no cap

Required range: x >= 0
domain_count
integer<int64>
required

Number of domains owned by the sub account

Required range: x >= 0
member_count
integer<int64>
required

Number of direct members on the sub account

Required range: x >= 0
last_activity_at
string<date-time> | null
required

Last recorded sub-account email activity