Idempotency and Safe Retries
The Ideogram API doesn’t accept an idempotency key. Every request you send starts a new generation, and each one is billed. Sending the same request twice, for example after a timeout, creates two generations and two charges.
Retry without paying twice
- Send long or important jobs asynchronously. Set
asyncor supply awebhook_url. The request returns ageneration_idas soon as it is accepted. - Record the
generation_idbefore you wait. Store it with your own job record as soon as the request returns. - Poll before you resubmit. If you lose track of a job, poll
GET /v2/generations/{generation_id}. Resubmit only when itsstatusisfailed. - Retry only what didn’t run. A
429or a402means the request was rejected before it ran, so retrying it can’t double-charge; a402keeps failing until you add credits. A timeout on a synchronous request doesn’t stop the work; see Errors and billing.
If a submission fails before you receive a generation_id, you can’t tell from that request whether it started. Asynchronous requests return as soon as they are accepted, which keeps that window short.
Idempotent webhook handlers
Webhook deliveries can repeat. Make your handler process each generation_id once and return 2xx for repeats; see Webhooks. That makes your handler idempotent. It doesn’t make request submission idempotent.