Skip to main content
/pdf/index returns a compact map of the PDF (~5-15KB JSON) without extracting Markdown. Intended for AI agents / RAG who need to navigate large documents without paying the cost (tokens + time) of converting the entire document. The correct flow is:
  1. Client calls /pdf/index -> receives the spine with sections[] and pages[].
  2. Client/agent decides which pages interest them.
  3. Client calls /convert/from-url with pages="47-58" to obtain Markdown only from those pages.
Result: a 500-page PDF is navigated with 5KB of spine + 30KB of the requested chunk, instead of 10MB of full Markdown. The IA agent pays 20-30x fewer tokens to LLM, and the backend pulls 400x fewer pages.

When to use

  • IA agent / RAG that searches for specific information in large PDFs.
  • Legal / academic / financial documents with well-defined sections.
  • “Preview” type UI where the user navigates before downloading.
  • Pre-vavalidation of PDF (page count, format) without conversion cost.

When NOT to use

  • Small PDFs (<10 pages): the fixed cost of the spine is not worth it, use /convert/raw or direct /convert/from-url.
  • Client who DOES want the complete Markdown: skip the index and request /convert/from-url without pages.
##Request
string
required
URL GET presigned from PDF in your storage (S3, R2, Supabase, GCS, Azure Blob).
string
default:"document.pdf"
Logical name only for logs.

Response

Spine fields

Full flow example (IA agent)

Cost and performance

  • Typical latency: 300-700ms for PDFs up to 512MB (sample of 32 pages + head of each one).
  • Server cost: constant with respect to the size of PDF (does not scale with pages).
  • AI client cost: spine ~1.5K-4K tokens vs full Markdown 50K-300K tokens.

Limitations v1

  • pages[] truncated to 200 entries (configurable via PDF_SPINE_MAX_PAGE_ENTRIES). For documents >200 pages, use sections[] as a navigation map.
  • Table detection not included v1. Only headings + body chars. -Without server cache: the client keeps the spine. Repeat /pdf/index re-download and re-process.

Security

  • Same anti-SSRF as /convert/from-url: only HTTPS, public hosts.
  • PDF header vavalidation and MAX_PDF_PAGES enforce.
  • API key + credit (tier=index, fixed cost 1 credit per call).
  • No PDFs or spine are saved on the server.
See also: POST /convert/from-url, Modes, Compression.