/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:
- Client calls
/pdf/index-> receives the spine withsections[]andpages[]. - Client/agent decides which pages interest them.
- Client calls
/convert/from-urlwithpages="47-58"to obtain Markdown only from those pages.
When to use
When NOT to use
##Requeststring
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 viaPDF_SPINE_MAX_PAGE_ENTRIES). For documents >200 pages, usesections[]as a navigation map.- Table detection not included v1. Only headings + body chars.
-Without server cache: the client keeps the spine. Repeat
/pdf/indexre-download and re-process.
Security
- Same anti-SSRF as
/convert/from-url: only HTTPS, public hosts. - PDF header vavalidation and
MAX_PDF_PAGESenforce. - API key + credit (
tier=index, fixed cost 1 credit per call). - No PDFs or spine are saved on the server.
