idempotency_expired

HTTP 409 Don’t retry REST and MCP

The Idempotency-Key and the payload both match a previous request, but the window in which the stored response can be replayed has passed.

How to fix it

  1. Look up what the original request produced instead of replaying it. A direct send is a message in the inbox's message listing. A send that was held for approval is an approval you can read with GET /projects/{project_id}/approvals/{approval_id}; it may have been rejected, or expired after 7 days, and then nothing was sent.
  2. Do not reuse a key after 30 days to mean the same logical send. Mint a new one, and expect a genuinely new message.
  3. Do not treat this as a failed send. A direct send was not rolled back; only the cached response is gone. A held send went out only if a person approved it.
  4. Shorten the retry horizon in your client. A queue that can hold an item for a month is a queue that will produce this error.

Which rule fired

An idempotency record carries two timestamps. replay_until is set 30 days out and is how long the stored response snapshot can be returned again. tombstone_until is set 365 days out and is how long the key stays claimed so it cannot be reused for something else. Between those two dates the key is known, the payload matches, and the response is gone, which is this error. It is not a duplicate-send error: the original request was carried out and its record still exists, you simply cannot retrieve the answer through this route any more. What it produced depends on the branch: a direct send produced a message, and a send held for approval produced an approval, which a person may have approved or rejected, or which expired.

In error.messageMeans
The idempotency replay period has ended. On a send held for approval, the matched idempotency record's replay_until is at or before the current time.
This idempotency key can no longer be replayed. The same expiry check on a direct send, or on a repeated approve that reuses its Idempotency-Key.

Why it works this way: The two windows are separate on purpose. Keeping the key claimed for 365 days from the first request, long after its response snapshot expires, is what stops a key from silently becoming reusable for a different message once the cache falls away.

Example

POST /v1/projects/{project_id}/inboxes/{inbox_id}/messages → 409
{
  "error": {
    "code": "idempotency_expired",
    "message": "This idempotency key can no longer be replayed.",
    "request_id": "req_8Kd2x91",
    "retryable": false,
    "details": {}
  }
}

Over MCP, send_message and create_draft return it as text in a result marked isError: true, not as this body.

Where it appears

  • POST /projects/{project_id}/inboxes/{inbox_id}/messages
  • POST /projects/{project_id}/approvals/{approval_id}/approve

Paths are relative to https://api.emailforagents.ai/v1.

View as Markdown

Search docs