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.
| Price | $0.002 USDC on Base (eip155:8453) per successful call. accepts[0].amount = "2000" (6 decimals). Pay to 0x751a4c3841bE287544C371B4EE09Bd3366AeA7cf. |
|---|---|
| Endpoint | GET https://quickbuild.quynguyenbac.workers.dev/api/markdown |
| Method | GET 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. |
| Field | Type | Meaning |
|---|---|---|
url | string | Final URL after redirects |
status | integer | Upstream HTTP status |
title | string or null | Page title, when present |
markdown | string | Clean Markdown of the main content (may be truncated to maxChars) |
chars | integer | Length of the returned markdown |
wordCount | integer | Word count of the returned Markdown |
linksCount | integer | Number of Markdown links of the form ](http(s):…) or ](mailto:…) |
truncated | boolean | true if the Markdown was cut to maxChars |
javascriptRendered | boolean | Always 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).
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)"
}
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.
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.code | HTTP | When |
|---|---|---|
INVALID_URL | 400 | Missing/invalid URL, non-http(s), odd ports, credentials, localhost, IP literals, private/reserved hosts |
BLOCKED_OR_CHALLENGE | 403 or 429 | Upstream 403/429/503, or challenge HTML (Cloudflare “Just a moment”, captcha, and similar) |
TOO_LARGE | 413 | Upstream HTML exceeded the 500 KB (512000 byte) cap. Not a partial paid result. |
JS_REQUIRED | 422 | SPA / empty root, little visible text, or a noscript asking for JavaScript |
RATE_LIMITED | 429 | Paid route only: 120 requests/hour per IP (IPv6 counted per /48) |
UPSTREAM_ERROR | 502 (or 415) | Other upstream failures, or unsupported content type |
TIMEOUT | 504 | Fetch exceeded 10 seconds |
Content-Length above the cap is refused before the body is read; otherwise the stream is cancelled as soon as the cap is passed. Oversized bodies are not parsed and are not charged.BUDGET, in-memory fallback).maxChars default 50 000; out-of-range values are clamped to 500–200000 (not an error).x-cache: MEM-HIT / MEM-MISS). This Worker is workers.dev-only; Cloudflare’s Cache API is a no-op there, so there is no edge cache and no sharing across isolates. A memory hit still bills.nav, site header, cookie/consent banners, ads, social share, footer, aside, scripts, styles, and forms.JS_REQUIRED and are not charged. For a rendered screenshot, use GET /api/screenshot ($0.008).TOO_LARGE error.POST /api/free/url_to_markdown tool is a related token-saver (default max_chars 20 000, plus size/token-savings fields; 30/hour per IP) — not a substitute for the paid $0.002 route.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.