/messages (POST)
POST
/messages
const url = 'https://example.com/api/v1/messages';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"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"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”idempotency-key
string
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
from
required
object
email
required
string
name
string
to
required
cc
bcc
replyTo
string
subject
required
string
text
string
html
string
headers
object
key
additional properties
string
attachments
Array<object>
object
filename
required
string
contentType
required
string
content
required
string
contentId
string
tags
Array<string>
metadata
object
key
additional properties
string
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" }}Responses
Section titled “Responses”Default Response
Media typeapplication/json
object
id
required
string format: uuid
messageId
required
string
status
required
string
createdAt
required
string format: date-time
Example
{ "status": "queued"}