1. Create the job
video_id immediately.
2. Poll status until terminal
Your worker or application can poll:id. native_video_id, when present, is provider-native correlation metadata; do not use it for AI Stats polling, websocket, cancellation, or content URLs.
3. Consume webhook deliveries
The current async webhook payloads are normalized around:- the job identifier
- lifecycle status
- delivery status summary
- recent delivery attempts
- whether signing is enabled
- verify the signature
- treat deliveries as retryable and idempotent
- fetch the latest job status if the webhook payload and local state disagree
webhook.secret, AI Stats signs each delivery with:
x-ai-stats-timestamp: Unix timestamp in secondsx-ai-stats-signature: hex HMAC-SHA256 of${timestamp}.${rawBody}using your webhook secretx-ai-stats-event-id: stable event id for this job/eventx-ai-stats-event-type: event type such asvideo.completedx-ai-stats-delivery-key: idempotency key, including progress bucket when applicablex-ai-stats-attemptandx-ai-stats-max-attempts: retry attempt metadata
x-ai-stats-delivery-key or the payload id before side effects. Return any 2xx status only after your durable state has been updated; non-2xx responses are retried with the same event id and an incremented attempt number.
Webhook subscriptions accept generic job.* events or matching video.* events. If you omit events, AI Stats subscribes the webhook to terminal job.completed, job.failed, job.cancelled, and job.expired notifications. If you provide events, at least one event must be valid for video jobs; all-invalid or cross-kind-only lists such as ["batch.completed"] are rejected instead of being broadened silently.
Webhook callback URLs must use HTTPS. Literal private, loopback, link-local, and wildcard hosts are rejected; http://localhost, http://127.0.0.1, and http://[::1] are accepted only for local development callbacks.
4. Read the final output
When the job reaches a completed terminal state, fetch content from:5. What to monitor
- job lifecycle status
- webhook delivery success and retry counts
- last delivery HTTP status
- failure timestamps and error messages