Task lifecycle
An asynchronous task has one of three schema-defined statuses:1. Submit the generation request
Send the same body accepted by synchronous generation toPOST /presentation/generate/async:
id before returning control to your caller. Your application needs it to resume monitoring after a restart or failed handoff.
2. Check the task status
RequestGET /async-task/status/{id} with the same API key:
data contains the generated presentation information:
3. Poll with a deadline
This Python example uses a capped delay and a total timeout. The API key is read from the environment instead of being placed in source code.Make polling reliable
- Use one poller per task. Multiple workers polling the same task waste capacity and complicate handoffs.
- Persist the task identifier, latest status, and timestamps in your application database.
- Apply a total deadline even when individual HTTP requests have their own timeouts.
- Add small random jitter so many tasks do not poll at exactly the same moment.
- Stop immediately on
completedorerror; these are terminal states. - Preserve sanitized failure data for diagnostics, but never log the API key.
- Decide what your product should do when its own timeout expires: continue in a background worker, notify the user, or allow a manual status refresh.
Polling or webhooks?
Polling is simple and works without a public callback endpoint. Webhooks reduce repeated status requests and work well when your application already exposes a secure HTTPS receiver. To receive generation events, subscribe to a webhook and settrigger_webhook to true in the generation request. See Receive generation webhooks.
A successfully accepted task can still finish with
error. Do not treat the initial 200 response as proof that the presentation will complete.Synchronous generation
Review the request controls and the completed presentation response.