Webhook Callbacks
Instead of polling the status endpoint, you can provide a callback URL when submitting tasks to receive automatic notifications when generation completes.How It Works
- Submit with callback URL: Include a
callback_urlin your task submission - Receive notification: When the task completes (success or failure), PoYo AI sends a POST request to your URL
- Process result: Your server receives the complete task data including generated files
Callback Request
When a task completes, PoYo AI sends a POST request to your callback URL. The callback body uses the same task data shape as the status endpoint, without the outercode and data wrapper.
Request Headers
Request Body
Failed Task Callback
Signature Verification
PoYo signs every webhook request with HMAC-SHA256. Existing receivers can ignore these headers, but production systems should verify them. Get your webhook HMAC key:task_idis the top-leveltask_idin the callback bodytimestampis the value ofX-Webhook-Timestampwebhook_hmac_keyis returned byGET /api/api-keys/webhook-secret
Python Verification
Node.js Verification
Requirements
Your callback endpoint must meet the following requirements:- HTTPS only: Must use HTTPS protocol (HTTP not supported)
- Maximum URL length: 2048 characters
- Response timeout: Must respond within 30 seconds
- Success response: Should return HTTP 200-299 status code
- No internal IPs: Cannot use private/internal IP addresses (e.g., 192.168.x.x, 10.x.x.x)
- Public accessibility: Must be publicly accessible from the internet
Retry Policy
If your callback endpoint fails to respond or returns an error:- Retry attempts: Up to 5 automatic retries
- Retry delays: Exponential backoff, starting at about 60 seconds and capped at 10 minutes
- Final failure: After all retry attempts fail, no further retries are made
Example Implementation
Python (Flask)
Node.js (Express)
Go
Security Best Practices
Testing
Using ngrok for Local Testing
During development, you can use ngrok to expose your local server:Webhook vs Polling
For production systems handling high volumes, webhooks are recommended to reduce API calls and get instant notifications.
Next Steps
Task Status
Learn about polling task status
Image Generation
Generate images with GPT-4o
Video Generation
Create videos with Sora 2
Quick Start
Back to Quick Start guide
