The Task Lifecycle
1
Submit a Request
Send your data (text, audio, video) to a creation endpoint. The API immediately returns a
task_id.2
Poll for Status
Use the
task_id to check progress. The task moves through states: PENDING → SUCCESS (or ERROR).3
Get the Result
Once the status is
SUCCESS, you receive a run_id. Use this to download your result.Task vs Run
A task represents your request being processed. Once complete, the result becomes a run that you can download or reference.
Task Status Types
Example: Complete Workflow
Here’s a complete example showing the task pattern for text-to-speech:Polling Best Practices
Use appropriate intervals
Use appropriate intervals
Start with 2-5 second intervals. Shorter tasks (TTS) complete faster than longer ones (dubbing).
Implement exponential backoff
Implement exponential backoff
For longer tasks, increase the polling interval over time to reduce API calls.
Set a maximum timeout
Set a maximum timeout
Don’t poll forever. Set a maximum wait time and handle timeouts gracefully.
Handle all status types
Handle all status types
Always handle
ERROR, TIMEOUT, and PAYMENT_REQUIRED statuses in your code.Bulk Operations
For processing multiple items, use the bulk fetch endpoints:APIs Using This Pattern
Most CAMB.AI APIs follow the task pattern:Streaming Alternative
For real-time applications, some APIs offer streaming endpoints that return data immediately without the task pattern:POST /tts-stream- Streaming text-to-speechPOST /translation/stream- Deprecated streaming translation. UsePOST /translationfor new integrations.
Next Steps
SDK Guide
SDKs handle polling automatically
API Reference
Explore all endpoints