Skip to navigation

Create Style Agent Batch

Create a style-agent batch of up to 20 documents and start checking them.

Returns 202 with a batch_id to poll at GET /style-agent/batch/{id}. Append more documents (up to 1000 total) while the batch is still processing via POST /style-agent/batch/{id}/items. Send an Idempotency-Key header to make retries safe: the same key + payload replays the original 202 instead of creating a second batch.

Polling that report is the authoritative way to learn a batch finished. An optional webhook_url is a bounded best-effort notification on top of it — it can fire zero times or more than once, so receivers must deduplicate on batch_id.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Headers

Idempotency-Keystring or nullOptional1-255 characters

Optional client-generated key making this submission idempotent: a retry with the same key and payload returns the original accepted response instead of submitting the documents again. Reusing a key with a different payload returns 409.

Request

This endpoint expects an object.
itemslist of objectsRequired
defaultsobject or nullOptional

Optional per-batch defaults applied to any item that omits the field.

webhook_urlstring or nullOptionalformat: "uri"1-2083 characters

Notified when the batch reaches a terminal state (D5). Delivery is bounded best-effort, not guaranteed: a failed POST is retried with backoff for roughly two hours and then abandoned, so this endpoint may be called zero times or more than once. GET /style-agent/batch/{batch_id} is authoritative — poll it if the notification has not arrived. Deduplicate on the payload's batch_id: a batch has exactly one completion event, so batch_id is its stable event id.

Response

Batch accepted
batch_idstring
segment_workflow_idstring
statusenum

Lifecycle of a style-agent batch (see design-docs/style-agent-batch-checking.md).

A batch is running while any item is non-terminal; it becomes completed (and sealed) once every item reaches a terminal state.

Allowed values:
item_countinteger
created_atdatetime
itemslist of objects

Errors

401
Unauthorized Error
403
Forbidden Error
409
Conflict Error
413
Content Too Large Error
422
Unprocessable Entity Error
500
Internal Server Error