Skip to content

/messages (POST)

POST
/messages
curl --request POST \
--url https://example.com/api/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "from": { "email": "example", "name": "example" }, "to": { "email": "example", "name": "example" }, "cc": { "email": "example", "name": "example" }, "bcc": { "email": "example", "name": "example" }, "replyTo": "example", "subject": "example", "text": "example", "html": "example", "headers": { "additionalProperty": "example" }, "attachments": [ { "filename": "example", "contentType": "example", "content": "example", "contentId": "example" } ], "tags": [ "example" ], "metadata": { "additionalProperty": "example" } }'

Send a message from an address the token may send from. Answers 202 once Postfix has queued it; what became of it afterwards is GET /messages/{id}. Send an Idempotency-Key header to make a retry safe: the same key with the same body returns the first answer and sends nothing.

idempotency-key
string
>= 1 characters <= 255 characters
Media typeapplication/json
object
from
required
object
email
required
string
name
string
<= 200 characters
to
required
Any of:
Any of:
string
cc
Any of:
Any of:
string
bcc
Any of:
Any of:
string
replyTo
string
subject
required
string
>= 1 characters <= 998 characters
text
string
<= 5000000 characters
html
string
<= 5000000 characters
headers
object
key
additional properties
string
<= 2000 characters
attachments
Array<object>
<= 50 items
object
filename
required
string
>= 1 characters <= 255 characters
contentType
required
string
>= 1 characters <= 200 characters
content
required
string
>= 1 characters
contentId
string
>= 1 characters <= 200 characters
tags
Array<string>
<= 20 items
metadata
object
key
additional properties
string
<= 1000 characters
Examplegenerated
{
"from": {
"email": "example",
"name": "example"
},
"to": {
"email": "example",
"name": "example"
},
"cc": {
"email": "example",
"name": "example"
},
"bcc": {
"email": "example",
"name": "example"
},
"replyTo": "example",
"subject": "example",
"text": "example",
"html": "example",
"headers": {
"additionalProperty": "example"
},
"attachments": [
{
"filename": "example",
"contentType": "example",
"content": "example",
"contentId": "example"
}
],
"tags": [
"example"
],
"metadata": {
"additionalProperty": "example"
}
}

Default Response

Media typeapplication/json
object
id
required
string format: uuid
/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/
messageId
required
string
status
required
string
Allowed values: queued sent deferred bounced rejected failed unknown
createdAt
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$/
Example
{
"status": "queued"
}