Skip to main content
POST
AhaSend Go SDK
The AhaSend API creates and sends a message to one or more recipients. This API cannot be used if you want to send a conversational/P2P message and set CC or BCC. Use Create Conversation Message instead. Validation Requirements:
  • Either text_content or html_content is required
  • from.email must be from a domain you own with valid DNS records
  • retention.metadata must be between 1 and 30 days
  • retention.data must be between 0 and 30 days
  • If reply_to is provided, do not include reply-to in headers
  • message-id header will be ignored and automatically generated
  • Schedule times must be in RFC3339 format
  • schedule.first_attempt must be in the future and within 7 days of the request
  • schedule.expires must be in the future and within 8 days of the request
Authorization uses the domain in from.email: either messages:send:all or the matching domain-specific send role is sufficient.

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.

Headers

Idempotency-Key
string

Optional idempotency key for safe request retries. Must be a unique string for each logical request. An identical request with a completed stored outcome returns the original status and body. An in-progress execution returns 409, a changed method/path/body returns 422, and a released 5xx execution may run again. Keys for non-secret responses expire after 24 hours. API-key create responses include a one-time secret_key, so successful encrypted replay responses for those operations expire after 5 minutes.

Maximum string length: 255

Path Parameters

account_id
string<uuid>
required

Account ID

Body

application/json
from
object
required
Example:
recipients
object[]
required

This does not set the To header to multiple addresses, it sends a separate message for each recipient

Required array length: 1 - 100 elements
subject
string
required

Email subject line

reply_to
object

If provided, the reply-to header in headers array must not be provided

Example:
text_content
string

Plain text content. Required if html_content is empty

html_content
string

HTML content. Required if text_content is empty

amp_content
string

AMP HTML content

attachments
object[]

File attachments. There is no per-attachment size limit; the request body is limited to 30 MB and the resulting message (headers, body and base64-encoded attachments) to 20 MiB. For inline images, set the attachment's content_id to a value wrapped in angle brackets (e.g. <image1@example.com>) and reference it from html_content with cid: (e.g. <img src="cid:image1@example.com">).

headers
object

Custom email headers. reply-to header cannot be provided if reply_to is provided, message-id will be ignored and automatically generated

substitutions
object

Global substitutions, recipient substitutions override global

tags
string[]

Tags for categorizing messages

sandbox
boolean
default:false

If true, the message will be sent to the sandbox environment

sandbox_result
enum<string>

The result of the sandbox send

Available options:
deliver,
bounce,
defer,
fail,
suppress
tracking
object | null

Tracking settings for the message, overrides default account settings

Example:
retention
object | null

Retention settings for the message, overrides default account settings

Example:
schedule
object

Schedule for message delivery

Response

Message created successfully

object
enum<string>
required

Object type identifier

Available options:
list
data
object[]
required

List of messages and their statuses