Docs / API reference

Batch files and generated files

Updated 2026-11-22. Published by PentestLLM.

Two different things share the path https://api.pentestllm.ai/v1/files. Batch files are JSONL you upload as input to a batch, plus the output and error files a batch writes back; they belong to your organization and need a key. Generated files are the images, video and audio a generation produced, served from a public path with no key at all.

Routes

RouteCredentialStatuses
POST /v1/filesAPI key200, 400, 401, 413
GET /v1/filesAPI key200, 401
GET /v1/files/{file_id}API key200, 401, 404
DELETE /v1/files/{file_id}API key200, 401, 404
GET /v1/files/{file_id}/contentAPI key200, 401, 404
GET /v1/files/{path}none, the path itself200, 404

The five batch file routes accept any regular key of the organization, as bearer auth or through the vendor key headers the specification also lists. If a console login works here too, the OpenAPI document does not say. The generated file route declares no security.

Upload a batch input

POST /v1/files is multipart with two parts: file, the JSONL, and purpose, which must be batch. A file may hold 50 MB and 50,000 lines at most. Every line is an object with a unique custom_id, method POST, a url naming /v1/responses, /v1/chat/completions, /v1/completions, /v1/moderations or /v1/embeddings, and the body you would send that route. All lines are validated on upload and the first bad one is named by number in a 400 invalid_request, as is a missing file or a purpose other than batch. Over 50 MB is 413 invalid_request. The file is kept for 30 days.

The file object

The upload and a read of one file both return:

FieldMeaning
idfile- and 24 hex characters.
objectAlways file.
bytesSize of the file.
created_atUpload time, Unix seconds.
expires_atThirty days after upload, Unix seconds.
filenameThe name it was uploaded with.
purposebatch for an input, batch_output for a file a batch wrote.
statusprocessed once stored.

List, read, download, delete

GET /v1/files returns object list, data and has_more, newest first. Its prose accepts purpose (batch or batch_output) and limit (100 by default, up to 10,000) as filters, though neither is declared as a formal parameter. GET /v1/files/{file_id} returns one file object. GET /v1/files/{file_id}/content streams the JSONL: an input as uploaded, or one line per request from an output or error file, shaped id, custom_id, response (status_code, request_id, body) and error. DELETE /v1/files/{file_id} answers id, object file and deleted true. An id outside your organization is 404 not_found on all three, and a failed credential is 401 invalid_api_key on all five batch file routes.

Generated files

GET /v1/files/{path} takes a path of the form {date}/{generation_id}/{n}.{ext}, exactly as a generation’s outputs hand it over. It returns the binary as an image, video, audio or octet-stream type, cacheable publicly and immutably for seven days and readable from any origin, for 30 days after the generation; after that, or for a path that never existed, it is 404 not_found. The path is the only protection, so share it as you would a secret. The prose also mentions HEAD on these paths, which is not a declared operation.

Example

shell
1curl "https://api.pentestllm.ai/v1/files?purpose=batch&limit=100" \
2 -H "Authorization: Bearer sk-ptl-live-…"

To run an uploaded file, go on to Batches.

Questions

Does an upload start running requests?

No. The upload stores the file and checks every line, which makes it a free dry run. Work and charges begin only when a batch is created from it.

Is everything under /v1/files private?

No. Batch files need an API key, but a generated media path is a public link: whoever holds it can download the file until it expires.

Can I send a PDF here for a chat model to read?

Not through this route, which only takes batch JSONL. Documents for a chat model travel inside the chat request itself; the files and redaction feature page covers that.

Join on TelegramHelp