Files
/v1/files — upload and manage batch input/output files
Upload the JSONL files that Batches run against, and download batch results. OpenAI-compatible Files API, scoped to purpose: "batch".
Base path: /v1/files
Auth: Bearer token or x-api-key. Requires any inference scope.
Max upload size: 105 MB.
Files is only for batch I/O today. Other OpenAI Files purposes (fine-tune, assistants, vision) aren't implemented — we don't have the endpoints they feed.
Upload a file
POST /v1/filesmultipart/form-data upload.
| Field | Type | Required | Description |
|---|---|---|---|
file | file | yes | JSONL file (one JSON object per line). |
purpose | string | yes | Must be "batch". |
Example:
curl https://api.melious.ai/v1/files \
-H "Authorization: Bearer sk-mel-<YOUR_API_KEY>" \
-F purpose="batch" \
-F file=@requests.jsonlResponse:
{
"id": "file_abc123",
"object": "file",
"bytes": 12345,
"created_at": 1699999999,
"filename": "requests.jsonl",
"purpose": "batch"
}List files
GET /v1/files?purpose=batch&limit=20&after=<cursor>&order=desc| Query param | Type | Default | Description |
|---|---|---|---|
purpose | string | any | Filter by purpose. |
limit | integer | 20 | Max 100. |
after | string | none | Cursor for pagination. |
order | string | "desc" | "asc" or "desc" by created_at. |
Response:
{
"object": "list",
"data": [ /* file objects */ ],
"has_more": false
}Retrieve file metadata
GET /v1/files/{file_id}Returns the file object (same shape as upload response). Doesn't return the content — that's a separate endpoint.
Download file content
GET /v1/files/{file_id}/contentReturns the raw JSONL content with Content-Type: application/jsonl. Not JSON-wrapped — the bytes are the file.
Example:
curl https://api.melious.ai/v1/files/file_abc123/content \
-H "Authorization: Bearer sk-mel-<YOUR_API_KEY>" \
-o results.jsonlUse this to pull batch output once output_file_id is set on the batch object.
Delete a file
DELETE /v1/files/{file_id}Response:
{
"id": "file_abc123",
"object": "file",
"deleted": true
}Deleting a file that's still referenced by an active batch doesn't cancel the batch, but may affect output retrieval depending on timing — wait for the batch to finish, download the output file, then delete both.
Errors
VALIDATION_4016— upload exceeds 105 MB.VALIDATION_4007—purposeis not"batch".INFERENCE_3302— requested file doesn't exist.INFERENCE_3303— file content fails JSONL validation.AUTH_1015— missing inference scope.
Related
Batches for the endpoint that consumes these files • Batch workflow for the end-to-end pattern.