Skip to main content
POST
AhaSend Go SDK
The AhaSend API creates a new SMTP credential for SMTP authentication. A scoped credential requires at least one domain and the key must have write permission for every supplied domain. A global credential requires smtp-credentials:write:all; supplied domains are accepted but ignored, and the response contains domains: []. SMTP credentials have no update endpoint.

Authorizations

Authorization
string
header
required

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.

Scopes

smtp-credentials:write:all
smtp-credentials:write:{domain}

Headers

Idempotency-Key
string

Optional idempotency key for safe request retries. Must be a unique string for each logical request. A request with a key does its operation at most one time during the life of the key, so a retry with the same key and the same request is safe after a 5xx, a timeout or a lost answer. An identical request with a completed stored outcome returns the original status and body. An in-progress execution returns 409, and a changed method/path/body returns 422. A key lives 24 hours from the first request that uses it. API-key create responses include a one-time secret_key, so on those operations a key and its encrypted replay response live 5 minutes.

Maximum string length: 255

Path Parameters

account_id
string<uuid>
required

Account ID

Body

application/json
name
string
required

Credential name

Maximum string length: 255
scope
enum<string>
required

Credential scope - "global" or "scoped"

Available options:
global,
scoped
sandbox
boolean
default:false

Whether this is a sandbox credential

domains
string[] | null
required if scope = scoped

For scoped, a non-empty array is required. For global, this may be omitted, null, empty, or non-empty; supplied values are accepted but ignored.

Response

SMTP credential created successfully

object
enum<string>
required

Object type identifier

Available options:
credential_smtp
id
string<uuid>
required

Unique identifier for the SMTP credential

created_at
string<date-time>
required

When the credential was created

updated_at
string<date-time>
required

When the credential was last updated

name
string
required

Credential name

username
string
required

SMTP username

sandbox
boolean
required

Whether this is a sandbox credential

scope
enum<string>
required

Credential scope

Available options:
global,
scoped
domains
string[]
required

Domains this credential can send from. Always present; global credentials return an empty array.

password
string
required

SMTP password. Returned only when the credential is created.