Skip to main content
DELETE
/
v2
/
accounts
/
{account_id}
/
sub-accounts
/
{sub_account_id}
/
api-keys
/
{key_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()
  keyID := uuid.New()

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

  response, httpResp, err := client.SubAccountsAPI.DeleteSubAccountAPIKey(ctx, accountID, subAccountID, keyID)
  if err != nil {
    log.Fatalf("Error deleting sub-account API key: %v", err)
  }

  if httpResp.StatusCode == 200 {
    fmt.Printf("✅ Sub-account API key deleted. Status: %d\n", httpResp.StatusCode)
    if response != nil {
      fmt.Printf("Message: %s\n", response.Message)
    }
  } else {
    fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
  }
}
{
  "message": "api key {id} ({label}) deleted successfully"
}
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

key_id
string<uuid>
required

API key ID

Response

Sub-account API key deleted successfully

message
string
required

Success message