Skip to main content
PUT
/
v2
/
accounts
/
{account_id}
AhaSend Go SDK
package main

import (
  "context"
  "fmt"
  "log"

  "github.com/AhaSend/ahasend-go"
  "github.com/AhaSend/ahasend-go/api"
  "github.com/AhaSend/ahasend-go/models/requests"
  "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()

  // Update the account name and open/click tracking settings
  response, httpResp, err := client.AccountsAPI.UpdateAccount(ctx, accountID, requests.UpdateAccountRequest{
    Name:        ahasend.String("Acme Corp"),
    TrackOpens:  ahasend.Bool(true),
    TrackClicks: ahasend.Bool(true),
  })
  if err != nil {
    log.Fatalf("Error updating account: %v", err)
  }

  if httpResp.StatusCode == 200 {
    fmt.Printf("✅ Account updated! Status: %d\n", httpResp.StatusCode)
    if response != nil {
      fmt.Printf("ID: %s\n", response.ID)
      fmt.Printf("Name: %s\n", response.Name)
      if response.TrackOpens != nil {
        fmt.Printf("Track Opens: %t\n", *response.TrackOpens)
      }
    }
  } else {
    fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
  }
}
{
  "object": "account",
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "name": "<string>",
  "owner_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "parent_account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "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
}

Authorizations

Authorization
string
header
required

API key for authentication

Path Parameters

account_id
string<uuid>
required

Account ID

Body

application/json
name
string

Account name

Maximum string length: 255
website
string<uri>

Account website URL

about
string

Account description (used for account verification)

track_opens
boolean

Default open tracking setting

track_clicks
boolean

Default click tracking setting

reject_bad_recipients
boolean

Whether to reject bad recipients

reject_mistyped_recipients
boolean

Whether to reject mistyped recipients

message_metadata_retention
integer

Default message metadata retention in days

Required range: 1 <= x <= 30
message_data_retention
integer

Default message data retention in days

Required range: 0 <= x <= 30

Response

Account updated successfully

object
enum<string>
required

Object type identifier

Available options:
account
id
string<uuid>
required

Unique identifier for the account

created_at
string<date-time>
required

When the account was created

updated_at
string<date-time>
required

When the account was last updated

name
string
required

Account name

owner_id
string<uuid>
required

Account owner user ID

parent_account_id
string<uuid> | null

Parent account ID when this account is a sub account

website
string<uri> | null

Account website URL

about
string | null

Account description

track_opens
boolean

Default open tracking setting

track_clicks
boolean

Default click tracking setting

reject_bad_recipients
boolean

Whether to reject bad recipients

reject_mistyped_recipients
boolean

Whether to reject mistyped recipients

message_metadata_retention
integer

Default message metadata retention in days

message_data_retention
integer

Default message data retention in days