Skip to content
Documentation/Documents

Extraction quickstart

Upload a file, read it page by page, and see what the read cost.

Last updated

Markdown

Get an API key

Sign up at webcite.co, then create a key on the API Keys page. A new account starts on the Free plan with 100 credits, renewed every 30 days while credits remain. Keep the key in an environment variable on your server.

bash
export WEBCITE_API_KEY="YOUR_API_KEY"

What a document costs

CallCredits
Upload a file0, uploading is free
ExtractMetered: what the page reads cost, about 0.05 to 0.23 a page in lite, about 0.74 a page in standard

Extraction is charged at cost. Lite mode is the faster, lower-cost read and mode: "standard" the higher-accuracy read. A request without mode reads in lite for an account created on or after 20 November 2026 (04:00 UTC). An account created before then keeps standard as its default, with the same price, estimate and response as before, and can send mode: "lite" to opt in. In standard mode each PDF page or image is read the way best suited to its kind of page, and you are charged what those reads cost at list price, converted at $0.04 a credit. A retry or a second reader on a hard page adds to that page's cost. One page is never charged more than 10 credits ($0.40).

Lite cost by page type, measured at cost on the full benchmark run:

page_typeLite, creditsLite, cents
dense0.22800.912
scan0.14200.568
chart0.13880.555
form0.13600.544
table0.07930.317
complex_text0.06030.241
plain_text0.05300.212

Standard cost by kind of page, measured on 4,317 pages at list price:

PageStandard, credits (cents)
Headings0.28 (1.1)
Plain text0.38 (1.5)
Forms0.65 (2.6)
Mixed layout0.65 (2.6)
Tables0.68 (2.7)
Charts0.68 (2.7)
Dense tables2.15 (8.6)
Average of all pages0.74 (2.95)

What a standard document typically costs:

DocumentCreditsDollars
1 page0.74$0.03
10 pages7.4$0.30
100 pages74$2.95

A page that cannot be read is free. Spreadsheets, DOCX, PPTX, HTML and text files cost 0 credits, because they are read from the file itself.

To read the receipt: usage.credits is the charge, usage.pages is the number of pages charged, and usage.page_charges lists each page with its page_type and credits.

One reader's list price doubles on 1 December 2026. From that date the average standard page costs about 1.27 credits (5.1 cents) and dense tables cost more.

The Free plan's 100 credits read about 135 typical pages a month in standard, and more in lite. Builder includes 500 credits a month and, with overage switched on in your account, continues at $0.04 per credit. See pricing and credits and billing.

Lite mode

Lite is the faster, lower-cost read of every PDF page and image on Extract and anchored chunks; standard is the higher-accuracy read. A request without mode reads in lite for an account created on or after 20 November 2026 (04:00 UTC). An account created before then keeps standard as its default, with the same price, estimate and response as before, and can send mode: "lite" to opt in. Either mode can always be sent explicitly.

bash
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"}'

Lite keeps every deterministic step of standard: the page's own text layer and drawing check the reading, long tables are read again in row bands, chart values are measured from the drawing, form and table rules apply, and the layout detector and the per-page read budget work as before. A page whose text layer is broken is read from its rendered image. Lite also reads a page with a hidden OCR layer (an invisible text layer under a scan) from its rendered image and lists hidden in that unit's image_input.

Standard adds three steps that lite skips: each page type gets the read best suited to it, form pages are read a second time, and a failed read is tried a second way. A page that lite cannot read after its retry keeps its text layer or is reported in state and lost, and it is not charged.

Standard is more accurate on complex tables (multi-level headers, dense tables), handwriting and scans. Use lite for high-volume plain documents and standard for those. The cost table shows both modes.

Every unit of a lite read carries mode: "lite", and an anchored chunks response read in lite carries mode: "lite" at the top level. A standard response is unchanged. reader.page_type still names the kind of page on visually read pages, and usage.page_charges lists each page with its page_type and credits as in standard. The balance check before the read uses the page count at 0.12 credits a page in lite and 0.75 credits a page in standard. The charge afterwards is metered at cost, at $0.04 a credit.

A lite read and a standard read of the same file are kept apart: a lite request is never answered from a standard read, nor the reverse. refresh: true works the same in both modes.

A visual rendition is read in standard: visual_rendition: true without mode reads in standard, and mode: "lite" with visual_rendition: true returns 400.

Upload and extract with curl

Upload the file. The response holds the asset ID in data.asset_id.

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"

Extract it. The request returns when every page has been read, so allow a long timeout.

bash
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"}'

The same in Python

This script uploads report.pdf, extracts it, and prints the state, the charge, the remaining balance, and one line per page. It uses the requests package.

python
import os
import requests

API = "https://api.webcite.co/api/v1"
HEADERS = {"x-api-key": os.environ["WEBCITE_API_KEY"]}

with open("report.pdf", "rb") as file:
    upload = requests.post(
        f"{API}/upload", headers=HEADERS, files={"file": file}, timeout=(10, 300)
    )
upload.raise_for_status()
asset_id = upload.json()["data"]["asset_id"]

response = requests.post(
    f"{API}/extract", headers=HEADERS, json={"asset_id": asset_id}, timeout=(10, 900)
)
response.raise_for_status()
document = response.json()

usage = document["credit_usage"]
print(document["state"], usage["credits_used"], usage["credits_remaining"])
for unit in document["units"]:
    page = unit["provenance"].get("page")
    page_type = unit.get("reader", {}).get("page_type")
    print(page, unit["extraction_method"], page_type, len(unit.get("elements", [])))
print(document["markdown"][:500])

Read the result

state is complete, partial, unsupported or error. On partial, lost lists the pages that were not fully read and each of those units carries its own state and reason.

markdown is the whole document. units gives the same content per page with elements: typed blocks such as title, text, table and picture, each with a bounding box. The extract reference describes every field, and how pages are read explains reader. To see how extraction APIs compare on tables, charts and forms, read the best document parsing APIs on ParseBench 2.

Limits and errors

  • 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.
  • Extraction counts at half of your plan's request limits: 25 a minute and 250 a day on Free by default. The extract reference has the table.
  • The cost is known only after the pages are read, so a PDF is first checked against an estimate: its page count at 0.12 credits a page for a lite read or 0.75 credits a page for a standard read. A balance under the estimate returns 400 with a message that starts with Insufficient credits. and gives the credits required and available. No page is read and nothing is charged; Builder accounts with overage switched on continue past the allocation.
  • If the pages cost more than your balance holds, the charge stops at the balance, which never goes below zero.
  • A 429 tells you how long to wait in Retry-After.

See errors and rate limits before adding retries. A PDF or image whose exact content this account read completely in the last 24 hours is answered from that read for 0 credits. Send refresh: true to read it again; the new read is charged as usual.