Webhooks
Most generation endpoints support per-request callbacks with receive_url. Use this when you want task results pushed to your backend instead of polling.
How It Works
- Submit a task request and include
receive_urlin the body. - The API returns a
task_idimmediately. - When processing completes, your endpoint receives the final task payload by POST.
Example Request
curl -X POST "https://api.cheapaiapi.com/v1/task/sound-effect" \
-H "Authorization: Bearer sk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"text": "Thunder rolling with heavy rain",
"receive_url": "https://your-app.com/api/task-callback"
}'Typical Callback Payload
{
"id": "task_123",
"status": "done",
"progress": 100,
"type": "sound_effect",
"metadata": {
"output_uri": "https://...",
"audio_url": "https://..."
}
}When to Use Polling Instead
If you do not provide receive_url, poll GET /v1/task/:task_id until the task reaches done or error.