Send a message

Sends a message on the requested channel and returns the created message with a 201 Created status.

POST
/v1/messages

Sends a message on the requested channel and returns the created message with a 201 Created status. channel selects the payload variant. Repeating an identical request with the same optional Idempotency-Key header returns the original message; reusing the key for different content returns a conflict.

x-api-key<token>

In: header

Header Parameters

idempotency-key?|null

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

conversationId?|null|null
metadata?|null
channel*"email"

Value in

  • "email"
to*array<|>
Items1 <= items
cc?array<|>|null|null
bcc?array<|>|null|null
from?|null
email*

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/messages" \  -H "Content-Type: application/json" \  -d '{    "channel": "email",    "to": [      {        "contactId": "string"      }    ],    "email": {}  }'
{  "id": "string",  "organizationId": "string",  "conversationId": "string",  "parentMessageId": "string",  "fromActorId": "string",  "actorMetadata": {},  "channel": "email",  "direction": "outbound",  "content": null,  "metadata": {},  "status": "pending",  "scheduledAt": "string",  "tags": [    "string"  ],  "categories": [    "string"  ],  "isTest": true,  "externalId": "string",  "referenceId": "string",  "submission": {    "origin": "direct",    "transport": "http",    "credential": {      "kind": "api_key",      "apiKeyId": "string"    },    "userId": "string",    "client": {      "surface": "typescript-promise",      "version": "string"    }  },  "createdAt": "string",  "updatedAt": "string",  "fromContact": {    "id": "string",    "name": "string",    "displayName": "string",    "type": "string",    "identities": [      {        "channel": "email",        "identifier": "string",        "verified": true      }    ]  },  "toContacts": [    {      "id": "string",      "name": "string",      "displayName": "string",      "type": "string",      "identities": [        {          "channel": "email",          "identifier": "string",          "verified": true        }      ]    }  ],  "recipients": [    {      "id": "string",      "messageId": "string",      "actorId": "string",      "contactId": "string",      "identityId": "string",      "kind": "to",      "address": "string",      "status": "pending",      "createdAt": "string",      "updatedAt": "string",      "contact": {        "id": "string",        "name": "string",        "displayName": "string",        "type": "string",        "identities": [          {            "channel": "email",            "identifier": "string",            "verified": true          }        ]      }    }  ],  "deliveries": [    {      "scheduling": {        "dueAt": "string",        "expiresAt": "string",        "waitReason": "rate"      },      "id": "string",      "messageId": "string",      "recipientId": "string",      "channel": "email",      "status": "pending",      "attemptCount": 0,      "maxAttempts": 0,      "queuedAt": "string",      "claimedAt": "string",      "lastAttemptAt": "string",      "nextRetryAt": "string",      "sentAt": "string",      "deliveredAt": "string",      "readAt": "string",      "failedAt": "string",      "terminalAt": "string",      "errorCode": "string",      "errorMessage": "string",      "errorDetails": null,      "cost": "string",      "currency": "string",      "idempotencyKey": "string",      "metadata": null,      "createdAt": "string",      "updatedAt": "string"    }  ],  "emailDeliveryDetails": [    {      "deliveryId": "string",      "messageIdHeader": "string",      "inReplyTo": "string",      "references": [        "string"      ],      "subject": "string",      "fromEmail": "string",      "fromName": "string",      "toEmails": [        "string"      ],      "toName": "string",      "ccEmails": [        "string"      ],      "bccEmails": [        "string"      ],      "replyToEmails": [        "string"      ],      "hasAttachments": true,      "attachmentCount": 0,      "listUnsubscribeUrl": "string",      "listUnsubscribeEmail": "string",      "threadPosition": 0,      "newContent": "string",      "quotedContent": "string",      "hasQuotedContent": true,      "dkimVerdict": "string",      "spfVerdict": "string",      "dmarcVerdict": "string",      "isAutoReply": true,      "autoReplyReason": "out-of-office",      "priority": "string",      "parsingErrors": [        "string"      ],      "parsingDuration": 0,      "receivedAt": "string",      "processedAt": "string",      "createdAt": "string",      "updatedAt": "string"    }  ]}

Related