> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # Retries and errors Canonical URL: https://posthog.com/docs/workflows/transactional/retries-and-errors ## On this page - [Idempotency keys](#idempotency-keys) - [What to retry](#what-to-retry) - [Rate limits](#rate-limits) Networks fail. Send an idempotency key with every email, and a retry never sends it twice. To learn how PostHog queues, retries, and delivers each send, see [how PostHog delivers messages reliably](https://posthog.com/docs/workflows/concepts/reliable-delivery.md). ## Idempotency keys Build the key from the record that caused the email, and send the same key on every retry. A random value or a timestamp makes each retry look like a new email. | Email | Key | | --- | --- | | Password reset | `password-reset-{reset_request_id}` | | Sign-in code | `sign-in-code-{code_id}` | | Team invite | `invite-{invite_id}` | | Receipt | `receipt-{order_id}` | Send it as the `Idempotency-Key` header, or `idempotencyKey` in the SDKs. A key is 1 to 255 visible ASCII characters, is kept for 7 days, and is separate for each project. - **Same key, same request:** nothing new sends. You get the first send's message ID, with `"replayed": true`. - **Same key, different request:** `422 idempotency_key_reused`. Use a new key for a new email. - **First request still running:** `409 idempotency_key_in_flight`. Wait a few seconds and retry. - **Refused request:** the key stays unused, so you can send it again later. - **Lost response:** [look up the email by its key](https://posthog.com/docs/workflows/transactional/status.md#find-an-email-by-its-idempotency-key) to see if PostHog queued it, or send it again with the same key. ## What to retry The SDKs retry the codes marked **Yes** for you, up to two times, with the same idempotency key. Use `code` in your own error handling. The `detail` text can change. | Status | `code` | Retry? | What to do | | --- | --- | --- | --- | | `409` | `idempotency_key_in_flight` | Yes | Retry with the same key after a few seconds. | | `429` | `throttled` | Yes | Wait for the time in the `Retry-After` header. | | `503` | `delivery_unavailable` | Yes | Retry with backoff and the same key. PostHog might have queued the email. Don't resend through another email provider, or the recipient can get two copies. | | | `network_error` (SDKs) | Yes | Same as a `503`. | | `400` | A field code, such as `required` or `invalid` | No | Fix the field that `attr` names. | | `400` | `invalid_idempotency_key` | No | Send 1 to 255 visible ASCII characters. | | `400` | `sandbox_fields_unsupported` | No | Your project has no verified domain, so the [test sender](https://posthog.com/docs/workflows/email/test-sender.md) can't send `cc`, `bcc`, `attachments`, reply headers, or a marketing `category`. Remove them, or [verify a domain](https://posthog.com/docs/workflows/domain.md). | | `400` | `template_not_transactional` | No | [Make it transactional](https://posthog.com/docs/workflows/transactional/templates.md#use-an-existing-template). | | `400` | `template_not_sendable` | No | Add a subject and body, and publish. | | `400` | `marketing_template` | No | Remove its marketing category. | | `400` | `transactional_email_paused` | No | The email's workflow is turned off. Turn it back on. | | `401` | `authentication_failed` or `not_authenticated` | No | Send a valid project secret API key. | | `403` | `permission_denied` | No | Use a key from this project with the `transactional_email:write` scope. | | `404` | `not_found` | No | Check the template ID and project. | | `422` | `idempotency_key_reused` | No | Use a new key. | | `422` | `recipient_suppressed` | No | The address hard bounced, or was suppressed through the API with reason `bounce`. See the [suppression list](https://posthog.com/docs/workflows/email/suppression.md). | | `422` | `recipient_unreachable` | No | The address or its domain can't receive email. Check for a typo. | | `422` | `sending_paused` | No | Too many bounces or complaints on this email. Check the **Reputation** tab. | | `422` | `sending_suspended` | No | Sending is suspended for your project. Check the **Reputation** tab. | | `422` | `sandbox_recipient_not_member` | No | Your project has no verified domain, so the [test sender](https://posthog.com/docs/workflows/email/test-sender.md) only sends to members of your organization. [Verify a domain](https://posthog.com/docs/workflows/domain.md). | | `429` | `quota_limited` | No | Your project is over its email quota. Check [billing limits](https://posthog.com/docs/billing/limits-alerts.md). | The SDKs also check some fields before they call PostHog, and return an `invalid_*` code, such as `invalid_recipient`, when one is wrong. [Send emails from code](https://posthog.com/docs/workflows/transactional/send-from-code.md#checks) and [attachments](https://posthog.com/docs/workflows/transactional/attachments.md#errors) have their own checks. ## Rate limits A project can send 600 emails a minute and 20,000 an hour, and all its keys share these limits. The limits rise with the project's [sending tier](https://posthog.com/docs/workflows/reference/limits.md#sending-tiers), to about 1% of its daily allowance a minute and 10% an hour at the top tiers. [Status lookups](https://posthog.com/docs/workflows/transactional/status.md) have their own limits, so they don't use up the limits for sends. See [API and SDK limits](https://posthog.com/docs/workflows/reference/limits.md#api-and-sdk-limits) for every limit on a send.