Thanks to visit codestin.com
Credit goes to docs.context.dev

Skip to main content
Use POST /parse to turn a file into Markdown for search, document review, or an LLM. Send raw bytes from an upload or storage bucket; the file does not need a public URL. The upload limit is 25 MiB. Each successful conversion costs 1 credit, plus 1 credit per PDF page recovered by OCR when enabled.

Prerequisites

Create an API key in the dashboard and export it on your server:

Convert a file to Markdown

Send the file itself as the request body, without multipart encoding or JSON. --data-binary preserves its bytes:
The request stays open until conversion finishes, then returns JSON:
Context.dev detects the type from the file contents. The returned type can differ from your hint: .xlsm reports xlsx, .ppsx reports pptx, and .jpeg reports jpg.

Supported formats

Standalone image files return metadata, not OCR text. OCR is available for PDF pages without a usable text layer. See the Parse API reference for the complete extension list.

Read PDFs with OCR

OCR is off by default. Without OCR, PDFs are converted from their selectable text layer. A scanned PDF that paints images but has no selectable text returns a 400 PDF_IMAGES_ONLY response telling you the content is recoverable — retry with ocr=true. With ocr=true, Context.dev recovers selected pages that lack a usable text layer. Pages with readable text keep their existing text; this is not a general image-reading pass over every chart or screenshot. Use a page range to convert only the pages you need:
In the URL above, pdf%5Bstart%5D and pdf%5Bend%5D are the URL-encoded forms of pdf[start] and pdf[end]. You can also send pdf as a URL-encoded JSON object such as {"start":1,"end":5}. OCR adds 1 credit per page it recovers. If OCR contributes no text, a successful conversion costs only the base credit. Failed parsing and validation requests consume 0 credits. Read key_metadata.credits_consumed for the actual charge. OCR can return partial recovery when a file reaches processing limits. Check the output before treating a document as complete, and use smaller files or page ranges for large scans. Zero data retention requests skip OCR and use the existing text layer in the PDF.

Control the output

All parsing options are query parameters. Send the file’s Content-Type when known, especially for non-UTF-8 text. Relative links and image paths stay relative because the file has no source URL. Unrecognized query parameters and repeated scalar parameters return 400.

Convert a spreadsheet or document

Point --data-binary at any supported file and pass its extension when useful. Excel workbooks become one Markdown table per non-empty sheet. DOCX files preserve headings, lists, and tables, while legacy DOC files return paragraph text.

Handle errors

Error responses include an error_code that distinguishes invalid input from files with no extractable content.

Add document parsing to your app

Next steps

Build a PDF research workflow that keeps source identity, checks citations against retrieved text, and exposes incomplete evidence.

Scrape a webpage

Convert a public URL into Markdown.

Extract structured data

Pull schema-shaped data out of websites and linked documents.

Parse reference

Complete format list, options, and response schema.

Rate limits

Backoff strategies and pacing for high-volume jobs.