Email API
Email API
Transactional email from your own domain — receipts, sign-in codes, notifications — with one call.
The Email API sends the email your application triggers: a receipt after checkout, a sign-in code, a booking reminder. It sends from your domain, reports what happened to every message after it left, and tells your server through signed webhooks.
It lives in your Mercestack workspace, under Email API in the sidebar: API keys, the delivery log, webhooks and suppressions. It uses the same workspace, domains, plan and team roles as everything else. Requests go to emailapi.mercestack.com.
- 01
Verify a domain
In workspace Settings → Domains, publish the DNS records shown, then mark the domain for transactional email. It is the same domain the rest of your workspace sends from.
- 02
Create a key
In Email API → API keys. A *sending* key can only send and cancel — give that one to your application servers.
- 03
Send
One
POST /v1/email. The message appears in Email API → Emails straight away.
Your first email
curl -X POST https://emailapi.mercestack.com/v1/email \
-H "Authorization: Bearer msk_live_…" \
-H "Content-Type: application/json" \
-d '{
"from": "Acme <[email protected]>",
"to": "[email protected]",
"subject": "Your receipt",
"html": "<p>Thanks for your order.</p>"
}'Keys
| Key | Can | Use it for |
|---|---|---|
Sending (msk_live_…) | Send, batch, cancel a scheduled send | Application servers |
Full access (msk_live_…) | All of the above, plus read messages and manage templates | Internal tools, scripts |
Either kind can be limited to some of your domains, so a key for one product's receipts cannot send as your company's main address. Email API keys are separate from the platform's sk_ keys; neither works on the other's API.
Status codes
| Code | Means | Retry? |
|---|---|---|
200 / 201 | Accepted — or scheduled | — |
400 | The request is malformed (an address, a header, a batch item) | No — fix it |
401 | Unknown or revoked key | No |
403 | The key cannot do this (sending-only, wrong domain), or the plan does not include it | No |
422 | Your setup: the domain is not verified or not marked transactional, a template is missing, or a recipient is suppressed | No — fix the setup |
429 | Rate limited | Yes, with backoff |
502 | The provider failed | Yes, with an Idempotency-Key |