---
title: "Files API: batch JSONL uploads and generated media"
description: "Upload a JSONL batch input, list and download batch files and their results, delete them, and fetch generated media from public paths that take no key."
canonical: https://pentestllm.ai/docs/files
generated: 2026-11-27T06:25:48.742Z
source: https://pentestllm.ai/docs/files
base_url: https://api.pentestllm.ai/v1
---

[Docs](https://pentestllm.ai/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

| Route | Credential | Statuses |
| --- | --- | --- |
| `POST /v1/files` | API key | 200, 400, 401, 413 |
| `GET /v1/files` | API key | 200, 401 |
| `GET /v1/files/{file_id}` | API key | 200, 401, 404 |
| `DELETE /v1/files/{file_id}` | API key | 200, 401, 404 |
| `GET /v1/files/{file_id}/content` | API key | 200, 401, 404 |
| `GET /v1/files/{path}` | none, the path itself | 200, 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:

| Field | Meaning |
| --- | --- |
| `id` | file- and 24 hex characters. |
| `object` | Always file. |
| `bytes` | Size of the file. |
| `created_at` | Upload time, Unix seconds. |
| `expires_at` | Thirty days after upload, Unix seconds. |
| `filename` | The name it was uploaded with. |
| `purpose` | batch for an input, batch_output for a file a batch wrote. |
| `status` | processed 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

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

To run an uploaded file, go on to [Batches](https://pentestllm.ai/docs/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.

## Read next

- [MCP servers](https://pentestllm.ai/docs/mcp-servers)
- [Log export](https://pentestllm.ai/docs/exports)
- [Invoices](https://pentestllm.ai/docs/invoices)
- [Billing details](https://pentestllm.ai/docs/billing-details)
- [Statement signing key](https://pentestllm.ai/docs/statements-public-key)
- [Keys and scopes](https://pentestllm.ai/docs/keys)
- [Usage and signed receipts](https://pentestllm.ai/docs/usage-and-receipts)
- [Spend limits and balance](https://pentestllm.ai/docs/spend-limits)
- [Redaction and guardrails](https://pentestllm.ai/docs/redaction-and-guardrails)
- [Sessions](https://pentestllm.ai/docs/sessions)
- [Embeddings, rerank and moderation](https://pentestllm.ai/docs/retrieval-and-moderation)
- [Batches](https://pentestllm.ai/docs/batches)
- [Status and proof feeds](https://pentestllm.ai/docs/status-and-proof)
- [Count tokens](https://pentestllm.ai/docs/count-tokens)
- [Usage by app](https://pentestllm.ai/docs/stats-apps)
- [App sign-in keys](https://pentestllm.ai/docs/auth-keys)
- [Webhook deliveries](https://pentestllm.ai/docs/webhooks-deliveries)
- [Docs: connect in two minutes](https://pentestllm.ai/docs)
- [Endpoints](https://pentestllm.ai/features/endpoints)
- [Files and redaction](https://pentestllm.ai/features/files-and-redaction)
