Files API
Upload, query, download and delete Batch input files. Uploaded files always use
purpose=batch; success/failure result files (batch_output/batch_error) are generated by the platform and can only be downloaded, never uploaded.For the field descriptions of the file object, see API Overview · File Object.
Permission scope
Files are isolated strictly by API Key: only the API Key that uploaded a file can query, download or delete it. Access from any other API Key always returns 404 file_not_found (including other API Keys under the same account or the same enterprise). Result files belong to the API Key that created the batch. See API Overview · Data Visibility.
Upload a File
Endpoint
POST /v1/filesRequest Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer <api-key> |
Content-Type | string | Yes | multipart/form-data |
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
purpose | string | Yes | Always batch |
file | file | Yes | JSONL file with one JSON object per line |
Upload Limits
| Limit | Default | Response when exceeded |
|---|---|---|
| File size in bytes | 100 MB | 400 / 413 file_too_large |
| Valid rows | 50,000 | 400 too_many_rows |
| Single row length | 8 MB | 400 invalid_jsonl |
| Empty file | — | 400 empty_file |
| File retention period | 30 days | Reading after expiration returns 404 file_not_found |
Upload only validates that the file is valid JSONL. The structure of
custom_id,model,urland other fields inside each row is validated when the batch is created.
Request Example
curl --request POST \
--url 'https://neolink.com/api/v1/files' \
--header 'Authorization: Bearer <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form 'purpose=batch' \
--form 'file=@batch1.jsonl'Success Response
{
"id": "file-51428aca4e0a47808012aaa03d1734ff",
"object": "file",
"bytes": 512,
"created_at": 1764031200,
"filename": "batch1.jsonl",
"purpose": "batch"
}For the response field descriptions, see API Overview · File Object.
Error Response
| HTTP | code | Description |
|---|---|---|
| 400 | missing_file | The file form parameter is missing |
| 400 | invalid_purpose | purpose is not batch |
| 400 | invalid_jsonl | The file is not valid JSONL, or a single row exceeds 8 MB |
| 400 | empty_file | The file contains no valid rows |
| 400 | too_many_rows | The number of valid rows exceeds the limit |
| 400 | file_too_large | The file size in bytes exceeds the limit |
| 403 | no_batch_group | Batch is not enabled for the current API Key |
| 403 | no_batch_channel | The current configuration does not support Batch |
| 413 | file_too_large | The uploaded content exceeds the size limit |
| 503 | object_storage_unconfigured | The Batch service is temporarily unavailable |
List Files
Endpoint
GET /v1/filesRequest Parameters
| Field | Type | Required | Description |
|---|---|---|---|
purpose | string | No | Filter by purpose: batch / batch_output / batch_error |
limit | int | No | Page size. Default 20, maximum 100 (values above the maximum are truncated to 100) |
after | string | No | Cursor: the last_id returned by the previous page. Omit for the first page |
Request Example
curl --location 'https://neolink.com/api/v1/files?purpose=batch&limit=20' \
--header 'Authorization: Bearer <api-key>'Success Response
{
"object": "list",
"data": [
{
"id": "file-51428aca4e0a47808012aaa03d1734ff",
"object": "file",
"bytes": 512,
"created_at": 1764031200,
"filename": "batch1.jsonl",
"purpose": "batch"
}
],
"has_more": false,
"first_id": "file-51428aca4e0a47808012aaa03d1734ff",
"last_id": "file-51428aca4e0a47808012aaa03d1734ff"
}| Field | Type | Description |
|---|---|---|
object | string | Always list |
data | array | Array of file objects, sorted by created_at in descending order |
has_more | bool | Whether there is a next page |
first_id | string | null | Identifier of the first file on this page; null for an empty list |
last_id | string | null | Identifier of the last file on this page; pass it as after for the next page |
Error Response
| HTTP | code | Description |
|---|---|---|
| 400 | invalid_limit | limit is not a positive integer |
| 400 | invalid_after | The after cursor is invalid or points to a file that does not exist |
Retrieve File Details
Endpoint
GET /v1/files/{id}Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | File identifier file-... |
Request Example
curl --location 'https://neolink.com/api/v1/files/file-51428aca4e0a47808012aaa03d1734ff' \
--header 'Authorization: Bearer <api-key>'Success Response
Returns a single file object. For the fields, see API Overview · File Object.
Error Response
| HTTP | code | Description |
|---|---|---|
| 404 | file_not_found | The file does not exist or does not belong to the current API Key |
Download File Content
Endpoint
GET /v1/files/{id}/contentRequest Parameters
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | File identifier file-... |
Request Example
curl --location 'https://neolink.com/api/v1/files/file-fa7326de39c3402cbc12007522f78c69/content' \
--header 'Authorization: Bearer <api-key>' \
-o output.jsonlSuccess Response
Returns the file content directly (streamed):
| Response Header | Value |
|---|---|
Content-Type | application/jsonl |
Content-Disposition | attachment; filename="<filename>" |
Content-Length | File size in bytes (returned when greater than 0) |
Error Response
| HTTP | code | Description |
|---|---|---|
| 404 | file_not_found | The file does not exist, does not belong to the current API Key, or has expired |
Delete a File
Endpoint
DELETE /v1/files/{id}Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | File identifier file-... |
Request Example
curl --request DELETE \
--url 'https://neolink.com/api/v1/files/file-51428aca4e0a47808012aaa03d1734ff' \
--header 'Authorization: Bearer <api-key>'Success Response
{
"id": "file-51428aca4e0a47808012aaa03d1734ff",
"object": "file",
"deleted": true
}Error Response
| HTTP | code | Description |
|---|---|---|
| 409 | file_in_use | The input file is still used by an unfinished batch, or the batch owning the result file has not finished processing |
| 404 | file_not_found | The file does not exist or does not belong to the current API Key |
