Endpoints
Supported file types
All Lens endpoints accept the following file types:Limits
OCR
Extract text from a document. Returns the document content as Markdown.Output formats
Page selection
For PDF files withmd output format, you can optionally select specific pages using the pages parameter:
"3"— single page"2-5"— page range (inclusive)"10-"— from page 10 to end
pages is omitted, all pages are processed.
Example request
Example result
Cost
Plainmd output costs 2 credits per processed page. Document recovery
to mdd or json costs 18 credits per processed page. For DOCX, ODT,
and Markdown files, plain Markdown extraction is counted as one page.
Generate Filename
Generate a structured filename for a document based on a naming schema with placeholders. The AI reads the document and fills in the placeholder values.Request
Example result
unknown.
Cost
6 credits per request. For PDFs, only the first three pages are sent to OCR.Classify
Classify a document into one of the provided categories. The AI reads the first 3 pages of the document and picks the best matching category.Request
Example result
Result fields
Edge cases
- Empty document: Returns the first category with
confidence: 0and a message indicating the document is empty. - No clear match: The closest category is returned with a low confidence score.
- The AI will never invent new categories — it always picks from the provided list.
Cost
6 credits per request. For PDFs, only the first three pages are sent to OCR.Extract
Extract structured data from a document based on a user-defined field schema. Define field names, types, and optional descriptions. The AI reads the document and returns a JSON object with the extracted values.Request
Field types
Adding a
description to a field helps the AI understand what to look for and significantly improves extraction accuracy.
Example result
Result fields
Edge cases
- Field not found: The field is set to
nulland its name is added tofieldsMissing. - Empty document: All fields are returned as
nulland all field names appear infieldsMissing. - PDF exceeds 50 pages: Only the first 50 pages are processed when no
pagesparameter is specified.
Cost
14 credits per page processed. For DOCX, ODT, and Markdown files, cost is 14 credits (counted as one page).General workflow
All Lens endpoints follow the same async job pattern:1. Upload the document
2. Create a Lens job
3. Poll for completion
status is COMPLETED or FAILED. Alternatively, use a webhook to receive a notification when the job finishes.
4. Read the result
The result is returned directly in the job response under theresult field — there is no separate file to download. This applies to all Lens endpoints.
Unlike PDF tool jobs (merge, split, etc.), Lens jobs return structured data in the
result field instead of producing an output file. You do not need to call the download endpoint.