Infra · Core
POST/v1/fetch
Raw HTTP through the same egress. JSON APIs, GraphQL, PDFs, byte ranges - anything that is not a page.
- $0.0015
- any method
- base64
What it does
Send an HTTP request (GET, POST, PUT, PATCH, DELETE, HEAD) through egress and return status_code, response headers, and body as text or base64 (`binary: true`). `max_bytes` caps the stored body; `follow_redirects` (default true) and `timeout_s` (95 s ceiling) apply to the full redirect chain. Use `json_body` for JSON POST/PUT payloads; use `body` for raw bytes or strings. Prefer readfetch_text for readable HTML articles; readfetch_pdf to extract PDF text (not raw bytes alone). POST/PUT/DELETE can change remote state despite readOnlyHint.
Price
Quoted by the 402 before anything runs.
- $0.0015per call
- 95 s default, 95 s maximumwhole-call budget
- billedwhen the origin answers (transport ok)
- 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/fetch — use with the client snippets below, not as a bare POST.
| Field | Type | Default | What it does |
|---|---|---|---|
url required | string | — | Request URL (http or https). |
method | string | GET | HTTP method (GET default). |
headers | object | — | Optional request headers, e.g. Authorization or Accept. |
body | string | — | Raw request body string for POST/PUT/PATCH (mutually exclusive with json_body). |
json_body | object | — | JSON object serialized as the request body (Content-Type application/json). |
binary | boolean | false | When true, return body as base64 instead of UTF-8 text. |
follow_redirects | boolean | true | Follow 3xx redirects (default true). |
timeout_s | number | 95 | Total budget for the whole call in seconds, redirect hops included. |
max_bytes | integer | 10000000 | Stop reading and truncate once the response body exceeds this size (bytes). |
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.
{
"url": "https://example.com"
}
readfetch-client / @readfetch/client (latest+) handle x402 on paid routes — full API on /integrations#clients.
# pip install readfetch-client
# export EVM_PRIVATE_KEY=0x…
import asyncio
from readfetch_client import readfetch_fetch
async def main():
data = await readfetch_fetch("https://example.com")
asyncio.run(main())
// npm install @readfetch/client
// export EVM_PRIVATE_KEY=0x…
import { readfetchFetch } from "@readfetch/client";
const data = await readfetchFetch("https://example.com");
Response
Fields shown are the ones a caller branches on.
{
"billed": true,
"content_type": "application/json",
"size": 512,
"status": "success",
"status_code": 200,
"text": "{\"items\": []}",
"url": "https://api.example.com/items"
}
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. If the budget expires before the origin answers, the call times out and is not billed. Once the origin responds, you pay for that response — including 4xx/5xx — even when no readable article was extracted.
Failures come back as {"error": "…", "hint": "…"} with a status to branch on. Shapes: /docs#errors.
Billing
$0.0015 per completed request (call). The origin's status and body are the product — including 4xx/5xx and empty bodies. Only a transport failure is unbilled.
billed: false = transport failure or bot-check HTML, not origin 4xx/5xx.
RECEIPT on success. Full rules: /docs#billing.
Settlement, receipts and claims: /docs.