# PDF to Markdown API with page and table structure

Canonical URL: https://webcite.co/pdf-to-markdown-api | Last updated: 2026-11-25

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.

## 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.

```bash
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.

```json
{
  "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](https://webcite.co/samples/doc-irs-w9.json) and [the PDF that was read](https://webcite.co/samples/irs-form-w9-page-1.pdf). The [extract endpoint reference](https://webcite.co/api-docs/extract) lists every field.

## With the TypeScript SDK

The [TypeScript SDK](https://www.npmjs.com/package/webcite) 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`.

```bash
npm install webcite
npx webcite extract report.pdf > report.md
```

```typescript
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);
}
```

```text
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](https://webcite.co/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](https://webcite.co/api-docs/chunks).

```bash
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

| Mode | Typical credits a page | Use it for |
| --- | --- | --- |
| Lite | 0.05 to 0.23 | High-volume plain documents |
| Standard | About 0.74 | Complex 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](https://webcite.co/api-docs/extraction#cost), and [PDF to Markdown API pricing compared](https://webcite.co/blog/pdf-markdown-api-pricing-compared/) for other providers.

## Benchmark result

In its own full run, Webcite scored 91.74 overall on [ParseBench 2](https://webcite.co/benchmarks), 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](https://webcite.co/api-docs/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](https://webcite.co/fact-check-api): check a claim from the document against outside sources and get a verdict with quotes.
- [Citation API](https://webcite.co/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](https://webcite.co/tools/pdf-to-markdown) without an account. Forms, charts and the full list of inputs are on the [document parsing API](https://webcite.co/document-parsing-api) page. To convert your own files, create an account; the Free plan includes 100 credits.

[Create a free account](https://webcite.co/signup)
