Webhooks
Add a webhook_url to a request and Ideogram sends the finished result to that URL. Any v2 endpoint that has a webhook_url field runs asynchronously when you supply it: the request returns a generation_id straight away, and Ideogram sends a JSON POST to your URL once every output for the request has finished. Each delivery is signed with Ed25519 so you can confirm it came from Ideogram before acting on it.
The response carries the identifier to record, and no data:
What Ideogram delivers
The request body contains:
generation_id: URL-safe base64 ID of the generation. Use it to match the delivery to your original request, and to poll the generation.created: the time the generation was created.data: an array of results. Each item has anobject_typethat tells you its fields.usage_cost_usd_micros: the cost of the request in millionths of a US dollar, when the request uses variable usage-based pricing.
An image generation delivers image.generation items:
Other endpoints deliver other item types. Each one is a separate shape, so read object_type before reading the other fields:
When an image doesn’t pass the safety check, its is_image_safe is false and its url is an empty string.
For video results, poll GET /v2/generations/{generation_id} when the delivery arrives and read the video fields from that response.
Ideogram sends a webhook only when a generation completes. A generation that fails sends nothing. Poll GET /v2/generations/{generation_id} to read its status and failure_reason.
Request headers
Every delivery includes these headers:
Verifying the signature
-
Fetch the public keys. Send a
GETtohttps://api.ideogram.ai/v1/.well-known/jwks.json. The same keys sign deliveries for v1 and v2 requests. The response lists Ed25519 public keys in JWK form. Each key’sxfield is the 32-byte public key, base64url-encoded with no padding. The key set is cacheable; refresh it if a signature ever fails to verify against your cached copy, in case the keys rotated. -
Rebuild the signed message. Concatenate these four values in this exact order, joined with single newline (
\n) separators, then encode the result as UTF-8:Hash the raw body bytes exactly as received. Do not parse and re-serialize the JSON first, or the hash will not match what Ideogram signed.
-
Verify against the published keys. Decode
X-Ideogram-Webhook-Signaturefrom hex and check it against each public key in the set. If any key verifies, the webhook is authentic. If none do, reject the request. TheX-Ideogram-Webhook-Key-Idheader tells you which key to try first, but fall back to the others so signatures stay verifiable across key rotations.
Python example
Each delivery attempt is signed again with a new X-Ideogram-Webhook-Timestamp, so a five-minute window rejects replayed requests without rejecting Ideogram’s retries.
The body passed to verify_webhook must be the raw request bytes exactly as
Ideogram sent them. Read them from your web framework’s raw-body accessor, not
from a parsed-then-re-serialized JSON object: re-serializing can reorder keys or
change whitespace, which changes the bytes and makes the SHA-256 hash (and so the
signature check) fail. Examples of the raw-body accessor:
- Flask:
request.get_data() - FastAPI / Starlette:
await request.body() - Django:
request.body - Express (Node):
express.raw()middleware, thenreq.body(aBuffer)
A complete Flask handler:
The example caches the public keys for up to 24 hours and refreshes them once when a signature fails to verify, in case the keys rotated.
Retries, idempotency, and polling
Return a 2xx status within 10 seconds to acknowledge a delivery. Ideogram retries
when your endpoint times out, can’t be reached, or returns 429 or a 5xx status.
It doesn’t follow redirects and doesn’t retry a 3xx or any other 4xx status.
Design your handler for this:
- Make it idempotent. The same
generation_idcan arrive more than once (for example, a retry after your endpoint was briefly slow or unavailable). Key your completion state ongeneration_id, treat an already-processedgeneration_idas a no-op, and return2xxso the retries stop. - Delivery is not guaranteed. Ideogram retries a delivery only a limited number of times before dropping it, so a webhook may never arrive (for example, if your endpoint is down for an extended period). Do not rely on the webhook as your only way to get a result.
- Fall back to polling. If you do not receive a delivery, poll
GET /v2/generations/{generation_id}with thegeneration_idthe request returned. Itsstatusispending,completedorfailed; a completed generation returns the samedata. For a v1 request, pollGET /v1/generations/{generation_id}instead.
A handler that is idempotent is different from a request that is. The API takes no idempotency key, and sending the same request twice starts two generations. See Idempotency and safe retries.