On this page

API documentation

Create inboxes and read the mail that arrives for them. SarabMail does not send email.

Temporary email API overview

Base URL https://sarabmail.com/api/v1

OpenAPI

Create a free key

Copy it now. SarabMail stores only a hash, so this is the only time the full key is shown.

Authentication

Send the key as Authorization: Bearer sm_live_… or in the X-Api-Key header. SarabMail stores only a SHA-256 hash of the secret.

A free key can be minted on this page. Creation is limited to five keys an hour for each network.

curl https://sarabmail.com/api/v1/usage \
  -H "Authorization: Bearer sm_live_…"

Tiers

API Free includes 100 emails received a month, 50 new inboxes a month, and 5 inboxes at a time, on public mail domains. Retention matches a guest inbox, about one hour. The key is limited to 30 requests a minute. Call the API from your server: responses do not include CORS headers, so a page on another site cannot read them. Starter is $12/mo or $9/mo yearly for 5,000 emails. Team is $39/mo or $29/mo yearly for 50,000 emails and one private subdomain. Business is $99/mo or $79/mo yearly for 300,000 emails and 3 private domains. Enterprise starts at $299.

Plus is $3.99/mo or $29/yr: no ads, 10 inboxes, and 30-day storage on the same public mail domains as the free inbox. Pro is $7.99/mo or $59/yr: permanent inboxes, a custom domain, a forwarding hook, and a light API. Paid tiers are billed by Paddle, the merchant of record, and the upgrade is applied automatically after payment. Plus and Pro attach to the account you sign in with, using Google or email. API plans attach to an API key. Cancel anytime.

Inboxes

POST /inboxes creates an address on a mail-pool domain, never on sarabmail.com. An empty body mints a random name. Pass localPart and domain to choose one. ttlMinutes is clamped to the plan maximum. permanent: true is for Pro, Business, and Enterprise.

curl -X POST https://sarabmail.com/api/v1/inboxes \
  -H "Authorization: Bearer sm_live_…" \
  -H "Content-Type: application/json" \
  -d '{"domain":"inbox.example"}'

Messages

GET /inboxes/{id}/messages returns summaries. Reading one message returns text and sanitized HTML. Remote images stay blocked unless you pass ?images=1.

DELETE the message, or DELETE the inbox, to remove it and its files.

Long-poll

GET /inboxes/{id}/events holds a short server-sent stream and wakes from a Postgres notification when mail arrives. GET /inboxes/{id}/messages/wait?timeout=8 holds until a message arrives or the timer ends. The cap stays short so it fits a serverless limit. Pass after as an ISO timestamp to skip mail you already have.

curl "https://sarabmail.com/api/v1/inboxes/INBOX_ID/messages/wait?timeout=8" \
  -H "Authorization: Bearer sm_live_…"

Webhooks

Plans that include webhooks can PUT /webhook with an https URL. SarabMail posts JSON with event message.received. X-SarabMail-Signature is sha256=HMAC(secret, raw body). The signing secret is returned when you set the URL.

Domains

GET /domains lists the domains your plan can use. Pro and Business add a domain with POST /domains, publish a TXT record sarabmail-verify=…, then call POST /domains/verify. Team and Business request a private subdomain with POST /domains/subdomain and { "label": "acme" }. Mail does not flow until Cloudflare Email Routing or an MX record is in place.

Errors

Errors use { "error": { "code", "message" } }. 401 means the key is missing or revoked, 403 means the plan does not allow it, 409 means the address is taken, and 429 includes Retry-After. Authenticated responses also send X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset.