SendTrix API
Email API and SMTP relay with per-provider traffic shaping. Base URL https://api.sendtrixapi.com
The SendTrix API sends transactional and marketing email and gives you delivery data back.
Base URL and authentication
All requests go to the server URL shown below over HTTPS. Authenticate with an API key in the Authorization header:
Authorization: Bearer st_live_xxxxxxxxxxxxxxxx
Create keys in the dashboard under API & SMTP. Each key has scopes (send, events), an optional IP allow-list and its own limits. Keys starting with st_test_ run every check and capture the message in your Test inbox, but never deliver it.
Requests and responses
Send JSON with Content-Type: application/json. Every response is JSON. Errors always have an error message and, where it helps, a stable code you can branch on (see Error codes).
Idempotency
Add an Idempotency-Key header (up to 100 characters, for example your order id) to POST /v1/send. If the same key is sent again within 24 hours, the original response is returned with Idempotent-Replayed: true and no second email is sent.
Recipient guard
Addresses on disposable domains, placeholder domains (example.com, test.com) and mistyped provider domains (gmial.com, hotmial.com) are refused before sending, added to your suppression list with the reason, and returned in the invalid array. If every recipient is refused you get 422 bad_recipient.
Rate limits
POST /v1/send: 600 requests per second per key. POST /v1/send/batch and POST /v1/validate: 20 per second per key. Other endpoints: 300 per minute per IP. Over the limit you get 429 with a Retry-After header. Sending volume limits (hourly, daily, monthly) come from your plan.
Webhooks
Delivery, bounce, complaint, open, click and unsubscribe events are pushed to your webhook URLs, signed with HMAC-SHA256 in the X-SendTrix-Signature header. Configure them in the dashboard under Webhooks.
Sending
Send single messages, personalised batches and scheduled email.
POST Send an email
/v1/sendOne message to up to 1000 recipients. Add send_at to schedule (max 7 days ahead), stream to pick a message stream, topic to honour preference-centre opt-outs, or template_id + variables to use a template.
Requires the send scope.
Parameters
| Name | In | Description |
|---|---|---|
Idempotency-Key | header | Your unique id for this send. Repeats within 24 hours return the first response and send nothing. |
Request body
| Field | Type | Description |
|---|---|---|
from required | Address | |
to required | Recipient[] | Each recipient gets their own copy; they do not see each other Up to 1000 items. |
cc | Recipient[] | Up to 100 items. |
bcc | Recipient[] | Up to 100 items. |
replyTo | string (email) | |
subject | string | Supports {{variables}} Max 998 characters. |
html | string | HTML body, up to 10 MB. Supports {{variables}} |
text | string | Plain-text body. Generated from html if left out |
template_id | string | integer | Slug or id of a published template |
variables | object | Values for {{placeholders}} in subject, html, text or the template |
stream | string | Message stream, for example transactional or marketing. Streams can use separate IPs and settings |
topic | string | Preference-centre topic. Recipients who opted out of it are skipped |
campaign | string | Groups bulk sends so they can be reported on, paused or cancelled Max 60 characters. |
unsubscribe | boolean | Add List-Unsubscribe and one-click headers (on by default for marketing streams) |
send_at | string (date-time) | Schedule up to 7 days ahead (ISO 8601 with offset) |
headers | object | Custom headers. Names must start with X- |
tags | string[] | Free labels, returned in events and webhooks Up to 10 items. |
attachments | Attachment[] | Up to 20 items. |
Response 202
Accepted for delivery (or scheduled, or captured for a test key)
| Field | Type | Description |
|---|---|---|
id | string | Message id, used in events and logs |
held | boolean | The account is under automatic review: the message waits in the queue (up to 72 hours) until the review clears |
deferred_until | string (date-time) | New-account daily limit reached: the message sends at this time |
notice | string | |
status | string | One of: queued, scheduled, captured |
accepted | integer | Recipients queued |
rejected | string[] | |
suppressed | string[] | Skipped because they are on your suppression list |
invalid | InvalidRecipient[] | |
send_at | string (date-time) | |
test | boolean |
Errors
400 401 402 403 409 422 429 502 503 See error codes
curl -X POST https://api.sendtrixapi.com/v1/send \
-H "Authorization: Bearer $SENDTRIX_KEY" \
-H "Idempotency-Key: order-48213" \
-H "Content-Type: application/json" \
-d '{
"from": {
"email": "[email protected]",
"name": "Example"
},
"to": [
"[email protected]"
],
"subject": "Your receipt",
"html": "<p>Thanks for your order!</p>",
"text": "Thanks for your order!",
"tags": [
"receipt"
]
}'{
"id": "st_01JF8Q4ZC4H7",
"status": "queued",
"accepted": 1,
"rejected": [],
"suppressed": [],
"invalid": [
{
"email": "[email protected]",
"code": "disposable",
"reason": "Disposable mailbox domain",
"suggestion": null
}
]
}POST Send personalised copies (batch)
/v1/send/batchCommon fields once, then up to 500 messages each with its own to and variables.
Requires the send scope.
Request body
| Field | Type | Description |
|---|---|---|
from required | Address | |
subject | string | |
html | string | |
text | string | |
template_id | string | |
stream | string | |
topic | string | |
messages required | object[] | Up to 500 items. |
Response 202
Accepted per message
Errors
400 401 402 403 409 422 429 502 503 See error codes
curl -X POST https://api.sendtrixapi.com/v1/send/batch \
-H "Authorization: Bearer $SENDTRIX_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": {
"email": "[email protected]"
},
"subject": "Hi {{name}}",
"text": "Hello {{name}}",
"messages": [
{
"to": "[email protected]",
"variables": {
"name": "Ann"
}
},
{
"to": "[email protected]",
"variables": {
"name": "Bob"
}
}
]
}'GET List scheduled sends
/v1/scheduledRequires the send scope.
Response 200
Scheduled messages
Errors
400 401 403 429 See error codes
curl -X GET https://api.sendtrixapi.com/v1/scheduled \ -H "Authorization: Bearer $SENDTRIX_KEY"
DELETE Cancel a scheduled send
/v1/scheduled/{id}Requires the send scope.
Parameters
| Name | In | Description |
|---|---|---|
id required | path | string |
Response 200
Cancelled
Errors
400 401 403 429 See error codes
curl -X DELETE https://api.sendtrixapi.com/v1/scheduled/sch_123 \ -H "Authorization: Bearer $SENDTRIX_KEY"
Templates
Read the templates published in your dashboard.
GET List published templates
/v1/templatesRequires the send scope.
Response 200
Templates
Errors
400 401 403 429 See error codes
curl -X GET https://api.sendtrixapi.com/v1/templates \ -H "Authorization: Bearer $SENDTRIX_KEY"
Events
Delivery data: delivered, bounced, deferred, complained, opened, clicked, unsubscribed.
GET Delivery events (delivered, bounced, opened, …)
/v1/eventsRequires the events scope.
Parameters
| Name | In | Description |
|---|---|---|
type | query | string One of: delivered, bounce, deferred, complaint, open, click, unsubscribe |
message_id | query | string |
rcpt | query | string |
domain | query | string |
since | query | string (date-time) |
limit | query | integer |
Response 200
Newest first
| Field | Type | Description |
|---|---|---|
data | Event[] |
Errors
400 401 403 429 See error codes
curl -X GET https://api.sendtrixapi.com/v1/events \ -H "Authorization: Bearer $SENDTRIX_KEY"
{
"data": [
{
"ts": "string",
"bot": "",
"machine_open": true,
"type": "delivered",
"message_id": "string",
"domain": "string",
"rcpt": "string",
"rcpt_domain": "string",
"provider": "gmail",
"source_ip": "string",
"dsn_status": "5.1.1",
"dsn_diag": "string",
"bounce_cat": "bad-mailbox",
"queued_ms": 0
}
]
}Suppressions
Addresses that will not be emailed again: bounces, complaints, unsubscribes, refused recipients and manual entries.
GET List suppressed addresses
/v1/suppressionsRequires the send scope.
Parameters
| Name | In | Description |
|---|---|---|
email | query | string |
limit | query | integer |
offset | query | integer |
Response 200
Suppressed addresses
| Field | Type | Description |
|---|---|---|
total | integer | |
rows | Suppression[] |
Errors
400 401 403 429 See error codes
curl -X GET https://api.sendtrixapi.com/v1/suppressions \ -H "Authorization: Bearer $SENDTRIX_KEY"
{
"total": 0,
"rows": [
{
"id": 0,
"email": "string",
"reason": "bounce",
"detail": "typo_domain: Mistyped provider domain (did you mean gmail.com?)",
"created_at": "string"
}
]
}POST Add addresses to the suppression list
/v1/suppressionsRequires the send scope.
Request body
| Field | Type | Description |
|---|---|---|
emails required | string[] | Up to 10000 items. |
reason | string | One of: manual, unsubscribe |
Response 200
Added
Errors
400 401 403 429 See error codes
curl -X POST https://api.sendtrixapi.com/v1/suppressions \
-H "Authorization: Bearer $SENDTRIX_KEY" \
-H "Content-Type: application/json" \
-d '{
"emails": [
"[email protected]"
],
"reason": "manual"
}'DELETE Remove an address from the suppression list
/v1/suppressions/{email}Requires the send scope.
Parameters
| Name | In | Description |
|---|---|---|
email required | path | string (email) |
Response 200
Removed
Errors
400 401 403 429 See error codes
curl -X DELETE https://api.sendtrixapi.com/v1/suppressions/ana%40example.com \ -H "Authorization: Bearer $SENDTRIX_KEY"
Preferences
What recipients chose in the preference centre.
GET Preference-centre changes since a time
/v1/preferencesRequires the send scope.
Parameters
| Name | In | Description |
|---|---|---|
since | query | string (date-time) |
Response 200
Changes
Errors
400 401 403 429 See error codes
curl -X GET https://api.sendtrixapi.com/v1/preferences \ -H "Authorization: Bearer $SENDTRIX_KEY"
GET One recipient's preferences
/v1/preferences/{email}Requires the send scope.
Parameters
| Name | In | Description |
|---|---|---|
email required | path | string (email) |
Response 200
Preferences
Errors
400 401 403 429 See error codes
curl -X GET https://api.sendtrixapi.com/v1/preferences/ana%40example.com \ -H "Authorization: Bearer $SENDTRIX_KEY"
{
"email": "[email protected]",
"unsubscribed": false,
"topics_off": [
"promo"
],
"frequency": "less"
}Validation
Check an address before you add it to a list.
POST Validate an email address
/v1/validateRequires the send scope.
Request body
| Field | Type | Description |
|---|---|---|
email required | string |
Response 200
Validation result
| Field | Type | Description |
|---|---|---|
email | string | |
result | string | One of: valid, risky, invalid |
checks | object | |
did_you_mean | string | null |
Errors
400 401 403 429 See error codes
curl -X POST https://api.sendtrixapi.com/v1/validate \
-H "Authorization: Bearer $SENDTRIX_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]"
}'{
"email": "string",
"result": "valid",
"checks": {
"syntax": true,
"mx": true,
"mx_hosts": [
"string"
],
"disposable": true,
"role": true
},
"did_you_mean": "string"
}Objects
Message
| Field | Type | Description |
|---|---|---|
from required | Address | |
to required | Recipient[] | Each recipient gets their own copy; they do not see each other Up to 1000 items. |
cc | Recipient[] | Up to 100 items. |
bcc | Recipient[] | Up to 100 items. |
replyTo | string (email) | |
subject | string | Supports {{variables}} Max 998 characters. |
html | string | HTML body, up to 10 MB. Supports {{variables}} |
text | string | Plain-text body. Generated from html if left out |
template_id | string | integer | Slug or id of a published template |
variables | object | Values for {{placeholders}} in subject, html, text or the template |
stream | string | Message stream, for example transactional or marketing. Streams can use separate IPs and settings |
topic | string | Preference-centre topic. Recipients who opted out of it are skipped |
campaign | string | Groups bulk sends so they can be reported on, paused or cancelled Max 60 characters. |
unsubscribe | boolean | Add List-Unsubscribe and one-click headers (on by default for marketing streams) |
send_at | string (date-time) | Schedule up to 7 days ahead (ISO 8601 with offset) |
headers | object | Custom headers. Names must start with X- |
tags | string[] | Free labels, returned in events and webhooks Up to 10 items. |
attachments | Attachment[] | Up to 20 items. |
SendResult
| Field | Type | Description |
|---|---|---|
id | string | Message id, used in events and logs |
held | boolean | The account is under automatic review: the message waits in the queue (up to 72 hours) until the review clears |
deferred_until | string (date-time) | New-account daily limit reached: the message sends at this time |
notice | string | |
status | string | One of: queued, scheduled, captured |
accepted | integer | Recipients queued |
rejected | string[] | |
suppressed | string[] | Skipped because they are on your suppression list |
invalid | InvalidRecipient[] | |
send_at | string (date-time) | |
test | boolean |
InvalidRecipient
| Field | Type | Description |
|---|---|---|
email | string | |
code | string | One of: syntax, placeholder, typo_domain, tld_typo, disposable |
reason | string | |
suggestion | string | null |
Event
| Field | Type | Description |
|---|---|---|
ts | string (date-time) | |
bot | string | Opens and clicks only. Empty = likely a person. google_proxy = Gmail or Yahoo image proxy (a real open). apple = Apple Mail Privacy Protection. scanner = security gateway or script. prefetch = too fast after sending for a person. One of: , google_proxy, apple, scanner, prefetch |
machine_open | boolean | Opens only: fetched automatically, not read |
type | string | One of: delivered, bounce, transient, deferred, complaint, open, click, unsubscribe |
message_id | string | |
domain | string | Sending domain |
rcpt | string | |
rcpt_domain | string | |
provider | string | |
source_ip | string | Your sending IP |
dsn_status | string | |
dsn_diag | string | The receiving server's own reply |
bounce_cat | string | |
queued_ms | integer |
Suppression
| Field | Type | Description |
|---|---|---|
id | integer | |
email | string | |
reason | string | One of: bounce, complaint, unsubscribe, manual, invalid |
detail | string | null | |
created_at | string (date-time) |
Validation
| Field | Type | Description |
|---|---|---|
email | string | |
result | string | One of: valid, risky, invalid |
checks | object | |
did_you_mean | string | null |
Error
| Field | Type | Description |
|---|---|---|
error required | string | Human-readable message |
code | string | Stable machine-readable code, see Error codes |
details | object | Field errors for 400 invalid_request |
invalid | InvalidRecipient[] |
Error codes
Branch on code, not on the message text. Messages may be reworded; codes stay stable.
| HTTP | code | Meaning |
|---|---|---|
| 400 | invalid_request | The body failed validation. details lists the fields. |
| 400 | send_at_too_far | send_at is more than 7 days ahead. |
| 400 | stream_unknown | The stream does not exist on your account. |
| 400 | template_unpublished | The template exists but has no published version. |
| 400 | template_incomplete | The template is missing a subject or body. |
| 400 | too_many_recipients | More recipients than your plan allows in one message. |
| 400 | idempotency_key_invalid | Idempotency-Key is longer than 100 characters or contains spaces. |
| 401 | unauthorized | Missing, unknown or revoked API key. |
| 402 | no_credits | Your prepaid credits are used up. |
| 403 | account_suspended | The account is suspended. Contact support. |
| 403 | domain_unverified | The From domain is added but its DNS records are not verified yet. |
| 403 | domain_unknown | The From domain is not added to your account. |
| 403 | domain_not_owned | The From domain belongs to another account. |
| 403 | sandbox | Sandbox accounts can only send to verified addresses. |
| 403 | feature_off | The feature is not part of your plan. |
| 403 | key_scope | The API key does not have the scope this endpoint needs. |
| 403 | access_blocked | The request breaks the key's access rules (IP allow-list, allowed domains). |
| 404 | template_unknown | No template with this id. |
| 409 | idempotency_in_progress | An earlier request with the same Idempotency-Key is still running. Retry in a moment to get its result. |
| 422 | bad_recipient | Every recipient was refused by the recipient guard (typo, placeholder or disposable domain). invalid lists each address with the reason. |
| 422 | all_suppressed | Every recipient is on your suppression list. |
| 422 | content_blocked | The content matched a blocked pattern (for example a known phishing URL). |
| 422 | provider_blocked | The recipient's mailbox provider currently refuses mail from your route. |
| 429 | hourly_limit | Hourly sending limit reached. |
| 429 | daily_limit | Daily sending limit reached. |
| 429 | monthly_limit | Monthly sending limit reached. Upgrade or enable overage. |
| 429 | rate_limited | Too many API requests. Back off and retry after the Retry-After header. |
| 502 | node_error | The message could not be handed to a sending server. Safe to retry with the same Idempotency-Key. |
| 503 | node_offline | No sending server is available for your route right now. Retry with backoff. |
OpenAPI and Postman
Import the machine-readable description into Postman, Insomnia, Stoplight or a code generator.
curl -s https://api.sendtrixapi.com/v1/openapi.json -o sendtrix-openapi.json curl -s https://api.sendtrixapi.com/v1/postman.json -o sendtrix.postman_collection.json