Skip to content

Send via API

POST /api/v1/emails/send

Terminal window
curl -X POST https://relaypost.dev/api/v1/emails/send \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"from": { "email": "[email protected]", "name": "Your App" },
"to": [{ "email": "[email protected]" }],
"subject": "Your receipt",
"html": "<h1>Thanks for your purchase!</h1><p>Order #1234</p>"
}'
FieldTypeRequiredDescription
fromobjectYesSender — { "email": "...", "name": "..." }
toarrayYesRecipients — [{ "email": "...", "name": "..." }]
ccarrayNoCC recipients
bccarrayNoBCC recipients
subjectstringYesEmail subject line
htmlstringNoHTML body
textstringNoPlain text body
template_idstringNoUse a saved template instead of inline content
template_dataobjectNoKey-value pairs for template variables
headersobjectNoCustom email headers
prioritystringNohigh, normal (default), or low
scheduled_atstringNoISO 8601 datetime for scheduled delivery

You must provide either html, text, or template_id.

{
"data": {
"message_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "queued",
"queued_at": "2025-01-15T10:30:00.000Z"
}
}
StatusCodeDescription
400VALIDATION_ERRORMissing or invalid fields
400DOMAIN_NOT_VERIFIEDFrom address uses an unverified domain
400RECIPIENTS_SUPPRESSEDOne or more recipients are on the suppression list
429LIMIT_EXCEEDEDOrganization email sending limit exceeded
{
"from": { "email": "[email protected]" },
"to": [{ "email": "[email protected]" }],
"subject": "Your receipt",
"template_id": "tmpl_abc123",
"template_data": {
"order_number": "1234",
"total": "$49.99"
}
}

GET /api/v1/emails/:id

Retrieve a specific email by its ID or message ID, including delivery events.

Terminal window
curl https://relaypost.dev/api/v1/emails/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
-H "Authorization: Bearer YOUR_API_KEY"
{
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"message_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"from_address": "[email protected]",
"to_addresses": ["[email protected]"],
"subject": "Your receipt",
"status": "delivered",
"priority": "normal",
"created_at": "2025-01-15T10:30:00.000Z",
"updated_at": "2025-01-15T10:30:05.000Z",
"scheduled_at": null,
"events": [
{
"id": "evt_001",
"type": "delivered",
"recipient": "[email protected]",
"smtp_code": 250,
"smtp_message": "OK",
"created_at": "2025-01-15T10:30:05.000Z"
}
]
}
}
StatusCodeDescription
404NOT_FOUNDEmail not found or belongs to another organization

GET /api/v1/emails

Retrieve a paginated list of emails for your organization.

Terminal window
curl "https://relaypost.dev/api/v1/emails?status=delivered&page=1&limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"
ParameterTypeDefaultDescription
statusstringFilter by status: queued, delivered, bounced, failed, opened
from_datestringISO 8601 start date
to_datestringISO 8601 end date
pageinteger1Page number
limitinteger20Results per page (max 100)
{
"data": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"message_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"from_address": "[email protected]",
"to_addresses": ["[email protected]"],
"subject": "Your receipt",
"status": "delivered",
"priority": "normal",
"created_at": "2025-01-15T10:30:00.000Z",
"updated_at": "2025-01-15T10:30:05.000Z"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total_count": 42,
"total_pages": 5
}
}

Every email goes through these statuses:

queued → processing → delivered → opened
↘ bounced
↘ failed
↘ rejected
StatusMeaning
queuedAccepted and waiting in the delivery queue
scheduledQueued for future delivery at scheduled_at
processingCurrently being sent
deliveredSuccessfully delivered to the recipient’s mail server
openedRecipient opened the email (if tracking is enabled)
bouncedRecipient’s mail server rejected the email
rejectedRelayPost rejected the email (suppression list, validation failure)
failedDelivery failed after all retry attempts