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

# Create batch

> Interactive playground for POST /v1/batches.

Create a batch job from a JSONL file you already uploaded.

1. Upload input JSONL on [Upload file](/api-reference/upload-file) or via [Quickstart](/docs/batch/getting-started) (`purpose=batch`).
2. Paste the returned `file-…` id into `input_file_id` below.
3. Set `endpoint` to `/v1/chat/completions` (must match every line in your JSONL).

Full reference: [Batches API](/docs/batch/objects).


## OpenAPI

````yaml api-reference/openapi/batch.openapi.json POST /v1/batches
openapi: 3.1.0
info:
  title: ZeroGPU Batch & Files API
  version: '1.0'
  description: >-
    JSONL file storage (`/v1/files`) and asynchronous batch inference
    (`/v1/batches`). Wire-compatible with OpenAI's files and batch APIs. Auth:
    `x-api-key` on every request; `x-project-id` is optional.
servers:
  - url: https://api.zerogpu.ai
    description: Production
security:
  - ApiKey: []
paths:
  /v1/batches:
    post:
      tags:
        - Batches
      summary: Create a batch
      description: >-
        Submit a batch from an uploaded JSONL input file. Returns immediately
        with `status: in_progress`.
      operationId: createBatch
      parameters:
        - name: x-project-id
          in: header
          required: false
          schema:
            type: string
          description: >-
            Optional project identifier. Scopes the request to a specific
            project when provided.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBatchRequest'
            examples:
              chatCompletions:
                summary: Chat completions batch
                value:
                  input_file_id: file-abc123
                  endpoint: /v1/chat/completions
                  completion_window: 24h
                  metadata:
                    job: docs-playground
      responses:
        '200':
          description: Batch accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Batch'
        '400':
          description: Invalid request or JSONL validation failed
        '401':
          description: Missing authentication headers
        '403':
          description: Invalid credentials
        '404':
          description: Input file not found
        '429':
          description: Insufficient quota
        '500':
          description: Internal server error
components:
  schemas:
    CreateBatchRequest:
      type: object
      required:
        - input_file_id
        - endpoint
      properties:
        input_file_id:
          type: string
          description: ID from `POST /v1/files` with `purpose=batch`.
        endpoint:
          type: string
          enum:
            - /v1/chat/completions
          default: /v1/chat/completions
          description: Must match the `url` on every JSONL line.
        completion_window:
          type: string
          enum:
            - 24h
          default: 24h
        metadata:
          type: object
          additionalProperties: true
          description: Optional tags echoed back on retrieve.
    Batch:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          enum:
            - batch
        endpoint:
          type: string
        status:
          type: string
          enum:
            - validating
            - in_progress
            - finalizing
            - completed
            - failed
            - expired
            - cancelling
            - cancelled
        input_file_id:
          type: string
        output_file_id:
          type: string
          nullable: true
        error_file_id:
          type: string
          nullable: true
        completion_window:
          type: string
        created_at:
          type: integer
        expires_at:
          type: integer
        request_counts:
          type: object
          properties:
            total:
              type: integer
            completed:
              type: integer
            failed:
              type: integer
        metadata:
          type: object
          additionalProperties: true
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key

````