Files

Upload, download, and reuse tenant-scoped input files.

The file pool stores PDF, PNG, and JPEG inputs for reuse across parse and extract requests. Upload once with POST /files, then pass the returned file_id in admission request JSON instead of attaching bytes on every call.

Pool uploads accept up to 100 MiB. Direct inline multipart uploads on parse/extract admission are limited to 50 MiB. Field definitions live in the Files API reference.

Upload a file

POST /files accepts multipart/form-data with a single file part and returns metadata including the reusable id.

curl -X POST 'https://api.openparser.dev/files' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -F 'file=@./contract.pdf'
openparser files upload ./contract.pdf --json
const uploaded = await client.files.upload(file);
console.log(uploaded.id);
from pathlib import Path

uploaded = client.files.upload(Path("contract.pdf"))
print(uploaded.id)

Get file metadata

GET /files/{id} returns filename, size, and content type for a tenant-owned file. Missing or cross-tenant ids return 404 file_not_found.

curl -s 'https://api.openparser.dev/files/FILE_ID' \
  -H 'Authorization: Bearer YOUR_API_KEY'
openparser files get FILE_ID --json
const metadata = await client.files.get('FILE_ID');
metadata = client.files.get("FILE_ID")

Download file bytes

GET /files/{id}/content streams the stored bytes.

curl -s 'https://api.openparser.dev/files/FILE_ID/content' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -o ./contract.pdf
openparser files download FILE_ID -o ./contract.pdf
const blob = await client.files.download('FILE_ID');
const bytes = Buffer.from(await blob.arrayBuffer());
content = client.files.download("FILE_ID")

Delete a file

DELETE /files/{id} removes the file from your pool. Later admissions that reference the id return 404 file_not_found.

curl -X DELETE 'https://api.openparser.dev/files/FILE_ID' \
  -H 'Authorization: Bearer YOUR_API_KEY'
openparser files delete FILE_ID --json
await client.files.delete('FILE_ID');
client.files.delete("FILE_ID")

Reuse file_id on admission

Set file_id in the JSON request part of parse or extract admission. Omit the multipart file field when file_id is present. The same id works across multiple jobs until you delete it.

curl -X POST 'https://api.openparser.dev/parse' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H "Idempotency-Key: $(uuidgen 2>/dev/null || openssl rand -hex 16)" \
  -F 'request={"ocr_model":"paddleocr-vl-1.6","file_id":"FILE_ID","output_format":"openparser@1"};type=application/json'
openparser parse sync --file-id FILE_ID --json
openparser extract async --file-id FILE_ID --pipeline-id oppl_... --json
await client.parse.sync({
  ocr_model: 'paddleocr-vl-1.6',
  file_id: 'FILE_ID',
  output_format: 'openparser@1',
});
client.parse.sync({
    "ocr_model": "paddleocr-vl-1.6",
    "file_id": "FILE_ID",
    "output_format": "openparser@1",
})

Batch items can reference file_id per child instead of file_index when no inline files are uploaded.

On this page