API reference · v1.0

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/send

One 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

NameInDescription
Idempotency-KeyheaderYour unique id for this send. Repeats within 24 hours return the first response and send nothing.

Request body

FieldTypeDescription
from requiredAddress
to requiredRecipient[]Each recipient gets their own copy; they do not see each other Up to 1000 items.
ccRecipient[]Up to 100 items.
bccRecipient[]Up to 100 items.
replyTostring (email)
subjectstringSupports {{variables}} Max 998 characters.
htmlstringHTML body, up to 10 MB. Supports {{variables}}
textstringPlain-text body. Generated from html if left out
template_idstring | integerSlug or id of a published template
variablesobjectValues for {{placeholders}} in subject, html, text or the template
streamstringMessage stream, for example transactional or marketing. Streams can use separate IPs and settings
topicstringPreference-centre topic. Recipients who opted out of it are skipped
campaignstringGroups bulk sends so they can be reported on, paused or cancelled Max 60 characters.
unsubscribebooleanAdd List-Unsubscribe and one-click headers (on by default for marketing streams)
send_atstring (date-time)Schedule up to 7 days ahead (ISO 8601 with offset)
headersobjectCustom headers. Names must start with X-
tagsstring[]Free labels, returned in events and webhooks Up to 10 items.
attachmentsAttachment[]Up to 20 items.

Response 202

Accepted for delivery (or scheduled, or captured for a test key)

FieldTypeDescription
idstringMessage id, used in events and logs
heldbooleanThe account is under automatic review: the message waits in the queue (up to 72 hours) until the review clears
deferred_untilstring (date-time)New-account daily limit reached: the message sends at this time
noticestring
statusstringOne of: queued, scheduled, captured
acceptedintegerRecipients queued
rejectedstring[]
suppressedstring[]Skipped because they are on your suppression list
invalidInvalidRecipient[]
send_atstring (date-time)
testboolean

Errors

400 401 402 403 409 422 429 502 503 See error codes

Request
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"
    ]
  }'
