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

# Create a batch

> Submit an asynchronous, discounted batch of inference requests from a previously uploaded JSONL file, for workloads that can wait up to the completion window.

MONEY: the wallet must hold at least $0.10 of available runway to submit (402 otherwise); the batch discount and markup are frozen at submit time and the job is billed on completion. OWNER/ADMIN only (403). 400 when input_file_id/endpoint/model is missing or the body is not JSON. 503 when batch creation is temporarily unavailable upstream (the input file stays uploaded; retry later). 404 while the batch feature flag is off.



## OpenAPI

````yaml /openapi.json post /v1/batches
openapi: 3.1.0
info:
  title: errorbar Management API
  description: >-
    The management API behind the improvement loop: capture and setup, request
    logs and datasets, grades (labels), judges (criteria), evals and deploy
    gates, fine-tuning and reinforcement learning, dedicated GPU endpoints, and
    model aliases and versions. Authenticated with a workspace API key
    (sk_sovereign_...). The inference API (chat, embeddings, rerank, responses)
    is OpenAI-compatible and documented separately.


    Responses are snake_case, list endpoints on the loop products use the
    {"object": "list", "data": [...]} envelope, and refusals use the same nested
    error shape the gateway emits: {"error": {"message", "type", "code"}}.
    Request bodies on the loop products (logs, labels, criteria, evals,
    datasets, aliases) are snake_case; the training and infrastructure products
    (fine-tuning, GRPO, environment tools, dedicated, model-version adoption)
    validate camelCase bodies, and each schema below says which it is. Endpoints
    that spend money require a key minted by a workspace owner or admin and
    return 403 otherwise.
  version: 1.0.0
servers:
  - url: https://gateway.errorbar.ai
    description: Production
  - url: https://www.errorbar.ai/api
    description: Control plane (also served at this base URL)
security:
  - bearerAuth: []
paths:
  /v1/batches:
    post:
      tags:
        - Batches
      summary: Create a batch
      description: >-
        Submit an asynchronous, discounted batch of inference requests from a
        previously uploaded JSONL file, for workloads that can wait up to the
        completion window.


        MONEY: the wallet must hold at least $0.10 of available runway to submit
        (402 otherwise); the batch discount and markup are frozen at submit time
        and the job is billed on completion. OWNER/ADMIN only (403). 400 when
        input_file_id/endpoint/model is missing or the body is not JSON. 503
        when batch creation is temporarily unavailable upstream (the input file
        stays uploaded; retry later). 404 while the batch feature flag is off.
      operationId: createBatch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                input_file_id:
                  type: string
                  description: >-
                    Id of a file uploaded via /v1/files with purpose "batch"
                    containing the request JSONL. Must belong to this workspace
                    (or be the input of one of its past batches); otherwise 404
                    "Input file not found".
                endpoint:
                  type: string
                  enum:
                    - /v1/chat/completions
                    - /v1/completions
                    - /v1/embeddings
                  description: The API route every line in the file targets.
                model:
                  type: string
                  description: >-
                    A representative model id from the file; it is the
                    billing-rate basis. Must have configured pricing or the call
                    is refused with 400.
                completion_window:
                  type: string
                  description: How long the batch may take, e.g. "24h".
              required:
                - input_file_id
                - endpoint
                - model
      responses:
        '201':
          description: >-
            201 with the batch object: { id, nebius_batch_id, endpoint, status,
            request_total, request_completed, request_failed, completion_window,
            billed_cost_usd, created_at, output_file_id, error_file_id, error }
          content:
            application/json:
              schema:
                type: object
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/InsufficientBalance'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  responses:
    BadRequest:
      description: Malformed request or invalid field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing, malformed, or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: Invalid API key
              type: invalid_request_error
              code: invalid_api_key
    InsufficientBalance:
      description: Your wallet can't cover the required prepaid runway.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: >-
                Insufficient balance: deploying this endpoint requires at least
                1h of runway. Top up and try again.
              type: insufficient_quota
              code: insufficient_balance
    Forbidden:
      description: The key lacks the required owner/admin permission.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
              description: >-
                invalid_request_error, insufficient_quota, rate_limit_error, or
                api_error.
            code:
              type: string
              description: >-
                Machine-stable cause, e.g. invalid_api_key, not_found,
                insufficient_permissions, precondition_failed.
          required:
            - message
            - type
            - code
      description: >-
        Every refusal — gateway and management API alike — uses this one
        envelope.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your workspace API key, e.g. `sk_sovereign_...`, sent as `Authorization:
        Bearer <key>`.

````