Skip to main content

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

POST /v1/files, attach JSONL with purpose=batch.

List files

GET /v1/files, filter by purpose, paginate with after.

Retrieve file

GET /v1/files/{file_id}, metadata only.

Download file

GET /v1/files/{file_id}/content, raw JSONL body.

Delete file

DELETE /v1/files/{file_id}, soft-delete.
Wire-compatible with OpenAI’s /v1/files, with these ZeroGPU specifics:
  • Only purpose=batch is accepted on upload. Server-written output files (both successes and errors) carry purpose=batch_output; error files are additionally tagged with the ZeroGPU-specific is_error: true flag on the File object.
  • Authentication uses x-api-key + x-project-id headers instead of a Bearer token.
  • Files are soft-deleted (the row is preserved for audit; the object is removed from storage immediately).

Endpoint summary

MethodPathPurpose
POST/v1/filesUpload a JSONL file
GET/v1/filesList your project’s files
GET/v1/files/{file_id}Retrieve metadata for one file
GET/v1/files/{file_id}/contentDownload the raw JSONL body
DELETE/v1/files/{file_id}Soft-delete a file

Authentication

Every request (except the unauthenticated OPTIONS preflight) must include:
x-api-key:    <your-api-key>
x-project-id: <your-project-uuid>
Missing or invalid headers return 401. Inactive keys or keys that don’t belong to the supplied project return 403. An organization with no balance and no free credits returns 429 with an insufficient_quota error.

The File object

This is the shape returned by upload, retrieve, and (inside data[]) list.
{
  "id":         "file-abc123...",
  "object":     "file",
  "bytes":      12345,
  "created_at": 1736290000,
  "filename":   "input.jsonl",
  "purpose":    "batch",
  "status":     "processed",
  "expires_at": 1738882000
}
For batch error files, an additional is_error flag is set:
{
  "id":         "file-err789...",
  "object":     "file",
  "bytes":      512,
  "created_at": 1736295000,
  "filename":   "batch_01HZX_errors.jsonl",
  "purpose":    "batch_output",
  "status":     "processed",
  "is_error":   true
}
FieldTypeDescription
idstringFile identifier. Always prefixed file-. Legacy file_ (underscore) ids written before the prefix was normalised remain readable and resolvable.
objectstringAlways "file".
bytesintegerSize in bytes as measured by the server after upload.
created_atintegerUnix timestamp (seconds).
filenamestringOriginal filename you uploaded, or {file_id}.jsonl if none was supplied.
purposestring"batch" for uploads, "batch_output" for both batch result and batch error files.
statusstringOne of "uploaded" / "processed" / "error". ZeroGPU emits "processed" exclusively today; the wider union matches OpenAI’s published type for forward compatibility.
status_detailsstring | omittedOpenAI-compatible diagnostic string. Omitted on healthy files.
expires_atinteger | omittedUnix timestamp at which the file will be removed. Customer uploads expire 30 days after upload. May be absent for server-written files.
is_errorboolean | omittedZeroGPU extension. Present and true only on batch error files (the ones referenced by Batch.error_file_id). Omitted on input and success files. OpenAI SDKs ignore this field unless explicitly read.

POST /v1/files: Upload a file

Uploads a JSONL file that will be used as the input to a batch.

Request

POST /v1/files
Content-Type: multipart/form-data
x-api-key:    <key>
x-project-id: <uuid>
Multipart form fields:
FieldRequiredValue
purposeYesMust be exactly "batch".
fileYesThe JSONL file. Max 100 MB.
Note. JSONL is validated at batch creation, not uploadThe server stores your file as-is. Malformed JSONL will upload successfully but fail with a 400 (and a line field) when you call POST /v1/batches. See the JSONL format page for the exact schema.
Other notes:
  • The file is retained for 30 days unless you delete it.
  • The filename you upload is preserved in the filename field of the File object.

Response: 200 OK

{
  "id":         "file-0123456789abcdef012345",
  "object":     "file",
  "bytes":      5000,
  "created_at": 1736290000,
  "filename":   "input.jsonl",
  "purpose":    "batch",
  "status":     "processed",
  "expires_at": 1738882000
}

Errors

StatusCodeCause
400invalid_content_typeContent-Type was not multipart/form-data.
400invalid_multipartThe multipart body could not be parsed.
400invalid_purposepurpose was anything other than "batch".
400missing_fileNo file field in the multipart body.
400empty_fileThe uploaded file had zero bytes.
413file_too_largeFile exceeded 100 MB.
401 / 403 / 429 / 500-See Errors reference.

Example

curl -X POST https://api.zerogpu.ai/v1/files \
  -H "x-api-key: $ZGPU_API_KEY" \
  -H "x-project-id: $ZGPU_PROJECT_ID" \
  -F purpose=batch \
  -F [email protected]

GET /v1/files: List files

Returns the project’s files in reverse-chronological order by default.

Request

