Overview
Thedoc() URL builder generates immutable, CDN-cacheable URLs for every document property. URLs are constructed at build time with zero API calls — use them directly in <img>, <a>, or any HTML attribute.
Think Cloudinary for images, but for documents.
Quick start
doc() accepts canonical IDs (ocr-*) and short public aliases (d_*) when available.
All generated URLs
For a documentocr-7fK3x, the builder generates:
| Property | URL |
|---|---|
| Document | https://api.okrapdf.com/v1/documents/ocr-7fK3x |
| Thumbnail | https://api.okrapdf.com/v1/documents/ocr-7fK3x/thumbnail |
| Page 0 | https://api.okrapdf.com/v1/documents/ocr-7fK3x/pages/0 |
| Page 0 Image | https://api.okrapdf.com/v1/documents/ocr-7fK3x/pages/0/image |
| Page 0 Markdown | https://api.okrapdf.com/v1/documents/ocr-7fK3x/pages/0/markdown |
| All Tables | https://api.okrapdf.com/v1/documents/ocr-7fK3x/entities/tables |
| Table 0 (JSON) | https://api.okrapdf.com/v1/documents/ocr-7fK3x/entities/tables/0 |
| Table 0 (CSV) | https://api.okrapdf.com/v1/documents/ocr-7fK3x/entities/tables/0?format=csv |
| All Figures | https://api.okrapdf.com/v1/documents/ocr-7fK3x/entities/figures |
Use in React / JSX
Use as og:image
PDF lead magnet landing page
Upload a whitepaper, get a landing page with zero backend work:Provider transformations
Like Cloudinary’s/w_300/image.jpg, OkraPDF uses /t_{provider}/ to select the extraction backend. Same document, different output:
Artifact slugs
WhenfileName is provided, URLs get cache-friendly, human-readable suffixes:
Browser usage
Use the URL builder in browser code without Node.js:doc() — no Node.js dependencies. For data fetching in the browser, use the generated URLs with fetch() directly.
Custom base URL
For self-hosted deployments:Private vs public URLs
URLs always resolve to the same path. Access depends on whether the document is published:- Private (default): URLs return 404 without API key
- Published: URLs are publicly accessible, CDN-cacheable
App reader URL (unchanged)
If you’re linking to Okra’s hosted reader UI, keep using:https://app.okrapdf.com/ocr/{canonicalId}/reader