Skip to main content
Instead of polling for job status, provide a callback_url when starting a generation to receive a webhook notification when the job completes or fails.

Using Webhooks

Include the callback_url parameter in your generation request:

Webhook Payload

When the job completes or fails, a POST request will be sent to your callback_url. Success:
Failure:

Retry Behavior

SwitchX callbacks have up to five attempts. Retryable failures use approximately 1, 2, 5, and 10 minute delays before subsequent attempts, with jitter. Permanent failures stop without using the remaining attempts. You can check delivery status via the Get Generation Status endpoint:
The webhook field is only present when a callback_url was provided. Possible statuses: pending, delivered, failed.
Your webhook endpoint should return a 2xx status code within 10 seconds to acknowledge receipt. Process the payload asynchronously if your handler needs more time.