> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sailresearch.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a batch

> Submit a batch of requests for asynchronous processing.



## OpenAPI

````yaml /openapi.json post /batches
openapi: 3.1.0
info:
  title: Sail API
  version: '2026-02-18'
  description: >-
    Sail provides OpenAI-compatible Responses and Chat Completions endpoints,
    plus an Anthropic-compatible Messages endpoint. This reference documents the
    currently supported subset of fields.
servers:
  - url: https://api.sailresearch.com/v1
security:
  - BearerAuth: []
tags:
  - name: Models API
    description: Model discovery endpoints.
  - name: Responses API
    description: OpenAI-compatible Responses API endpoints.
  - name: Chat Completions API
    description: OpenAI-compatible Chat Completions API endpoints.
  - name: Messages API
    description: Anthropic-compatible Messages API endpoints.
  - name: Batches API
    description: Submit and manage batches of requests.
paths:
  /batches:
    post:
      tags:
        - Batches API
      summary: Create a batch
      description: Submit a batch of requests for asynchronous processing.
      operationId: createBatch
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBatchRequest'
            example:
              endpoint: /v1/responses
              label: my-batch-job
              requests:
                - custom_id: my-first-request
                  params:
                    model: zai-org/GLM-5.2-FP8
                    max_output_tokens: 1024
                    input:
                      - role: user
                        content: Hello, world!
                - custom_id: my-second-request
                  params:
                    model: zai-org/GLM-5.2-FP8
                    max_output_tokens: 1024
                    input:
                      - role: user
                        content: Hello again!
      responses:
        '200':
          description: Batch created.
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                  - request_counts
                  - created_at
                properties:
                  id:
                    type: string
                    description: Unique identifier for the batch.
                  request_counts:
                    type: integer
                    description: Total number of requests in the batch.
                  created_at:
                    type: integer
                    description: Unix timestamp of when the batch was created.
                  label:
                    type: string
                    description: The label for the batch, if provided.
              example:
                id: batch_abc123
                request_counts: 2
                created_at: 1741564800
                label: my-batch-job
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
      description: >-
        Makes the request retry-safe. Sail stores a reservation keyed by
        (organization, API key, Idempotency-Key); retrying with the same value
        returns the previously stored response instead of re-running inference.
        Keys are capped at 255 characters. See [Idempotent
        Requests](/idempotency) for full semantics.
  schemas:
    CreateBatchRequest:
      type: object
      required:
        - endpoint
        - requests
      properties:
        endpoint:
          type: string
          enum:
            - /v1/responses
          description: >-
            The API endpoint to use for all requests in the batch. Currently
            only /v1/responses is supported.
        requests:
          type: array
          minItems: 1
          maxItems: 100000
          description: >-
            The list of requests in the batch. Min 1, max 100,000 requests.
            Total request body must not exceed 256 MB.
          items:
            $ref: '#/components/schemas/BatchRequestItem'
        label:
          type: string
          pattern: ^[a-zA-Z0-9_-]+$
          maxLength: 128
          description: >-
            An optional label for the batch. Must be alphanumeric (hyphens and
            underscores allowed), max 128 characters.
      additionalProperties: false
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
      additionalProperties: false
    BatchRequestItem:
      type: object
      required:
        - custom_id
        - params
      properties:
        custom_id:
          type: string
          pattern: ^[a-z0-9][a-z0-9_-]*$
          minLength: 1
          maxLength: 64
          description: >-
            A unique identifier for this request within the batch. Must be
            lowercase alphanumeric and can include hyphens and underscores. Min
            1 character, max 64 characters.
        params:
          type: object
          description: >-
            The request parameters (same fields as a Responses API request
            body).
          additionalProperties: true
      additionalProperties: false
    ErrorObject:
      type: object
      required:
        - message
        - type
      properties:
        message:
          type: string
        type:
          type: string
        param:
          oneOf:
            - type: string
            - type: 'null'
        code:
          oneOf:
            - type: string
            - type: integer
            - type: 'null'
      additionalProperties: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````