Conventions
The rules that hold across every endpoint, so a client written against one carries over to the rest.
Base URL and formats
https://app.mailclutch.com/api/v1Requests and responses are JSON, except the two that are not: the raw message is message/rfc822 and an attachment is served with its own type. Timestamps are ISO 8601 in UTC (2026-09-02T09:14:22.000000Z). Identifiers are opaque strings: do not parse them, and do not expect them to be sequential.
Pagination
Listings are newest first and paged by cursor. Each page carries the cursor of the next one in meta.next_cursor; pass it back as cursor. When it is null, you have reached the end.
GET /api/v1/sandboxes/{sandbox_id}/emails?limit=50 → { "data": [...], "meta": { "total": 128, "next_cursor": "e9v2h6r4ldq1a7c3" } } GET /api/v1/sandboxes/{sandbox_id}/emails?limit=50&cursor=e9v2h6r4ldq1a7c3 → { "data": [...], "meta": { "total": 128, "next_cursor": null } }
A cursor is the id of the last message you received, and the page after it is everything older. That is what makes it safe on a sandbox that is still receiving: a new message pushes nothing under you. offset is still accepted for scripts already using it, but a mailbox that receives while being paged by offset silently repeats or skips rows — for a job scanning “everything this run produced”, that is a flaky test with no visible cause.
| Parameter | Accepts |
|---|---|
limit | Integer, 1–100, default 50 |
cursor | The meta.next_cursor of the previous page |
offset | Integer ≥ 0. Ignored when cursor is given |
Idempotency
A runner that times out on a create and retries must not end up with two sandboxes. Send an Idempotency-Key header on any POST that creates something — a sandbox, a share link, a webhook — and the first successful response is stored for 24 hours and returned verbatim to every retry with the same key. A replay carries Idempotent-Replayed: true.
POST /api/v1/sandboxes Idempotency-Key: gha-run-9127384-attempt-2 Content-Type: application/json { "name": "pr-482", "ttl": "30m" }
Keys are scoped to the token and to the endpoint. Bodies are compared once decoded, with their keys sorted: key order and whitespace do not matter. The same key with a different body answers 422. A failed create is not stored: the retry is evaluated again.
A stored response is replayed only while what it describes still exists. If the sandbox has expired or been deleted, the share link revoked or the webhook removed, the key is released and the request runs again, whatever its body.
Two requests with the same key in flight at once are serialized. The second waits up to five seconds for the first to complete; if it has not, the second answers 409 with a Retry-After. Retried after that, it receives the stored response.
Use a key per job attempt: the run id, plus the attempt number if the platform retries whole jobs.
Errors
Every error is JSON with a message, whatever the Accept header. Validation errors add an errors object keyed by field, with one or more sentences each.
{ "message": "The name field is required.", "errors": { "name": ["The name field is required."] } }
| Status | Meaning |
|---|---|
| 400 | The request body is not valid JSON, or is not a JSON object. The message names the syntax error |
| 401 | Missing, malformed, revoked or expired token — see Authentication |
| 403 | The token lacks the scope the endpoint requires, or the organization's plan does not include the API (code: "plan_required", with the plan that does) |
| 404 | Unknown identifier, or one the token cannot reach. Both answer the same body |
| 405 | Wrong method on a known path. Allow lists the accepted ones |
| 409 | A request with the same Idempotency-Key is still being processed. Honour Retry-After |
| 422 | Invalid input, a quota refusal, an expect verdict of ok: false, or a wait that ended with matched: false |
| 429 | Rate limited, both wait slots of a sandbox are busy, or the month's requests are spent (code: "quota_exceeded"). Honour Retry-After |
| 500 | Unexpected failure. The body is { "message": "Server Error" }, without detail |
Plans and monthly quota
The API comes with the Indie plan and the ones above it. On a plan without it every request answers 403 with code: "plan_required"; the tokens stay listed and work again the moment the organization upgrades.
Each plan serves a number of requests per calendar month, counted in UTC for the whole organization, whatever the token. One request is one request: a wait that blocks for a minute counts the same as a GET.
| Plan | Requests per month |
|---|---|
| Indie | 1,000 |
| Pro | 10,000 |
| Team | 50,000 |
| Enterprise | Custom |
Every served response carries X-Quota-Limit, X-Quota-Remaining and X-Quota-Reset. Past the budget the API answers 429 with code: "quota_exceeded" and a Retry-After that runs to the first of the next month. The organization's admins are emailed at 80% and at 100%, and the Usage tab of the organization settings shows the month so far.
Rate limits
Requests are throttled per token, at 120 per minute. Poll a listing a few times a second at most; for anything busier, wait blocks until the message is there and a webhook lets Mailclutch call you instead.
The blocking calls have their own bound, because each one holds a server worker for as long as it waits: at most two concurrent waits per sandbox, and a timeout of at most 120 seconds. A third wait on the same sandbox answers 429 with a Retry-After. These do not count against the per-minute limit.