x402 · $0.002 USDC on Base

URL → Markdown

Fetch one public web page and get clean Markdown of the main content, ready to paste into an LLM or RAG pipeline. No account, no API key. You pay only when the conversion succeeds.

GET /api/markdownDoes not run JavaScript500 KB HTML capErrors never charged

How to call

Price$0.002 USDC on Base (eip155:8453) per successful call. accepts[0].amount = "2000" (6 decimals). Pay to 0x751a4c3841bE287544C371B4EE09Bd3366AeA7cf.
EndpointGET https://quickbuild.quynguyenbac.workers.dev/api/markdown
MethodGET only. Unpaid requests return HTTP 402 with the x402 v2 challenge in the PAYMENT-REQUIRED header (base64 JSON) and the same JSON in the body. Retry with an x402 client (for example @x402/fetch + @x402/evm).
Input url (query, string, optional): public http(s) URL on port 80/443. Hostname only — no IP literals, localhost, credentials, or private/reserved hosts. Every redirect hop is re-checked. Defaults to https://example.com if omitted.
maxChars (query, integer, optional): truncate the Markdown to this many characters. Default 50000. Values outside 500–200000 are clamped to those bounds (they are not rejected): 100 becomes 500, 999999 becomes 200000. A missing or non-numeric value falls back to 50000. See parseMaxChars in src/markdown.js.
Success (200)JSON object with the fields below. A cache hit in the same isolate still returns 200 and is still billed.

Success response fields

FieldTypeMeaning
urlstringFinal URL after redirects
statusintegerUpstream HTTP status
titlestring or nullPage title, when present
markdownstringClean Markdown of the main content (may be truncated to maxChars)
charsintegerLength of the returned markdown
wordCountintegerWord count of the returned Markdown
linksCountintegerNumber of Markdown links of the form ](http(s):…) or ](mailto:…)
truncatedbooleantrue if the Markdown was cut to maxChars
javascriptRenderedbooleanAlways false — this endpoint does not execute JavaScript

Response headers: x-ratelimit-limit, x-ratelimit-remaining, x-ratelimit-source (do or local), and x-cache (MEM-HIT / MEM-MISS).

Example (from the unit-test fixture test/fixtures/article-ok.html, run through renderMarkdown)

Request: GET /api/markdown?url=https://example.com (or the same HTML as that fixture). This is the real converter output, not a shortened mock.

{
  "url": "https://example.com/",
  "status": 200,
  "title": "Example Domain",
  "chars": 231,
  "wordCount": 34,
  "linksCount": 1,
  "truncated": false,
  "javascriptRendered": false,
  "markdown": "# Example Domain\n\nThis domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.\n\n[More information...](https://www.iana.org/domains/example)"
}

Unpaid challenge (do not send a payment header unless you intend to pay)

curl -sS -D - 'https://quickbuild.quynguyenbac.workers.dev/api/markdown?url=https://example.com'

Expect HTTP 402, accepts[0].amount = "2000", accepts[0].network = eip155:8453.

Errors (never charged)

Every error is HTTP 4xx/5xx JSON. The x402 middleware settles only on 2xx, so these branches never take payment.

{
  "error": { "code": "JS_REQUIRED", "message": "page appears to require JavaScript (empty SPA shell or little server-rendered text)" },
  "hint": "This Worker does not execute JavaScript. Use a URL that returns server-rendered HTML. You are not charged for this error.",
  "charged": false
}
error.codeHTTPWhen
INVALID_URL400Missing/invalid URL, non-http(s), odd ports, credentials, localhost, IP literals, private/reserved hosts
BLOCKED_OR_CHALLENGE403 or 429Upstream 403/429/503, or challenge HTML (Cloudflare “Just a moment”, captcha, and similar)
TOO_LARGE413Upstream HTML exceeded the 500 KB (512000 byte) cap. Not a partial paid result.
JS_REQUIRED422SPA / empty root, little visible text, or a noscript asking for JavaScript
RATE_LIMITED429Paid route only: 120 requests/hour per IP (IPv6 counted per /48)
UPSTREAM_ERROR502 (or 415)Other upstream failures, or unsupported content type
TIMEOUT504Fetch exceeded 10 seconds

Limits

What it does

What it does not do

Free counterpart

POST /api/free/url_to_markdown with JSON {"url":"https://example.com","max_chars":20000} — no payment, 30/hour per IP. Same conversion and error codes, default cap 20 000 characters, plus estimated token-savings fields. Also available as MCP tool url_to_markdown at /mcp.

Repo doc: docs/url-markdown.md. Discovery: /openapi.json · /llms.txt · /.well-known/x402. Related: LaunchCheck.