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. To send a transactional template stored in your account, use Create Template Message. 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. Template check: Every message is checked with the template engine before it is sent. Content that the check refuses is answered with 400, and nothing of the request is sent. When the check cannot run right now, the API answers 503 with a Retry-After header: send the same request again after that delay. See API errors.

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.

A {{ variable }} in a subject resolves, whatever else the subject contains -- an emoji or an accented character included -- for every recipient whose message carries substitutions, the request's own substitutions or that recipient's. A recipient with neither is sent nothing to render, so their subject arrives exactly as written, braces and all.

Pad the braces with ordinary spaces: a variable written with non-ASCII whitespace inside them is not reliably recognised.

On a subject that is being resolved and carries an emoji or an accented character, template syntax other than a variable -- {% ... %}, {# ... #} or an unclosed brace -- is rejected. A substitution value is rejected for any of {{, {% or {#, a {{ ... }} included, and so is a subject whose values combine into one of them.

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. 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. Each name must be visible ASCII with no space and no colon. 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. In the HTML and AMP bodies, values are HTML-escaped; write {{ name|safe }} to insert a value as HTML. The subject, the headers and the text body get values as they are.

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