Skip to content

Introduction

Deskew is a document-extraction API. You send one file to POST /v1/extract and get back clean Markdown, plain text or structured JSON with blocks, tables and key-value fields. It handles born-digital PDFs, scanned PDFs, photos and images, Word, Excel, CSV and PowerPoint files, HTML, plain text and email (.eml / .msg, including attachments).

You do not pick an OCR model. Deskew detects the file type from its bytes, classifies every page as digital or scanned, and routes each page to the cheapest engine that will read it correctly. Scanned pages are deskewed and scored for quality before OCR, validated afterwards, and retried or escalated when the output looks wrong. The engine used for every page is reported back to you.

Terminal window
curl https://api.deskew.dev/v1/extract \
-H "Authorization: Bearer $DESKEW_API_KEY" \
-F "file=@invoice.pdf" \
-F "output=json"

A small document is processed while the request is open and answered with 200 and the result object:

{
"id": "job_01JE4K9QW2M3N4P5Q6R7S8T9V0",
"status": "completed",
"pages": 2,
"markdown": "# Invoice 2024-0193\n\n| Item | Qty | Amount |\n|---|---|---|\n| Design work | 12 h | 1,440.00 |\n...",
"text": "Invoice 2024-0193 ...",
"blocks": [
{ "type": "heading", "page": 1, "text": "Invoice 2024-0193", "level": 1, "confidence": 1.0 }
],
"tables": [
{
"page": 1,
"n_rows": 3,
"n_cols": 3,
"rows": [["Item", "Qty", "Amount"], ["Design work", "12 h", "1,440.00"], ["Total", "", "1,440.00"]],
"csv": "Item,Qty,Amount\nDesign work,12 h,\"1,440.00\"\nTotal,,\"1,440.00\"",
"markdown": "| Item | Qty | Amount |\n|---|---|---|\n..."
}
],
"page_results": [
{ "page": 1, "kind": "digital", "engine": "text-layer", "confidence": 1.0, "duration_ms": 142, "credits": 1, "low_confidence": false },
{ "page": 2, "kind": "scanned", "engine": "deskew-ocr", "confidence": 0.94, "quality_score": 0.81, "duration_ms": 3860, "credits": 1, "low_confidence": false }
],
"usage": { "pages": 2, "credits": 2, "premium_credits": 0, "engines": { "text-layer": 1, "deskew-ocr": 1 } },
"warnings": []
}

Larger documents are queued and answered with 202 and a job you poll or receive a webhook for. The rule that decides between the two is explained in Concepts.