Tasks & Polling
Aibubu async generation endpoints return task IDs. Poll them until terminal state.
/v1/tasks/{task_id}Image and video generation are asynchronous.
Tasks and their generated assets are permanently scoped to the API key's workspace; request headers cannot move them to another workspace.
Lifecycle
| Status | Terminal | Meaning |
|---|---|---|
queued | No | Accepted and waiting to run |
running | No | Generating |
succeeded | Yes | Done; read result |
failed | Yes | Failed; read error |
canceled | Yes | Canceled through the cancel endpoint |
expired | Yes | Exceeded the maximum run time and was closed as failed |
failed, canceled, and expired tasks are not charged, and the reserved credits are released.
Polling endpoint
curl https://aibubu.ai/v1/tasks/task_image_xxx \
-H "Authorization: Bearer sk_aibubu_your_key"Suggested polling cadence
- First 30 seconds: every 2 to 3 seconds
- Long-running video jobs: every 5 to 10 seconds
- Stop polling on any terminal status (
succeeded,failed,canceled,expired)
Response handling
When the task succeeds, keep the terminal response as source of truth for:
statusresult.data[].url- optional
result.data[].thumbnail_urlfor video estimated_credits: credits reserved at submissioncredits_charged: credits actually charged once billing settles; omitted before settlement
Usage-priced models (for example per-token video models) settle on actual usage, so credits_charged can differ slightly from estimated_credits. Reconcile with credits_charged.
result.data[].url is a signed link valid for about 15 minutes after each fetch. Call GET /v1/tasks/{task_id} again for a fresh link, and download outputs you need to keep.
Provider payloads and internal usage details are not exposed.
Listing tasks
curl "https://aibubu.ai/v1/tasks?status=succeeded&limit=20" \
-H "Authorization: Bearer $AIBUBU_API_KEY"Returns tasks created by the calling API key, newest first: { "object": "list", "data": [...], "has_more": true, "next_cursor": "..." }.
status: optional status filterlimit: 1 to 100, default 20cursor: thenext_cursorfrom the previous page
List entries omit result; call GET /v1/tasks/{task_id} when you need output links. Use the list to reconcile or recover after losing task IDs or missing webhooks.
Webhook is a notification channel. Polling remains the canonical fallback.
Cancel an unsubmitted task
curl -X POST https://aibubu.ai/v1/tasks/task_example/cancel \
-H "Authorization: Bearer $AIBUBU_API_KEY"Requires v1:generate, the original API Key and the same workspace. Only deferred tasks that have not been claimed by a worker or submitted to a supplier can be canceled; success releases the authorization. Repeating a successful cancellation returns the canceled task. A queued supplier job may already be running: submitted or claimed tasks return HTTP 409 task_not_cancelable and retain their reservation. Other keys or workspaces receive 404.

