Batch execution is asynchronous and often fan-out heavy. This recipe shows the smallest production-safe loop for creating one batch, tracking it, and reconciling webhook delivery with your own status checks.Documentation Index
Fetch the complete documentation index at: https://docs.ai-stats.phaseo.app/llms.txt
Use this file to discover all available pages before exploring further.
1. Upload the input file
file_id. The same file id becomes the batch input handle.
2. Create the batch
batch_id immediately.
3. Poll status for control-plane recovery
Always keep your own polling path even when webhooks are enabled:lifecycle_statusfor a stable cross-job statuspolling_urlas the canonical status endpointcancel_urlwhen the batch is still cancellable
4. Cancel stale work when needed
If the batch is still pending or processing and your application no longer wants the result:5. Consume webhook deliveries
Gateway-managed async webhook payloads are normalized around:- the job id and job kind
lifecycle_status- sanitized webhook configuration
- delivery summary fields
- recent delivery attempts
- whether signing is enabled
- verify the signature
- process deliveries idempotently
- treat retries as normal
- fetch the latest batch status when the payload and local state disagree
6. Fetch outputs and reconcile failures
Use the terminal batch object to decide the next step:- completed batches should move on to output retrieval and result ingestion
- failed batches should capture both the batch failure state and the webhook delivery state
- cancelled batches should stop downstream fan-out cleanly
- upstream batch execution failures
- cancellation requested by operators or automation
- webhook delivery failures after the batch itself already finished
7. What to monitor
- batch
lifecycle_status - provider and request correlation ids
- webhook delivery success and retry counts
- last delivery HTTP status
- last failure timestamp and message
- whether
cancel_urlwas still available when cancellation was requested