POST
/
v2
/
accounts
/
{account_id}
/
messages
Create Message
curl --request POST \
  --url https://api.ahasend.com/v2/accounts/{account_id}/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "from": {
    "email": "[email protected]",
    "name": "Example Corp"
  },
  "recipients": [
    {
      "email": "[email protected]",
      "name": "John Doe"
    }
  ],
  "subject": "Welcome to Example Corp",
  "html_content": "<h1>Welcome {{first_name}}!</h1>",
  "text_content": "Welcome {{first_name}}!",
  "substitutions": {
    "first_name": "John"
  }
}'
{
  "object": "list",
  "data": [
    {
      "object": "message",
      "id": "<string>",
      "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

Response

202
application/json

Message created successfully

The response is of type object.