Use idempotency keys to ensure that emails are sent only once.
POST /emails
and the POST /emails/batch
endpoints on the Resend API.<event-type>/<entity-id>
, for example welcome-user/123456789
. The specific format you use is up to you.POST /emails
endpoint examplePOST /emails/batch
endpoint example<event-type>/<entity-id>
). For batch sends, choose a key that represents the whole batch, like a team, workspace, or project (i.e., team-quota/123456789
).400
: invalid_idempotency_key
- the idempotency key has to be between 1-256 characters. You can retry with a valid key or without supplying an idempotency key.409
: invalid_idempotent_request
- this idempotency key has already been used on a request that had a different payload. Retrying this request is useless without changing the idempotency key or payload.409
: concurrent_idempotent_requests
- another request with the same idempotency key is currently in progress. As it isn’t finished yet, Resend can’t return its original response, but it is safe to retry this request later if needed.