1. readfetch
  2. choose
  3. /v1/pdf

Data · Documents and structure

POST/v1/pdf

Documents, not pages: page text plus one Markdown body, priced per document rather than per page.

  • $0.005/document
  • per document
  • 200 pages

What it does

Extract text from a PDF (%PDF- magic, not Content-Type). Send exactly one of `url` (public http(s) link — egress GET, ≤ 20 MB) or `content_base64` (bytes you already have — the whole request body is capped at 1 MiB, base64 expansion included; optional `filename` labels the upload). Returns `pages` (per-page text), one concatenated `markdown` body, `title`, and `metadata`; $0.005 per document, not per page. `max_pages` limits extraction (default 50, max 200); documents over 200 pages or above your cap return 413 and are not billed. Scanned/image-only PDFs may return empty text with `billed: false` and a `hint`. Prefer readfetch_text or readfetch_scrape for HTML articles; readfetch_fetch for raw PDF bytes without extraction; readfetch_batch for many HTML URLs, not PDFs. Read-only server-side; paid x402 like other routes.

Price

Quoted by the 402 before anything runs.

  • $0.005/documentper document
  • billedonly when content is delivered
  • no keythe payment is the credential

When to call it

Cheapest endpoint that answers the question, first.

Call it when the sentence above is the whole job. Its neighbours solve the same URL with a different trade-off — a browser instead of plain HTTP, a site instead of one page, one section instead of a document. /choose walks the decision, cheapest first, browser last.

Unsure whether another URL is worth paying for at all? /v1/probe is free: metadata plus the full extracted text on the first 3 probes per IP per day (a ~400-character preview after that) before you pay for a priced route.

Request fields

JSON body shape for POST /v1/pdf — use with the client snippets below, not as a bare POST.

FieldTypeDefaultWhat it does
urlstring—Public PDF URL; fetched through egress (≤ 20 MB). Mutually exclusive with content_base64.
content_base64string—Base64-encoded PDF bytes. The request body is capped at 1 MiB total — base64 expansion comes out of that, it does not add to it (~0.75 MB of PDF). Mutually exclusive with url; pair with filename when the label matters.
filenamestring—Optional label when using content_base64 (default upload.pdf); ignored for url-only requests.
max_pagesnumber50Extract at most this many pages. Default 50; raise up to 200 when the document is longer. Over cap → 413, unbilled.

Make the call

Unpaid REST stops at 402. Use readfetch-client, @readfetch/client, or MCP @readfetch/mcp-x402-proxy — they sign x402 and retry. The JSON below is the argument shape for call() / route helpers.

example body
{
  "url": "https://example.com"
}

readfetch-client / @readfetch/client (latest+) handle x402 on paid routes — full API on /integrations#clients.

python
# pip install readfetch-client
# export EVM_PRIVATE_KEY=0x…
import asyncio
from readfetch_client import readfetch_pdf

async def main():
    data = await readfetch_pdf("https://example.com")

asyncio.run(main())
javascript
// npm install @readfetch/client
// export EVM_PRIVATE_KEY=0x…
import { readfetchPdf } from "@readfetch/client";

const data = await readfetchPdf("https://example.com");

Response

Fields shown are the ones a caller branches on.

200 ok
{
  "billed": true,
  "content_sha256": "...",
  "hint": null,
  "markdown": "# Title\n\n...",
  "metadata": {
    "author": "...",
    "created": "2026-01-04",
    "producer": "..."
  },
  "page_count": 12,
  "pages": [
    {
      "page": 1,
      "text": "..."
    }
  ],
  "source": "https://example.com/report.pdf",
  "status": "success",
  "title": "Annual Report"
}

Limits

Requests are JSON, 1 MiB maximum. Redirects are re-validated at every hop and capped at 5; the final URL is reported. Every call runs on one whole-call budget — DNS, connect, redirects, retries and any render share that clock, and no step starts a fresh timer. Where the endpoint publishes a timeout_s, its default and ceiling are the whole-call budget in the strip above. A budget that expires mid-walk returns status: "partial", and nothing is charged for what was not delivered.

Failures come back as {"error": "…", "hint": "…"} with a status to branch on. Shapes: /docs#errors.

Billing

$0.005 per delivered document. A response with billed: false settles nothing and names the next call to try.

billed: false on 200 usually means no extractable text (for example a scan-only PDF). 502/504 settle nothing.

RECEIPT, claims, and billing rules: /docs#billing.

Settlement, receipts and claims: /docs.