Examples
Ready-to-use code to report the transactional emails your back end sends. Each example reads the key from the SUBLIM_API_KEY environment variable: create one in Project settings → API keys (see Create a key).
All of them follow the same rule: reporting to Sublim must never get in the way of sending the email. Report after the email has gone, with a short timeout, and swallow every error. When your stack has a queue, report from it.
Pick your stack
Your choice is remembered on the other pages of this documentation.
Report a message your SMTP server accepted:
Terminal
curl https://tracker.sublimanalytics.com/api/v2/server/emails \
-H "Authorization: Bearer $SUBLIM_API_KEY" \
-H "Content-Type: application/json" \
--max-time 2 \
-d '{
"events": [
{
"id": "<a1b2c3@mail.example.com>",
"event": "sent",
"template": "order-confirmation",
"subject": "Your order #1042",
"recipient": "jane@example.com",
"provider": "smtp"
}
]
}'
Several events in one request, for example from a nightly job that reads your mail server's logs:
Terminal
curl https://tracker.sublimanalytics.com/api/v2/server/emails \
-H "Authorization: Bearer $SUBLIM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"events": [
{ "id": "<a1b2c3@mail.example.com>", "event": "delivered", "timestamp": "2026-10-17T09:30:04Z", "provider": "postfix" },
{ "id": "<d4e5f6@mail.example.com>", "event": "bounced", "timestamp": "2026-10-17T09:31:12Z", "provider": "postfix" }
]
}'
Remove messages reported by mistake:
Terminal
curl -X DELETE https://tracker.sublimanalytics.com/api/v2/server/emails \
-H "Authorization: Bearer $SUBLIM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ids": ["<a1b2c3@mail.example.com>"]}'
Going further
- Every field and response: Emails reference.
- Rate limits, errors and retries: Server API.