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

import (
  "context"
  "fmt"
  "log"

  ahasend "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 domain settings
  response, httpResp, err := client.DomainsAPI.UpdateDomain(
    ctx,
    accountID,
    "example.com",
    requests.UpdateDomainRequest{
      TrackingSubdomain:        ahasend.String("click"),
      ReturnPathSubdomain:      ahasend.String("mail"),
      DKIMRotationIntervalDays: ahasend.Int(45),
    },
  )
  if err != nil {
    log.Fatalf("Error updating domain: %v", err)
  }

  fmt.Printf("Status: %d\n", httpResp.StatusCode)
  if response != nil {
    fmt.Printf("Updated domain: %s\n", response.Domain)
  }
}
{
  "object": "domain",
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "domain": "<string>",
  "account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "dns_records": [
    {
      "type": "<string>",
      "host": "<string>",
      "content": "<string>",
      "required": true,
      "propagated": true
    }
  ],
  "dns_valid": true,
  "last_dns_check_at": "2023-11-07T05:31:56Z",
  "tracking_subdomain": "<string>",
  "return_path_subdomain": "<string>",
  "subscription_subdomain": "<string>",
  "media_subdomain": "<string>",
  "dkim_rotation_interval_days": 123,
  "rotation_ready": true
}

Authorizations

Authorization
string
header
required

API key for authentication

Path Parameters

account_id
string<uuid>
required

Account ID

domain
string
required

Domain name

Body

application/json
tracking_subdomain
string

Optional custom tracking subdomain. Omit to leave the current value unchanged.

return_path_subdomain
string

Optional custom return-path subdomain. Omit to leave the current value unchanged.

subscription_subdomain
string

Optional custom subscription management subdomain. Omit to leave the current value unchanged.

media_subdomain
string

Optional custom media subdomain. Omit to leave the current value unchanged.

dkim_rotation_interval_days
integer

Optional custom DKIM rotation interval in days. Omit to leave the current value unchanged. Only supported for managed DNS domains on eligible plans.

Response

Domain updated successfully

object
enum<string>
required

Object type identifier

Available options:
domain
id
string<uuid>
required

Unique identifier for the domain

created_at
string<date-time>
required

When the domain was created

updated_at
string<date-time>
required

When the domain was last updated

domain
string
required

The domain name

account_id
string<uuid>
required

Account ID this domain belongs to

dns_records
object[]
required

DNS records required for domain verification

dns_valid
boolean
required

Whether all required DNS records are properly configured

last_dns_check_at
string<date-time> | null

When DNS records were last checked

tracking_subdomain
string | null

Custom tracking subdomain. Null means the account or product default is used.

return_path_subdomain
string | null

Custom return-path subdomain. Null means the account or product default is used.

subscription_subdomain
string | null

Custom subscription management subdomain. Null means the account or product default is used.

media_subdomain
string | null

Custom media subdomain. Null means the account or product default is used.

dkim_rotation_interval_days
integer | null

Custom DKIM rotation interval in days. Null means the account default is used.

rotation_ready
boolean

Whether the standby DKIM slot is ready for rotation.