emitd

Idempotency

Safely retrying requests in emitd

Network requests can fail for many reasons. If a request times out, you might not know whether emitd received the request and sent the email, or if it failed before reaching us.

To safely retry a request without risking sending the same email twice, use an Idempotency Key.

How it works

POST /v1/email and POST /v1/email/batch accept an Idempotency-Key header.

Authorization: Bearer esk_live_...
Idempotency-Key: req_123456789

When you send a request with an Idempotency Key:

  1. If we have never seen the key, we process the request normally and save the response.
  2. If we have seen the key before, we do not send the email again or bill you a second time. Instead, we return the exact same HTTP response we returned the first time.

When returning a cached response for single sends, the API will also mark the JSON body with "idempotent_replay": true.

Key Scope & Expiration

Idempotency keys are scoped to your tenant. They do not expire on their own. We recommend generating a unique UUID or a hash of the payload for every unique email you attempt to send.

On this page