PDF to Markdown API with page and table structure

Webcite converts a PDF, scan or image to Markdown with one request to POST /api/v1/extract: markdown holds the whole document and units has one entry per page, with typed elements and their positions. Tables come back as HTML inside the Markdown. A typical standard page costs about 0.74 credits.

Last updated

Request

Upload the file, then extract it with the returned data.asset_id. The request returns when every page is read; there is no job to poll.

curl --fail-with-body -X POST https://api.webcite.co/api/v1/upload \
  -H "x-api-key: $WEBCITE_API_KEY" \
  -F "file=@./report.pdf"

curl --fail-with-body --max-time 900 -X POST https://api.webcite.co/api/v1/extract \
  -H "x-api-key: $WEBCITE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"asset_id":"YOUR_ASSET_ID","mode":"standard"}'

Response

The saved response for page 1 of IRS Form W-9, recorded on 24 November 2026. markdown is cut at 120 characters and two of the page's 45 elements are shown; no value is changed.

{
  "format": "pdf",
  "markdown": "Form **W-9**  \n(Rev. March 2024)  \nDepartment of the Treasury  \nInternal Revenue Service\n\n# Request for Taxpayer Identif...",
  "units": [
    {
      "kind": "page",
      "index": 1,
      "provenance": {
        "page": 1
      },
      "extraction_method": "ocr",
      "reader": {
        "page_type": "form"
      },
      "geometry": {
        "coordinateSystem": "normalized-top-left-v1",
        "width": 611.976,
        "height": 791.968,
        "rotation": 0
      },
      "elements": [
        {
          "type": "title",
          "markdown": "# Request for Taxpayer Identification Number and Certification",
          "bbox": [
            0.30102168495309733,
            0.04781959115681964,
            0.6993639285090649,
            0.08171085992110318
          ]
        },
        {
          "type": "text",
          "markdown": "**Go to *www.irs.gov/FormW9* for instructions and the latest information.**",
          "bbox": [
            0.2808420826304612,
            0.09019152900609942,
            0.7189029945298423,
            0.10099802622217478
          ]
        }
      ]
    }
  ],
  "state": "complete",
  "usage": {
    "credits": 0.4966,
    "pages": 1,
    "page_charges": [
      {
        "page": 1,
        "page_type": "form",
        "credits": 0.4966
      }
    ]
  }
}

A bbox is [x0, y0, x1, y1] as fractions of the page from the top left. Check state before using markdown: partial lists the pages that were not fully read in lost. The full saved response and the PDF that was read. The extract endpoint reference lists every field.

With the TypeScript SDK

The TypeScript SDK wraps the same calls: npm install webcite installs it, and npx webcite runs its command line tool. It reads the key from WEBCITE_API_KEY.

npm install webcite
npx webcite extract report.pdf > report.md
import { readFile } from "node:fs/promises";
import { Webcite } from "webcite";

const client = new Webcite();
const bytes = new Uint8Array(await readFile("irs-form-w9-page-1.pdf"));
const { data } = await client.upload(bytes, { filename: "irs-form-w9-page-1.pdf" });
const doc = await client.extract({ asset_id: data.asset_id, mode: "standard" });
for (const unit of doc.units ?? []) {
  console.log(unit.index, unit.reader?.page_type, unit.elements?.length);
}
1 form 45

The last block is the output for the saved W-9 response.

Scanned pages and images

  • Each PDF page is read from its rendered image, so a scan with no text layer reads the same way as a digital page. The unit's reader.page_type is scan.
  • JPEG and PNG files are read as one-page documents.
  • When a page's text layer does not carry the printed text, the unit lists unmapped or garbled in image_input. In lite mode, an invisible OCR layer under a scan is listed as hidden.

Tables

Tables are HTML inside the Markdown, so merged header cells survive as rowspan and colspan. The table extraction API page shows a saved statistics table with two header rows.

Chunks for retrieval

POST /api/v1/extract/pages returns the same read as chunks, each with a zero-based ordinal, text, a token_estimate and its page, sheet or section anchor. Keep the anchors when you index, so an answer can cite the page. It is charged like extraction. Anchored chunks reference.

curl --fail-with-body --max-time 900 -X POST https://api.webcite.co/api/v1/extract/pages \
  -H "x-api-key: $WEBCITE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"asset_id":"YOUR_ASSET_ID","mode":"standard"}'

Modes and cost

Extraction modes and typical cost a page
ModeTypical credits a pageUse it for
Lite0.05 to 0.23High-volume plain documents
StandardAbout 0.74Complex tables, handwriting and scans

A request without mode reads in lite for accounts created on or after 20 November 2026. Uploading is free, a page that cannot be read is not charged, and one page is never charged more than 10 credits. From 1 December 2026 the average standard page costs about 1.27 credits. What a document costs, and PDF to Markdown API pricing compared for other providers.

Benchmark result

In its own full run, Webcite scored 91.74 overall on ParseBench 2, the public document parsing benchmark.

Limits

  • Files up to 100 MB. PDF, JPEG and PNG pages are read with layout elements; spreadsheets, DOCX, PPTX, HTML and text files are read from the file itself and cost 0 credits.
  • Extraction counts at half of your plan's request limits: 25 a minute and 250 a day on Free.
  • Set a client timeout of several minutes; a page read from its image usually takes tens of seconds.

After the conversion: check and cite

  • Check quotes in a batch: pass the same asset_id and a page, and each quote comes back with whether it was found in that source, for 1 credit a quote.
  • Fact-check API: check a claim from the document against outside sources and get a verdict with quotes.
  • Citation API: tie each answer to the exact quote, page or spreadsheet cell.

Try it

Open the saved conversions in the PDF to Markdown converter without an account. Forms, charts and the full list of inputs are on the document parsing API page. To convert your own files, create an account; the Free plan includes 100 credits.

Create a free account