GET /api/generations/:id repeatedly, you receive a single POST request when the generation is done.
Polling vs. webhooks
How to use webhooks
Add awebhook URL to your /api/run request:
Webhook payload
When a generation completes successfully, we send aPOST request to your URL with these headers and body:
Headers
Body
Example handlers
Retries
If your endpoint does not return a200 status, we retry with exponential backoff:
After 9 failed retries, the webhook is marked as failed.
Best practices
Return a 200 quickly. Your endpoint should respond within 5 seconds. Process the webhook data asynchronously if needed.
- Handle duplicates — Retries may deliver the same webhook twice. Use the
idfield to deduplicate. - Validate the payload — Check that the data matches expected formats before processing.
- Log everything — Keep logs of received webhooks for debugging.
Requirements
Your webhook endpoint must:- Be publicly accessible (no localhost or private IPs)
- Use HTTPS
- Accept POST requests with a JSON body
- Return 200 to acknowledge receipt