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

Data · Documents and structure

POST/v1/section

Read one heading or one selector instead of the whole page - ten to a hundred times fewer tokens.

  • $0.003
  • headings
  • selector

What it does

Extract one heading or one CSS selector from a public page instead of the whole document. Returns matched Markdown or text, title, chars, content_sha256, and billed. If the heading is missing, returns HTTP 200 with empty text and `available_headings` so you can retry. `mode`: fast (plain HTTP) or render (default, Chromium when the page blocks HTTP). `max_chars` truncates output (default 8000, max 20000). Prefer readfetch_text for full articles; readfetch_scrape when content needs JavaScript.

Price

Quoted by the 402 before anything runs.

  • $0.003per call
  • 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/section — use with the client snippets below, not as a bare POST.

FieldTypeDefaultWhat it does
url requiredstring—Public page URL to extract from.
headingstring—Heading text to match (case-insensitive, whitespace-normalised). Required unless selector is set — send exactly one of heading or selector, not both.
selectorstring—CSS selector; up to 20 matches concatenated. Required unless heading is set — use selector when the section has no stable heading text.
modestringrenderfast = HTTP-first; render = one browser pass when plain HTTP fails (default).
formatstringmarkdownOutput flavour for the matched section (markdown default).
max_charsnumber8000Truncate matched text after this many characters.

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_section

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

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

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

Response

Fields shown are the ones a caller branches on.

200 ok
{
  "available_headings": [
    "Intro",
    "Authentication",
    "Rate limits"
  ],
  "billed": true,
  "chars": 1204,
  "content_sha256": "...",
  "hint": null,
  "matched": {
    "kind": "heading",
    "label": "Authentication",
    "level": 2
  },
  "status": "success",
  "status_code": 200,
  "text": "## Authentication\n\n...",
  "title": "API",
  "url": "https://docs.example.com/api",
  "used_browser": false
}

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.003 per delivered call. A response with billed: false settles nothing and names the next call to try.

billed: false on 200 usually means an empty selector match, bot wall, or wrong content type. 502/504 settle nothing.

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

Settlement, receipts and claims: /docs.