Skip to content

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 ​

http
POST /v1/files

Request Headers ​

ParameterTypeRequiredDescription
AuthorizationstringYesBearer <api-key>
Content-TypestringYesmultipart/form-data

Request Parameters ​

FieldTypeRequiredDescription
purposestringYesAlways batch
filefileYesJSONL file with one JSON object per line

Upload Limits ​

LimitDefaultResponse when exceeded
File size in bytes100 MB400 / 413 file_too_large
Valid rows50,000400 too_many_rows
Single row length8 MB400 invalid_jsonl
Empty file—400 empty_file
File retention period30 daysReading after expiration returns 404 file_not_found

Upload only validates that the file is valid JSONL. The structure of custom_id, model, url and other fields inside each row is validated when the batch is created.

Request Example ​

bash
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 ​

json
{
  "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 ​

HTTPcodeDescription
400missing_fileThe file form parameter is missing
400invalid_purposepurpose is not batch
400invalid_jsonlThe file is not valid JSONL, or a single row exceeds 8 MB
400empty_fileThe file contains no valid rows
400too_many_rowsThe number of valid rows exceeds the limit
400file_too_largeThe file size in bytes exceeds the limit
403no_batch_groupBatch is not enabled for the current API Key
403no_batch_channelThe current configuration does not support Batch
413file_too_largeThe uploaded content exceeds the size limit
503object_storage_unconfiguredThe Batch service is temporarily unavailable

List Files ​

Endpoint ​

http
GET /v1/files

Request Parameters ​

FieldTypeRequiredDescription
purposestringNoFilter by purpose: batch / batch_output / batch_error
limitintNoPage size. Default 20, maximum 100 (values above the maximum are truncated to 100)
afterstringNoCursor: the last_id returned by the previous page. Omit for the first page

Request Example ​

bash
curl --location 'https://neolink.com/api/v1/files?purpose=batch&limit=20' \
  --header 'Authorization: Bearer <api-key>'

Success Response ​

json
{
  "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"
}
FieldTypeDescription
objectstringAlways list
dataarrayArray of file objects, sorted by created_at in descending order
has_moreboolWhether there is a next page
first_idstring | nullIdentifier of the first file on this page; null for an empty list
last_idstring | nullIdentifier of the last file on this page; pass it as after for the next page

Error Response ​

HTTPcodeDescription
400invalid_limitlimit is not a positive integer
400invalid_afterThe after cursor is invalid or points to a file that does not exist

Retrieve File Details ​

Endpoint ​

http
GET /v1/files/{id}

Request Parameters ​

FieldTypeRequiredDescription
idstringYesFile identifier file-...

Request Example ​

bash
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 ​

HTTPcodeDescription
404file_not_foundThe file does not exist or does not belong to the current API Key

Download File Content ​

Endpoint ​

http
GET /v1/files/{id}/content

Request Parameters ​

FieldTypeRequiredDescription
idstringYesFile identifier file-...

Request Example ​

bash
curl --location 'https://neolink.com/api/v1/files/file-fa7326de39c3402cbc12007522f78c69/content' \
  --header 'Authorization: Bearer <api-key>' \
  -o output.jsonl

Success Response ​

Returns the file content directly (streamed):

Response HeaderValue
Content-Typeapplication/jsonl
Content-Dispositionattachment; filename="<filename>"
Content-LengthFile size in bytes (returned when greater than 0)

Error Response ​

HTTPcodeDescription
404file_not_foundThe file does not exist, does not belong to the current API Key, or has expired

Delete a File ​

Endpoint ​

http
DELETE /v1/files/{id}

Request Parameters ​

FieldTypeRequiredDescription
idstringYesFile identifier file-...

Request Example ​

bash
curl --request DELETE \
  --url 'https://neolink.com/api/v1/files/file-51428aca4e0a47808012aaa03d1734ff' \
  --header 'Authorization: Bearer <api-key>'

Success Response ​

json
{
  "id": "file-51428aca4e0a47808012aaa03d1734ff",
  "object": "file",
  "deleted": true
}

Error Response ​

HTTPcodeDescription
409file_in_useThe input file is still used by an unfinished batch, or the batch owning the result file has not finished processing
404file_not_foundThe file does not exist or does not belong to the current API Key