Documentation /docs/files-page-images

Files & Page Images

Upload returns reusable file references. Use file metadata and page-image endpoints to inspect stored files and render source pages in your own review UI.

Endpoints

  • POST /api/v1/upload: upload one or more files under repeated multipart field files
  • GET /v1/files/{file_id}: fetch file metadata
  • GET /v1/files/{file_id}/pages/{page_index}/image: fetch a rendered source page image by zero-based page index

cURL

FILE_ID=$(
  curl -sS -X POST "https://api.docspeed.ai/api/v1/upload" \
    -H "Authorization: Bearer ${DOCSPEED_API_KEY}" \
    -F "files=@sample-invoice.pdf" | jq -r '.files[0].file_id'
)

curl -sS \
  -H "Authorization: Bearer ${DOCSPEED_API_KEY}" \
  "https://api.docspeed.ai/v1/files/${FILE_ID}"

curl -sS \
  -H "Authorization: Bearer ${DOCSPEED_API_KEY}" \
  "https://api.docspeed.ai/v1/files/${FILE_ID}/pages/0/image" \
  -o page-0.png

Python

import requests

headers = {"Authorization": "Bearer YOUR_API_KEY"}

metadata = requests.get(
    "https://api.docspeed.ai/v1/files/file_123",
    headers=headers,
    timeout=60,
)
metadata.raise_for_status()
print(metadata.json())

image = requests.get(
    "https://api.docspeed.ai/v1/files/file_123/pages/0/image",
    headers=headers,
    timeout=120,
)
image.raise_for_status()
open("page-0.png", "wb").write(image.content)

TypeScript

const headers = { Authorization: "Bearer YOUR_API_KEY" };

const metadata = await fetch("https://api.docspeed.ai/v1/files/file_123", { headers });
console.log(await metadata.json());

const pageImage = await fetch("https://api.docspeed.ai/v1/files/file_123/pages/0/image", { headers });
const bytes = new Uint8Array(await pageImage.arrayBuffer());
console.log(bytes.byteLength);

Example metadata

{
  "file_id": "file_123",
  "filename": "sample-invoice.pdf",
  "content_type": "application/pdf",
  "size_bytes": 245812,
  "page_count": 3,
  "created_at": 1776054000.0
}

Production notes

  • Store the returned file_id with your own workflow record.
  • Use zero-based page_index values for page images.
  • Page images are source-rendering helpers; structured data should still come from Parse, OCR, Layout, Tables, Extract, Ask, Compare, or Synthesize responses.