[Go to site: main page, start]

Skip to main content
Context.dev’s Parse API converts raw file bytes into clean, LLM-ready Markdown. Use it for files your users upload, files in your storage bucket, or anything else your application can read into memory. Unlike web scraping, the file doesn’t need a public URL. Context.dev detects the file type from its contents. You can also send the file’s media type and extension as hints. The response reports the type that was actually detected, which may differ from the hint.

Integrate Context.dev's Parse API in your app

Open in Cursor

Prerequisites

  • A Context.dev API key. Sign up at context.dev/signup, copy the key from the dashboard (prefix ctxt_secret_), and export it:
The endpoint accepts raw bytes over HTTPS, so you can call it from any language. The examples below use curl.

Convert a file to Markdown

Send the file itself as the request body. --data-binary keeps curl from changing the bytes:
cURL
1 credit per successful conversion without OCR output The request stays open while the file is converted; there is nothing to poll.

Request parameters

The request body is required and can contain up to 25 MiB. Send the file’s actual Content-Type header when you know it, especially for text that uses a character encoding other than UTF-8. All parsing options are query parameters:
Query parameters are validated strictly. Unrecognized parameters and repeated scalar parameters return a 400 response.
Because a parsed file has no source URL, relative links and image paths remain relative in the output.

Response

Some extensions share a normalized response type. For example, .xlsm reports xlsx, .ppsx reports pptx, and .jpeg reports jpg.

Read PDFs and images with OCR

OCR is off by default. Without OCR, PDFs are converted from their selectable text layer. A scanned PDF with no selectable text returns a 400 response unless you set ocr=true. With ocr=true, Context.dev can read scanned PDF pages and text inside embedded images such as charts, screenshots, and stamps. Use the nested pdf page range to convert only the pages you need:
cURL
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}. The same ocr=true parameter works for raster images. Without it, an image returns Markdown containing its format and dimensions. With it, the response adds an ## Extracted text section containing text transcribed from the image. Image OCR is text-only — visual content that isn’t text is not described.
Requests with ocr=true require at least 5 available credits. A successful request costs 5 credits only when OCR contributes text; otherwise it costs 1 credit. Failed parsing and validation requests consume 0 credits. Check key_metadata.credits_consumed for the actual charge.

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.
cURL
1 credit per successful conversion

Handle errors

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

Use cases

  • Let users upload a PDF, Word document, or spreadsheet and send the resulting Markdown to an LLM.
  • Normalize a folder of mixed documents, decks, spreadsheets, and images before adding them to a RAG index.
  • Extract text from scanned contracts and invoices without operating a separate OCR service.
  • Turn uploaded images and screenshots into searchable text and descriptions.

Next steps

Scrape Websites

Have a URL instead of a file? Turn any page into clean Markdown.

Extract Structured Data

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

Best Practices

Caching, error handling, and key hygiene.

Handle Rate Limits

Backoff strategies and pacing for high-volume jobs.