Response 202
{
  "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/batch

Common fields once, then up to 500 messages each with its own to and variables.

Requires the send scope.

Request body

FieldTypeDescription
from requiredAddress
subjectstring
htmlstring
textstring
template_idstring
streamstring
topicstring
messages requiredobject[]Up to 500 items.

Response 202

Accepted per message

Errors

400 401 402 403 409 422 429 502 503 See error codes

Request
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/scheduled

Requires the send scope.

Response 200

Scheduled messages

Errors

400 401 403 429 See error codes

Request
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

NameInDescription
id requiredpathstring

Response 200

Cancelled

Errors

400 401 403 429 See error codes

Request
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/templates

Requires the send scope.

Response 200

Templates

Errors

400 401 403 429 See error codes

Request
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/events

Requires the events scope.

Parameters

NameInDescription
typequerystring One of: delivered, bounce, deferred, complaint, open, click, unsubscribe
message_idquerystring
rcptquerystring
domainquerystring
sincequerystring (date-time)
limitqueryinteger

Response 200

Newest first

FieldTypeDescription
dataEvent[]

Errors

400 401 403 429 See error codes

Request
curl -X GET https://api.sendtrixapi.com/v1/events \
  -H "Authorization: Bearer $SENDTRIX_KEY"
Response 200
{
  "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/suppressions

Requires the send scope.

Parameters

NameInDescription
emailquerystring
limitqueryinteger
offsetqueryinteger

Response 200

Suppressed addresses

FieldTypeDescription
totalinteger
rowsSuppression[]

Errors

400 401 403 429 See error codes

Request
curl -X GET https://api.sendtrixapi.com/v1/suppressions \
  -H "Authorization: Bearer $SENDTRIX_KEY"
Response 200
{
  "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/suppressions

Requires the send scope.

Request body

FieldTypeDescription
emails requiredstring[]Up to 10000 items.
reasonstringOne of: manual, unsubscribe

Response 200

Added

Errors

400 401 403 429 See error codes

Request
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

NameInDescription
email requiredpathstring (email)

Response 200

Removed

Errors

400 401 403 429 See error codes

Request
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/preferences

Requires the send scope.

Parameters

NameInDescription
sincequerystring (date-time)

Response 200

Changes

Errors

400 401 403 429 See error codes

Request
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

NameInDescription
email requiredpathstring (email)

Response 200

Preferences

Errors

400 401 403 429 See error codes

Request
curl -X GET https://api.sendtrixapi.com/v1/preferences/ana%40example.com \
  -H "Authorization: Bearer $SENDTRIX_KEY"
Response 200
{
  "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/validate

Requires the send scope.

Request body

FieldTypeDescription
email requiredstring

Response 200

Validation result

FieldTypeDescription
emailstring
resultstringOne of: valid, risky, invalid
checksobject
did_you_meanstring | null

Errors

400 401 403 429 See error codes

Request
curl -X POST https://api.sendtrixapi.com/v1/validate \
  -H "Authorization: Bearer $SENDTRIX_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]"
  }'
Response 200
{
  "email": "string",
  "result": "valid",
  "checks": {
    "syntax": true,
    "mx": true,
    "mx_hosts": [
      "string"
    ],
    "disposable": true,
    "role": true
  },
  "did_you_mean": "string"
}

Objects

Message

FieldTypeDescription
from requiredAddress
to requiredRecipient[]Each recipient gets their own copy; they do not see each other Up to 1000 items.
ccRecipient[]Up to 100 items.
bccRecipient[]Up to 100 items.
replyTostring (email)
subjectstringSupports {{variables}} Max 998 characters.
htmlstringHTML body, up to 10 MB. Supports {{variables}}
textstringPlain-text body. Generated from html if left out
template_idstring | integerSlug or id of a published template
variablesobjectValues for {{placeholders}} in subject, html, text or the template
streamstringMessage stream, for example transactional or marketing. Streams can use separate IPs and settings
topicstringPreference-centre topic. Recipients who opted out of it are skipped
campaignstringGroups bulk sends so they can be reported on, paused or cancelled Max 60 characters.
unsubscribebooleanAdd List-Unsubscribe and one-click headers (on by default for marketing streams)
send_atstring (date-time)Schedule up to 7 days ahead (ISO 8601 with offset)
headersobjectCustom headers. Names must start with X-
tagsstring[]Free labels, returned in events and webhooks Up to 10 items.
attachmentsAttachment[]Up to 20 items.

SendResult

FieldTypeDescription
idstringMessage id, used in events and logs
heldbooleanThe account is under automatic review: the message waits in the queue (up to 72 hours) until the review clears
deferred_untilstring (date-time)New-account daily limit reached: the message sends at this time
noticestring
statusstringOne of: queued, scheduled, captured
acceptedintegerRecipients queued
rejectedstring[]
suppressedstring[]Skipped because they are on your suppression list
invalidInvalidRecipient[]
send_atstring (date-time)
testboolean

InvalidRecipient

FieldTypeDescription
emailstring
codestringOne of: syntax, placeholder, typo_domain, tld_typo, disposable
reasonstring
suggestionstring | null

Event

FieldTypeDescription
tsstring (date-time)
botstringOpens 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_openbooleanOpens only: fetched automatically, not read
typestringOne of: delivered, bounce, transient, deferred, complaint, open, click, unsubscribe
message_idstring
domainstringSending domain
rcptstring
rcpt_domainstring
providerstring
source_ipstringYour sending IP
dsn_statusstring
dsn_diagstringThe receiving server's own reply
bounce_catstring
queued_msinteger

Suppression

FieldTypeDescription
idinteger
emailstring
reasonstringOne of: bounce, complaint, unsubscribe, manual, invalid
detailstring | null
created_atstring (date-time)

Validation

FieldTypeDescription
emailstring
resultstringOne of: valid, risky, invalid
checksobject
did_you_meanstring | null

Error

FieldTypeDescription
error requiredstringHuman-readable message
codestringStable machine-readable code, see Error codes
detailsobjectField errors for 400 invalid_request
invalidInvalidRecipient[]

Error codes

Branch on code, not on the message text. Messages may be reworded; codes stay stable.

HTTPcodeMeaning
400invalid_requestThe body failed validation. details lists the fields.
400send_at_too_farsend_at is more than 7 days ahead.
400stream_unknownThe stream does not exist on your account.
400template_unpublishedThe template exists but has no published version.
400template_incompleteThe template is missing a subject or body.
400too_many_recipientsMore recipients than your plan allows in one message.
400idempotency_key_invalidIdempotency-Key is longer than 100 characters or contains spaces.
401unauthorizedMissing, unknown or revoked API key.
402no_creditsYour prepaid credits are used up.
403account_suspendedThe account is suspended. Contact support.
403domain_unverifiedThe From domain is added but its DNS records are not verified yet.
403domain_unknownThe From domain is not added to your account.
403domain_not_ownedThe From domain belongs to another account.
403sandboxSandbox accounts can only send to verified addresses.
403feature_offThe feature is not part of your plan.
403key_scopeThe API key does not have the scope this endpoint needs.
403access_blockedThe request breaks the key's access rules (IP allow-list, allowed domains).
404template_unknownNo template with this id.
409idempotency_in_progressAn earlier request with the same Idempotency-Key is still running. Retry in a moment to get its result.
422bad_recipientEvery recipient was refused by the recipient guard (typo, placeholder or disposable domain). invalid lists each address with the reason.
422all_suppressedEvery recipient is on your suppression list.
422content_blockedThe content matched a blocked pattern (for example a known phishing URL).
422provider_blockedThe recipient's mailbox provider currently refuses mail from your route.
429hourly_limitHourly sending limit reached.
429daily_limitDaily sending limit reached.
429monthly_limitMonthly sending limit reached. Upgrade or enable overage.
429rate_limitedToo many API requests. Back off and retry after the Retry-After header.
502node_errorThe message could not be handed to a sending server. Safe to retry with the same Idempotency-Key.
503node_offlineNo 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