Skip to main content
Use the Batch Generate API to submit 1 to 50 asynchronous tasks for the same public model. Each item uses the model’s normal input fields. Use Batch Status to retrieve the whole batch, or Batch Webhooks to receive terminal notifications for every accepted item.

Before you start

  • Create an API key and verify that the target model works with the single-task API.
  • Create one stable Idempotency-Key for the business operation represented by the whole batch.
  • Create a stable, unique client_item_id and idempotency_key for every item.
  • If you plan to receive callbacks, first set up Batch Webhooks.

Endpoint

Replace {model} with a public model ID, such as seedream-4-5.

Headers

string
required
API authentication. Format: Bearer YOUR_API_KEY.
string
required
Unique idempotency key for the entire batch operation. Reuse the same value when retrying after a timeout or network error.
string
required
Must be application/json.

Request body

array
required
The task list. It must contain 1 to 50 items.
string
Optional public HTTPS endpoint for terminal item notifications. When configured, every accepted item receives one webhook after it succeeds or fails.
Batch generation does not use callback_url. It is ignored wherever it appears in the batch request, including the root body, an item, or nested input. Use only the root-level webhook_url for batch notifications.

Successful submission

Successful submission response fields

Save batchId for batch-level lookup, taskId for individual task lookup, and clientItemId for your business association.

Item rejection in an otherwise valid batch

The request itself can return successfully while an individual item is not accepted. For example, an item with invalid model input is marked rejected:
Continue only with accepted: true items. Correct rejected input, then submit the corrected work as a new business operation with new batch and item idempotency keys.

Whole-request failure

The entire request fails and no executable batch is created when, for example:
  • Idempotency-Key is missing.
  • items is empty or contains more than 50 items.
  • client_item_id or idempotency_key is duplicated within one batch.
  • The JSON body exceeds 5 MiB.
  • webhook_url is not a public HTTPS address.

Idempotent retry

If a timeout or network interruption prevents you from knowing whether the response arrived:
  1. Retry the whole request with the same Idempotency-Key.
  2. Keep the same idempotency_key for every original item.
  3. APIXO replays the existing batch. replayed: true indicates a safe batch replay.
An idempotency key represents one business operation. Do not change it merely because an HTTP request timed out, or a new batch or task may be created.

Next steps

  • Read Batch Status to query the whole batch. Use the Single Tasks > Status Task page to query one taskId.
  • Read Batch Webhooks to receive a terminal notification for each item.