> ## 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.

# Upload file

> Interactive playground for POST /v1/files (multipart JSONL upload).

Upload batch input JSONL before [creating a batch](/api-reference/create-batch).

1. Set `purpose` to `batch`.
2. Attach a `.jsonl` file (max 100 MB). Each line must match the [JSONL format](/docs/batch/jsonl-format).
3. Copy the returned `id` (e.g. `file-…`) into `input_file_id` on the create-batch playground.

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


## OpenAPI

````yaml api-reference/openapi/batch.openapi.json POST /v1/files
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/files:
    post:
      tags:
        - Files
      summary: Upload a file
      description: >-
        Upload a JSONL file with `purpose=batch` (max 100 MB). Use the returned
        `id` as `input_file_id` when creating a batch.
      operationId: uploadFile
      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:
          multipart/form-data:
            schema:
              type: object
              required:
                - purpose
                - file
              properties:
                purpose:
                  type: string
                  enum:
                    - batch
                  default: batch
                  description: Must be `batch` for batch input uploads.
                file:
                  type: string
                  format: binary
                  description: >-
                    JSONL file (validated when you create the batch, not at
                    upload).
      responses:
        '200':
          description: File uploaded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/File'
              examples:
                default:
                  value:
                    id: file-0123456789abcdef012345
                    object: file
                    bytes: 5000
                    created_at: 1736290000
                    filename: input.jsonl
                    purpose: batch
                    status: processed
                    expires_at: 1738882000
        '400':
          description: Invalid multipart, purpose, or empty file
        '401':
          description: Missing authentication headers
        '403':
          description: Invalid credentials
        '413':
          description: File exceeds 100 MB
        '429':
          description: Insufficient quota
        '500':
          description: Internal server error
components:
  schemas:
    File:
      type: object
      properties:
        id:
          type: string
          description: Prefixed with `file-`.
        object:
          type: string
          enum:
            - file
        bytes:
          type: integer
        created_at:
          type: integer
        filename:
          type: string
        purpose:
          type: string
          enum:
            - batch
            - batch_output
          description: Uploads use `batch`; batch results use `batch_output`.
        status:
          type: string
          enum:
            - uploaded
            - processed
            - error
        status_details:
          type: string
        expires_at:
          type: integer
        is_error:
          type: boolean
          description: ZeroGPU extension. `true` on batch error output files only.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key

````