Base URL: https://api.webextract.dev (same app at https://webextract.dev). Machine-readable: /openapi.json · /llms.txt · /.well-known/x402.
curl -H "X-Billing: free" "https://api.webextract.dev/v1/markdown?url=https://example.com"
20 free calls/day per IP. On REST the X-Billing: free header (or ?free=1) is required; without it the endpoint answers HTTP 402 with payment options. MCP clients need no header: POST https://api.webextract.dev/mcp.
Framework guides: Vercel AI SDK (@webextract/ai-sdk) · LangChain (langchain-webextract for Python, @webextract/langchain for JS).
| Endpoint | Returns | Prepaid | x402 |
|---|---|---|---|
GET /v1/extract?url=<page> | Markdown + metadata, product, tables | 1 credit | $0.005 |
GET /v1/markdown?url=<page> | Markdown, title, word count | 0.4 credit | $0.002 |
GET /v1/render/extract?url=<page> | Same as /v1/extract, after rendering the page in a headless browser (JS rendering) | 1.6 credits | $0.008 |
GET /v1/render/markdown?url=<page> | Same as /v1/markdown, after rendering the page in a headless browser | 0.8 credit | $0.004 |
GET /v1/balance | Credits left on your key (send Authorization: Bearer <api_key>; returns credits_remaining, credits_purchased, credits_used), or free calls left today for your IP without a key | free | — |
product.price_detail is the recommended price field. Each entry in prices[] has type (list, sale, current), amount, currency, and the matched variant when the page proves it. It never contains 0. When no price can be trusted, status is unresolved and unresolved.reason says why (for example no_offer_in_structured_data, variant_not_matched, zero_price). When the URL selects a variant (?variant=, ?sku=, ?size=…), the flat product.price is that variant's price. If the variant cannot be matched on a page whose variants have different prices, product.price is null instead of another variant's price. Listing and category pages return product: null with product_unresolved.reason: "listing_page". content_source is raw_html on /v1/extract and /v1/markdown (no JavaScript is executed) and rendered on /v1/render/*; product.source is the extraction method (json-ld, opengraph, microdata, heuristic).
Both data endpoints also accept POST with a JSON body {"url": "https://..."} (or a form body).
curl -H "X-Billing: free" "https://api.webextract.dev/v1/extract?url=https://example.com"
curl -X POST https://api.webextract.dev/v1/markdown -H "X-Billing: free" -H "Content-Type: application/json" -d '{"url":"https://example.com"}'
tables[].headers and tables[].rows follow the same grid as the Markdown table: cells that span rows or columns (rowspan, colspan) are expanded, so every cell stays in its own column. A value that spans several rows is repeated in each row it covers (values up to 200 characters; longer ones leave ""), and the extra columns of a colspan are "". Rows that are shorter in the page itself are not padded, so checks.consistent_width still reports them.
If the raw HTML of a page yields no readable text (markdown is empty, word_count 0; on /v1/extract and the MCP tool extract_url also product: null and no tables), /v1/extract and /v1/markdown still answer HTTP 200 and add warnings: ["empty_content"] and a hint. The hint says the page may build its content with JavaScript and suggests trying a URL that shows the content directly in the page source. A page with even one word of text is not empty.
charged: false, no free call is used (X-Free-Remaining does not drop) and no credits are taken (X-Credits-Charged: 0). Over MCP the same fields are in structuredContent, and the hint is a second text item in content.warnings and hint (the hint says the call was billed as usual), without charged. The sandbox works the same way with test USDC.{"url":"...","final_url":"...","fetched_at":"...","content_source":"raw_html","title":null,"markdown":"","markdown_truncated":false,"word_count":0,
"warnings":["empty_content"],
"hint":"No readable text was found in the raw HTML of this page (word_count 0; content_source raw_html, no JavaScript executed). The page may build its content with JavaScript: try a URL that shows the content directly in the page source. This call was not charged and did not use a free call.",
"charged":false}
For pages that only show their content after JavaScript runs. /v1/render/extract and /v1/render/markdown load the page in a headless browser (robots.txt respected), then return the same fields as /v1/extract / /v1/markdown with content_source: "rendered", plus a render object (render_ms, wait, subrequests, redirects, …) and an X-Render-Ms header. POST with {"url": "https://..."} works too.
/v1/render/extract) or 0.8 credit (/v1/render/markdown) with a prepaid key; $0.008 / $0.004 per call with x402 on the same networks. If the structured fields come back empty with a prepaid key, only 0.8 credit is charged.X-Billing: free (or ?free=1) gives 5 renders/day per IP. This allowance is separate from the 20/day free tier of the other endpoints./sandbox/v1/render/extract, /sandbox/v1/render/markdown, or X-Billing: x402-testnet (Base Sepolia test USDC, see Sandbox).{error, hint, example} (missing_url, invalid_url, forbidden_host, …) · 402 payment required · 413 too_large · 422 render_empty, dns_failed, blocked_by_site · 429 render_rate_limited · 451 robots.txt · 502 fetch_failed · 503 render_busy, render_failed, render_disabled · 504 render_timeout. Capacity is checked before any payment is requested.curl -H "X-Billing: free" "https://api.webextract.dev/v1/render/markdown?url=https://example.com"
X-Billing: free (or ?free=1). X-Free-Remaining is returned only in free mode. Without the opt-in, a request with no key and no payment gets HTTP 402 x402_required. MCP keeps 20 free calls/day with no header (same per-IP counter). Cloud and agent egress IPs can rotate, so the counter may vary.Authorization: Bearer <key>. Buy credits at /#pricing: $1 = 200 credits, $5 = 1,000, $20 = 5,000, $50 = 15,000; credits never expire. X-Credits-Charged / X-Credits-Remaining headers. Running low? Add credits to the same key instead of buying a new one: $1, $5, $20, $50 (you paste the key on that page; it is never put in a URL).exact, USDC on Base (recommended), Polygon, Arbitrum One, World Chain, Monad, Avalanche C-Chain or OP Mainnet. Ethereum mainnet is not supported. Payment settles at the quoted price and only when the request succeeds.| Network | CAIP-2 | USDC |
|---|---|---|
| Base | eip155:8453 | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| Polygon | eip155:137 | 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 |
| Arbitrum One | eip155:42161 | 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 |
| World Chain | eip155:480 | 0x79A02482A880bCE3F13e09Da970dC34db4CD24d1 |
| Monad | eip155:143 | 0x754704Bc059F8C67012fEd69BC8A327a5aafb603 |
| Avalanche C-Chain | eip155:43114 | 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E |
| OP Mainnet | eip155:10 | 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85 |
X-Billing header: free opts into the free tier. x402 returns the 402 with payment requirements (reason x402_requested). x402-testnet uses the sandbox (below). Any other value returns 400 invalid_billing_mode.
Order of checks: 1) url validation (400, never billed) → 2) Authorization: Bearer key (credits; wins over everything below) → 3) payment header PAYMENT-SIGNATURE (wins over X-Billing: free) → 4) X-Billing: x402 → 402 x402_requested → 5) X-Billing: free or ?free=1 → free quota, or 402 free_limit_reached with X-Free-Remaining: 0 → 6) otherwise 402 x402_required.
Note on ?free=1: it is read from the API's own query string. If your target URL has its own query string, URL-encode it (curl -G --data-urlencode "url=https://a.com/?x=1" -d free=1 ...) or simply use the header.
SDK note: official x402 SDKs (@x402/evm 2.28, Python x402 2.25) do not include OP Mainnet and World Chain USDC in their default asset lists; add them to spendControls.allowedAssets, and register only the network(s) where your wallet holds USDC (or pass a requirements selector), otherwise the SDK picks the first option (Base).
The x402 v2 requirements are in the PAYMENT-REQUIRED response header (base64 JSON). Sign one option and retry with PAYMENT-SIGNATURE. The JSON body says why payment is needed; the same value is in the X-Payment-Reason header:
reason | Meaning |
|---|---|
x402_required | No key, no payment and no free opt-in. Pay with x402, send a Bearer key, or retry with X-Billing: free while your IP has free calls left. |
x402_requested | You sent X-Billing: x402 (or used the sandbox) and no payment yet. |
free_limit_reached | You opted into the free tier but your IP's free daily calls are used up (X-Free-Remaining: 0). Retrying with X-Billing: free will not help today; see two ways to keep going. |
invalid_payment | A payment was sent but rejected; detail has a short reason code (e.g. insufficient funds, expired, bad signature) or a decode error. On REST, nothing was charged. |
unsupported_network | The payment used a network not offered for this endpoint. |
settlement_failed | The payment was verified but on-chain settlement did not complete. On REST, nothing was charged (charged: false, retryable: true). Retry the request with a freshly signed payment. |
{"error":"payment_required","reason":"x402_required","message":"Payment required. ... or try it free: add header 'X-Billing: free' ...",
"x402":{"price":"$0.005","network":"eip155:8453","networks":["eip155:8453","eip155:137",...],"asset":"USDC"},
"stripe":{"buy_url":"https://webextract.dev/#pricing","packs":[...]}}
With a prepaid key and no credits left you get 402 {"error":"no_credits"}. Add credits to that key at /#pricing (Option A, “Already have a key?”).
REST answers 402 free_limit_reached (the next steps are also in the body's next_steps and in the X-Next-Step-Credits / X-Next-Step-X402 headers); MCP tools/call answers “Free daily limit reached” (isError). The free tier resets at 00:00 UTC. To keep going now:
curl -H "Authorization: Bearer <api_key>" "https://api.webextract.dev/v1/extract?url=https://example.com" curl -H "Authorization: Bearer <api_key>" "https://api.webextract.dev/v1/balance"For MCP, add the header to the server in your client config, e.g.
{"url":"https://api.webextract.dev/mcp","headers":{"Authorization":"Bearer <api_key>"}} (x-api-key: <api_key> also works)./v1/extract, $0.002 per /v1/markdown; on REST, payment is settled only when the call succeeds). Resend the same request with a PAYMENT-SIGNATURE header signed for one option in the 402's PAYMENT-REQUIRED header; a payment wins over X-Billing: free. From code: the @x402/fetch example below; try it on the sandbox first, then drop /sandbox from the URL and register the network your wallet holds USDC on (Base is eip155:8453). From a browser wallet: /try. x402 payment is for the REST endpoints. Over MCP use the free tier or a prepaid Bearer key; paying over MCP with x402 has not been tested.All errors are JSON. On REST, and on the free tier or with a prepaid key over MCP, they are never charged: 400 missing or invalid url (checked before any billing) or unknown X-Billing value · 401 invalid API key · 402 payment required / out of credits · 413 page over 3 MB (use a smaller page) · 415 not a web page (only HTML, XML and plain text are read; PDFs, images, archives and other file downloads are not supported, so use the HTML page that links to the file) · 422 target site blocked or errored, or the page took too long (extract_timeout, over 10 s including any wait) or was too large or complex to parse (page_too_complex) · 451 robots.txt disallows the URL · 503 extract_busy (the extractor is busy, or another extraction from your address is still running; on REST, retry after the Retry-After header; over MCP the retry advice is in the error text).
Test an x402 client end to end without real money. Same endpoints and responses:
https://api.webextract.dev/sandbox/v1/extract?url=... https://api.webextract.dev/sandbox/v1/markdown?url=... # or on the normal endpoints: curl -H "X-Billing: x402-testnet" "https://api.webextract.dev/v1/markdown?url=https://example.com"
Pay from code with the official @x402/fetch client (tested with 2.28.0), testnet only:
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(process.env.TESTNET_PRIVATE_KEY); // throwaway test wallet
const pay = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [{ network: "eip155:84532", client: new ExactEvmScheme(account) }],
});
const res = await pay("https://api.webextract.dev/sandbox/v1/markdown?url=https://example.com");
console.log(res.status, (await res.json()).markdown);
eip155:84532) test USDC 0x036CbD53842c5426634e7929541eC2318f3dCF7e (EIP-712 name USDC, version 2), settled by the https://x402.org/facilitator testnet facilitator. Get test USDC at faucet.circle.com.Retry-After).Remote streamable-http server: https://api.webextract.dev/mcp (stateless JSON). Tools extract_url and page_markdown, both with outputSchema and structuredContent. Registry name dev.webextract/extract. Server card: /.well-known/mcp/server-card.json. MCP calls use the free tier (20/day per IP, no header needed) or a Bearer key; for pay-per-call use the REST endpoints with x402.
MCP errors. A failed tool call has isError: true. content[0] is one line of text that starts with the error code (missing_url, invalid_arguments, invalid_url, forbidden_host, robots_disallowed, unsupported_type, upstream_error, …) and, on the free tier or with a prepaid key, ends with "(not charged)". content[1] is JSON with error, category, charged and, for the errors above, a reason that says what to do next, a retryable flag and (for argument and url errors) an example call. retryable tells you whether sending the identical call again could succeed: false means fix the arguments or the URL, or pick another page, first; true (only for a temporary HTTP 5xx from the target site) means the same call may work a minute or two later. Errors without a retryable field give no such promise.
We identify as WebExtractBot, obey robots.txt, never bypass CAPTCHAs or anti-bot protection, and refuse private network addresses.