Skip to main content

API Documentation

The public read API needs no token. For paid domains or your own domain, use the paid API page inside your account.

https://tempmail.tw

JSON. Errors return {"error":"…"}

2000 requests/minute per IP

Login and registration endpoints are stricter: 10 requests/minute per IP.

Inbox

List mail, paginate, and check for new arrivals.

/api/inbox/demo%40example.com?limit=50&offset=0
GET/api/inbox/{email}?limit=50&offset=0

List messages

Returns message summaries, shaped for rendering a list.

GET/api/inbox/{email}/head

Check for new mail

A light endpoint that only returns the newest message id — poll this instead of the whole inbox.

curl 'https://tempmail.tw/api/inbox/demo%40example.com?limit=50&offset=0'

Realtime

Live

Instead of polling you can open an SSE stream and get an event the moment mail lands.

GET/api/inbox/{email}/stream

Live mail stream (SSE)

Keeps the connection open and pushes one JSON event whenever the inbox receives mail.

Each event looks like data: {"id":"…","ts":1700000000}. Reconnect yourself if the stream drops.

curl -N 'https://tempmail.tw/api/inbox/demo@example.com/stream'

Messages

Read content, mark read, annotate and delete mail.

GET/api/message/{id}?mark_read=false

Read one message

Returns text/html bodies, attachment metadata and parsed headers. The message is marked read unless you pass mark_read=false.

POST/api/message/{id}/read

Mark read / unread

Send isRead=true to mark as read, false to move it back to unread.

{ "isRead": true }
PATCH/api/message/{id}/note

Update the note

Notes are capped at 2000 characters and come back in both the message and the inbox summary.

{ "note": "facebook login code" }
DELETE/api/message/{id}

Delete a message

Permanently deletes one message by id.

DELETE/api/inbox/{email}/message/{id}

Delete inside one inbox

Same as above, but verifies the message belongs to that inbox first.

curl -X PATCH 'https://tempmail.tw/api/message/{id}/note' \
  -H 'Content-Type: application/json' \
  -d '{"note":"facebook login code"}'

The old GET endpoints are deprecated

These four operations used to be callable over GET (/message/{id}/delete, /message/{id}/read, /message/{id}/note, /inbox/{email}/message/{id}/delete). A GET must not change state — a prefetcher, a crawler or an <img> tag can fire one. They still work for now but will be removed; move to DELETE / POST / PATCH.

Domains

The public endpoint only returns free domains.

GET/api/domains

List free domains

Domains anyone can use, no sign-in required.

GET/api/account/domains

Domains for your account

Returns plan system domains plus verified custom domains. Requires an API token.

curl 'https://tempmail.tw/api/domains'

Errors

Every error is JSON with a single error field.

400Invalid parameter
401Missing or invalid token
403No access to this inbox
404Message not found
429Rate limit exceeded