Files API: batch JSONL and generated output downloads

Upload and manage UplinkSwitch batch JSONL, retrieve result content and distinguish authenticated file records from public generated-media links.

Checked 2026-11-22

·API reference·Models

Two different access models sit under the files prefix. Batch inputs and results belong to the organization and require an API key. A generated-media download uses the URL returned by its job and requires no key. Decide which kind of file you are handling before building storage, sharing or cleanup behavior.

Upload a batch input

POST /v1/files accepts multipart form data with required binary file and string purpose, whose only supported upload value is batch. The documented limits are 50 MB and 50,000 lines.

Each JSONL line contains custom_id, method, url and body. custom_id must be unique within the input, and method must be POST. Allowed line URLs are /v1/chat/completions, /v1/completions, /v1/embeddings, /v1/responses and /v1/moderations. This list describes upload validation; it does not establish which models are currently available for moderation. Check the public catalog before selecting one.

Upload validates every line and identifies the first invalid one by number. It stores the file without running or charging the requests. Start execution separately through the batches API.

This illustrative upload reads a local file you have prepared. Keep the ordinary key in UPLINKSWITCH_API_KEY.

bash
curl --fail-with-body -X POST 'https://api.uplinkswitch.com/v1/files' \
  -H "Authorization: Bearer ${UPLINKSWITCH_API_KEY}" \
  -F 'purpose=batch' \
  -F 'file=@requests.jsonl'

Read metadata before downloading content

Upload returns 200 with a BatchFile, the same schema used by GET /v1/files/{file_id}.

PropertyContract
idRequired string matching file- followed by 24 lowercase hex characters.
objectRequired constant file.
filename, bytesRequired string filename and integer size.
created_atRequired Unix-seconds timestamp.
purposeRequired batch or batch_output.
expires_atOptional Unix-seconds timestamp, described as 30 days after upload.
statusOptional constant processed.

Batch files are kept for 30 days. GET /v1/files lists batch inputs plus generated output and error files from batches, newest first. Its prose supports a purpose filter of batch or batch_output, and limit up to 10,000, default 100. Those filters have no formal parameter definitions. The list schema has object: list, data and has_more; for a continuation cursor, the OpenAPI document does not say.

Fetch results and remove batch files

GET /v1/files/{file_id}/content returns JSONL. Input content is the uploaded text. For result lines, the operation description shows id, custom_id, response and error, with response.status_code, response.request_id and response.body. The HTTP response is a string rather than a typed JSON-line schema, so the field description does not establish every nullability or failure variant.

DELETE /v1/files/{file_id} returns 200 with id, object: file and deleted: true. For the effect of deleting an input while its batch is running, the OpenAPI document does not say. Reconcile batch completion before deciding when to remove its inputs and results.

These five batch-file operations inherit API-key authentication and organization ownership. These operations document API-key access; console-session acceptance is not specified.

Generated files use public download URLs

GET /v1/files/{path} serves binary output from a finished generation. Use the actual URL in the generation’s outputs; its path follows {date}/{generation_id}/{n}.{ext}. The operation explicitly has no authentication requirement. Possession of the URL grants access, and files are documented as available for 30 days after generation.

Downloads carry a public, immutable seven-day cache directive. That cache lifetime is separate from the 30-day storage period. HEAD support appears in the description, although OpenAPI declares only GET as an operation. For immediate revocation of an output link or a separate generated-file deletion operation, the OpenAPI document does not say. Do not assume the batch-file delete route applies to this multi-segment media path.

See Generations for job status and output metadata, and SDK setup for the connection guide.

Failure cases

OperationDeclared failures
Upload400 invalid_request for invalid purpose, missing file or invalid numbered line; 401 invalid_api_key; 413 invalid_request over 50 MB.
List401 invalid_api_key.
Read metadata, download JSONL or delete401 invalid_api_key; 404 not_found for absent or foreign-organization files.
Public generated download404 not_found if missing or past the 30-day window.

All operations above declare HTTP 200 success. A successful upload confirms file validation, not successful inference execution.

Questions and answers

No. The upload operation accepts batch-purpose JSONL only; this route is not documented as a general document-storage upload.

The description says validation and storage run without executing or charging the request lines. Creating a batch starts execution separately.

The batch-file metadata and content routes require a key and organization ownership. They are distinct from the unauthenticated generated-media download route.

No. The response has a seven-day cache directive while the documented storage lifetime is 30 days. Treat them as different clocks.

Download and retain required results in storage you control before their 30-day availability ends. The API does not document a retention-extension field.
Join on Telegram
Help