Webhooks
Receive signed task, balance, and credit-pack events through workspace webhooks or a per-request callback_url, without giving up polling.
/v1/generationsThere are two ways to receive events, and both belong to a workspace, not to an API key:
- Workspace webhooks: subscribe one or more endpoints to event types; every matching event in the workspace is delivered.
- Per-request
callback_url: a single task's terminal event is delivered to the URL passed with that request.
Personal workspaces (Owner) and team workspaces (Owner or Admin) can configure both in the platform console at /console/webhooks, and workspaces never see each other's configuration. Webhook delivery and polling can coexist; polling remains the recovery path if a receiver is unavailable.
Delivery model
- Task events:
task.succeeded,task.failed, andtask.canceled - Billing events:
balance.lowandcredits.granted runningprogress is not pushed in v1- Each payload is
{ id, type, created_at, api_version, data }. A task event'sidis stable (evt_task_<task_id>_<event>) and is the same for the workspace webhook delivery and thecallback_urldelivery of that event.
Signing
Workspace webhooks and callback_url callbacks share the same signature and headers:
| Header | Meaning |
|---|---|
Aibubu-Signature | t=<unix>,v1=<hex>; carries several v1= values for 24 hours after a secret rotation |
X-Aibubu-Timestamp | Same value as t in the signature |
X-Aibubu-Event, Aibubu-Event | Event type; both spellings carry the same value |
X-Aibubu-Delivery-ID, Aibubu-Delivery-ID | Unique delivery ID; both spellings carry the same value |
Compute HMAC-SHA256(secret, "{timestamp}.{raw_body}") as hex and accept the delivery if any v1 matches. Read the raw body, validate timestamp freshness (300 seconds is a good tolerance), deduplicate by id or delivery ID, and return 2xx before doing slow work.
Which secret signs a delivery:
| Delivery | Secret |
|---|---|
| Workspace webhook endpoint | That endpoint's whsec_ secret, shown once when the endpoint is created |
callback_url | The workspace callback_url signing secret, set on /console/webhooks |
Rotating a secret
After you rotate an endpoint secret or the callback_url signing secret in the console, the previous secret stays valid for 24 hours, and every delivery in that window is signed with both the new and the previous secret. Switch your receiver to the new secret within 24 hours; during the switch you can also check both secrets.
The official SDKs implement these rules: Python aibubu_sdk.webhooks.construct_event(...) and TypeScript constructEvent(...) from aibubu-sdk.
Workspace webhooks
Manage endpoints on /console/webhooks. When you create one, the console generates a secret starting with whsec_ and shows it only once, so save it right away.
When deliveries keep failing, the console shows the failure count and lists each delivery's status and last error under "Recent deliveries". Disabling an endpoint, manually or after 20 consecutive failures, also abandons its deliveries that have not been sent yet; re-enable it after fixing the receiver.
Per-request callback callback_url
POST /v1/images/generations, POST /v1/videos/generations, and POST /v1/generations accept an optional top-level callback_url that sets a callback endpoint for a single task:
{
"model": "gpt-image-2",
"prompt": "A cinematic fashion poster",
"callback_url": "https://example.com/aibubu/callback"
}- Must be a publicly reachable
httpsURL, at most 2048 characters. - When the task reaches a terminal state (succeeded, failed, or canceled), the matching
task.succeeded,task.failed, ortask.canceledevent isPOSTed to that URL. Workspace webhooks subscribed to the event still receive it as well. - Deliveries are signed with the workspace callback_url signing secret, using the same headers and verification as Signing above; the retry rules below apply.
- Set the callback_url signing secret on
/console/webhooksbefore passingcallback_url.
| HTTP | code | Cause |
|---|---|---|
400 | invalid_callback_url | Not https, not a public address, or a malformed URL |
400 | callback_secret_required | The workspace has no callback_url signing secret |
Retries
- timeout: 5 seconds; redirects are not followed
- max attempts: 8
- backoff:
min(2^n * 10s, 6h)with ±20% jitter - only 429, 5xx, and network errors (timeouts, failed connections) are retried; other responses end the delivery
- 20 consecutive failures disable a workspace endpoint;
callback_urlfailures never disable anything

