---
title: "POST /ai/v1/files"
method: POST
path: "/ai/v1/files"
tags: ["AI Gateway"]
---

# POST /ai/v1/files

`POST /ai/v1/files`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/ai/v1/files`
- Auth: HTTP bearer

## Request body `multipart/form-data`

- UploadFileForm: `multipart/form-data` body of `POST /ai/v1/files`.
  - `file` string, binary, required: A JSONL batch input file: one request per line, every line targeting the same model and endpoint. At most 200 MB and 50,000 requests.
  - `purpose` string, required: Must be `batch`.

## Response `200`

Uploaded file

- FileObject: A file object as returned by the provider.
  - `bytes` integer
  - `created_at` integer
  - `filename` string
  - `id` string, required
  - `object` string, required: Always `file`
  - `purpose` string: `batch` for uploads, `batch_output` for batch results

## Other responses

- `400`: Invalid batch input file
- `401`: Unauthorized
- `403`: Model not allowed
- `404`: Model or provider not configured
- `413`: File larger than 200 MB
- `429`: Concurrent upload capacity reached; retry later

## Changes

- **2026-10-05** `2d395ffb4f03`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/ai/v1/files/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
