POST
/
v2
/
accounts
/
{account_id}
/
messages
/
conversation
Create Conversational Message
curl --request POST \
  --url https://api.ahasend.com/v2/accounts/{account_id}/messages/conversation \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "from": {
    "email": "[email protected]",
    "name": "Example Corp"
  },
  "to": [
    {
      "email": "[email protected]",
      "name": "John Doe"
    },
    {
      "email": "[email protected]",
      "name": "Jane Doe"
    }
  ],
  "cc": [
    {
      "email": "[email protected]",
      "name": "Example Corp HR"
    }
  ],
  "bcc": [
    {
      "email": "[email protected]",
      "name": "BCC Recipient"
    }
  ],
  "subject": "Welcome to Example Corp",
  "html_content": "<h1>Dear John and Jane, welcome to Example Corp!</h1>",
  "text_content": "Dear John and Jane, welcome to Example Corp!"
}'
{
  "object": "list",
  "data": [
    {
      "object": "message",
      "id": "<[email protected]>",
      "recipient": {
        "email": "[email protected]",
        "name": "John Doe",
        "substitutions": {
          "first_name": "John",
          "order_id": "12345"
        }
      },
      "status": "queued",
      "error": "<string>",
      "schedule": {
        "first_attempt": "2023-12-25T10:30:00Z",
        "expires": "2023-12-26T10:30:00Z"
      }
    }
  ]
}

Authorizations

Authorization
string
header
required

API key for authentication

Headers

Idempotency-Key
string

Optional idempotency key for safe request retries. Must be a unique string for each logical request. Requests with the same key will return the same response. Keys expire after 24 hours.

Maximum length: 255

Path Parameters

account_id
string<uuid>
required

Account ID

Body

application/json
from
object
required
Example:
{
"email": "[email protected]",
"name": "Example Corp"
}
subject
string
required

Email subject line

to
object[]

This parameter can set the To header to multiple addresses.

Minimum length: 1
cc
object[]

This parameter can set the CC header to multiple addresses. Do not include cc in the headers array.

Minimum length: 1
bcc
object[]

This parameter can set the To header to multiple addresses.

Minimum length: 1
reply_to
object

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

Example:
{
"email": "[email protected]",
"name": "Example Corp"
}
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

headers
object

Custom email headers. cc and reply-to headers cannot be provided if reply_to or cc parameters are provided, message-id will be ignored and automatically generated

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:
{ "open": true, "click": true }
retention
object | null

Retention settings for the message, overrides default account settings

Example:
{ "metadata": 1, "data": 0 }
schedule
object

Schedule for message delivery

Example:
{
"first_attempt": "2023-12-25T10:30:00Z",
"expires": "2023-12-26T10:30:00Z"
}

Response

Message created successfully

object
enum<string>
required

Object type identifier

Available options:
list
data
object[]
required

List of messages and their statuses