GET /v1/files[?purpose=...&order=...&after=...&limit=...]
x-api-key:    <key>
x-project-id: <uuid>
Query parameters (all optional):
ParamDefaultDescription
purpose(all)Filter by purpose: batch or batch_output. When you query batch_output, both success and error files are returned (distinguished by is_error on each file object).
orderdescSort order on created_at. desc = newest first, asc = oldest first.
after-Cursor for pagination. Pass the id of the last file from the previous page (or use the last_id field from the previous response).
limit10000Maximum number of files to return. Must be a positive integer ≤ 10000.

Response: 200 OK

{
  "object": "list",
  "data": [
    {
      "id":         "file-abc...",
      "object":     "file",
      "bytes":      5000,
      "created_at": 1736290000,
      "filename":   "input.jsonl",
      "purpose":    "batch",
      "status":     "processed",
      "expires_at": 1738882000
    },
    {
      "id":         "file-out_xyz...",
      "object":     "file",
      "bytes":      12345,
      "created_at": 1736289900,
      "filename":   "file-out_xyz.jsonl",
      "purpose":    "batch_output",
      "status":     "processed"
    }
  ],
  "first_id": "file-abc...",
  "last_id":  "file-out_xyz...",
  "has_more": false
}
FieldTypeDescription
objectstringAlways "list".
dataarrayFile objects in the requested order.
first_idstring | nullThe id of the first item on the page, or null if data is empty.
last_idstring | nullThe id of the last item on the page. Use this as after for the next page.
has_morebooleantrue if more files exist beyond limit.
To page forward, pass last_id as after on the next request, keeping the same purpose and order.

Errors

StatusCodeCause
400invalid_limitlimit was not a positive integer.
401 / 403 / 429 / 500-See Errors reference.

Example

curl "https://api.zerogpu.ai/v1/files?purpose=batch&limit=20" \
  -H "x-api-key: $ZGPU_API_KEY" \
  -H "x-project-id: $ZGPU_PROJECT_ID"

GET /v1/files/{file_id}: Retrieve a file

Returns the metadata for a single file. Use this to look up filename, bytes, or purpose without downloading the body.

Request

GET /v1/files/{file_id}
x-api-key:    <key>
x-project-id: <uuid>

Response: 200 OK

Same shape as the File object returned by upload.

Errors

StatusCodeCause
404file_not_foundFile does not exist, belongs to another project, or has been deleted. The same 404 is returned in all three cases to avoid leaking file existence across projects.
401 / 403 / 429 / 500-See Errors reference.

Example

curl https://api.zerogpu.ai/v1/files/file-abc123... \
  -H "x-api-key: $ZGPU_API_KEY" \
  -H "x-project-id: $ZGPU_PROJECT_ID"

GET /v1/files/{file_id}/content: Download a file’s body

Streams the raw JSONL body. This is how you read both the input file you uploaded and the output / error files produced by a completed batch.

Request

GET /v1/files/{file_id}/content
x-api-key:    <key>
x-project-id: <uuid>

Response: 200 OK

Content-Type:        application/jsonl
Content-Disposition: attachment; filename="{original_filename}"

<raw JSONL bytes>
The body is streamed; you do not need to fit it in memory.

Errors

StatusCodeCause
404file_not_foundFile missing, deleted, or belongs to another project.
401 / 403 / 429 / 500-See Errors reference.

Example

curl https://api.zerogpu.ai/v1/files/file-out789.../content \
  -H "x-api-key: $ZGPU_API_KEY" \
  -H "x-project-id: $ZGPU_PROJECT_ID" \
  -o output.jsonl

DELETE /v1/files/{file_id}: Delete a file

Soft-deletes the file. The stored object is removed from storage immediately; the database row is preserved with a deleted_at timestamp for audit purposes. After a successful delete, the file disappears from list, retrieve, and content endpoints, all three return 404. Deletes cannot be undone via the API.

Request

DELETE /v1/files/{file_id}
x-api-key:    <key>
x-project-id: <uuid>

Response: 200 OK

{
  "id":      "file-abc123...",
  "object":  "file",
  "deleted": true
}

Errors

StatusCodeCause
404file_not_foundFile missing, already deleted, or belongs to another project.
401 / 403 / 429 / 500-See Errors reference.

Example

curl -X DELETE https://api.zerogpu.ai/v1/files/file-abc123... \
  -H "x-api-key: $ZGPU_API_KEY" \
  -H "x-project-id: $ZGPU_PROJECT_ID"

Quotas, limits, and behavior

LimitValue
Max single upload100 MB
Default retention30 days
Max list limit10,000
Accepted upload purposebatch only
Returned purpose valuesbatch, batch_output
Notes:
  • There is no rate-limit envelope returned in headers; quota is enforced at the organization level. A request from an organization with no balance and no free credits returns 429 insufficient_quota.
  • Deleting a file that is the input to an active batch does not stop the batch, the batch reads the input file at creation time, not on demand.
  • The output and error files produced by a batch are both written with purpose: batch_output. Error files are additionally tagged with is_error: true so you can distinguish them at list time. The Batch object’s error_file_id is the canonical way to discover the error file for a given batch.

Next steps

Batches API reference →

Create, list, retrieve batches; status lifecycle and limits.

JSONL format →

What an input line, an output line, and an error line look like.

Errors reference →

Every HTTP status, every validation message, every JSONL error code.