---
title: "Create Style Agent Batch"
method: POST
path: "/style-agent/batch"
tags: ["styleAgent"]
---

# Create Style Agent Batch

`POST /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``.

## Headers

- `Authorization` string, required
- `Idempotency-Key` string, nullable

## Request body

- CreateBatchRequest
  - `items` BatchItemRequest[], required
    - `text` string, required
    - `document_ref` string, nullable — Caller-provided document identifier.
    - `style_guide_id` string, nullable — Style guide to check against (overrides defaults).
    - `content_profile_id` string, nullable
    - `domain_ids` string[], nullable
    - `url` string, nullable
    - `document_name` string, nullable
    - `author` string, nullable — Who this document's check is credited to (D16). A batch check counts as authoring activity for its content's author; supply that identity here. When omitted, the check is credited to the batch's runner.
  - `defaults` BatchDefaults — Optional per-batch defaults applied to any item that omits the field.
    - `style_guide_id` string, nullable
    - `content_profile_id` string, nullable
    - `domain_ids` string[], nullable
  - `webhook_url` string, uri, nullable — 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 `202`

Batch accepted

- BatchAcceptedResponse — 202 body for create/append.
  - `batch_id` string, required
  - `segment_workflow_id` string, required
  - `status` 'running' | 'completed', required — 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.
  - `item_count` integer, required
  - `created_at` string, date-time, required
  - `items` BatchItemResponse[], required
    - `item_id` string, required
    - `document_ref` string, nullable
    - `workflow_id` string, required
    - `status` 'pending' | 'running' | 'completed' | 'failed', required — Per-document status within a batch, cached from the child workflow.
    - `error_category` 'input' | 'processing' — Why a batch item failed (D7): a bad request vs. a processing/system fault.

## Other responses

- `401` — Authentication failed or no valid API key provided.
- `403` — Forbidden
- `409` — Idempotency-Key reused with a different payload
- `413` — Request payload exceeds the per-request size limit
- `422` — Invalid input for one or more items
- `500` — Internal Server Error

## Changes

> 3 revisions in range; 1 could not be searched.

- **2026-08-14** `9f470199d1d1` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/markup/apis/api-reference/changes/style-agent/batch/post.md)

---

[API](https://skmtc.dev/markup/apis/api-reference.md) · [All operations](https://skmtc.dev/markup/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/markup/api-reference/revisions/65e1214d0bbf/schema)
