switch402

URL to Markdown API: $0.003 per Call, Charged Only on Success

Send a public URL, get the page back as clean markdown with its title. /v1/scrape/lite costs $0.003 per call and /v1/scrape $0.008 per call, paid over x402 in USDC on Base, with failover between providers. No signup, API key or plan required, and a failed page costs nothing.

  • Two tiers, same response

    /v1/scrape/lite: $0.003 per call. /v1/scrape: $0.008 per call. Both return JSON with url, title, markdown, own_service, ms and attempts.

  • GET or POST

    GET /v1/scrape/lite?url=<page> or POST {"url": "<page>"}. Public http(s) pages only; nothing behind a login.

  • Free quote first

    GET /v1/quote?url=<page>&tier=lite returns the price, how many providers are healthy and an estimated latency, at no cost.

  • Charged only on success

    Payment is verified first and settled only when markdown comes back. If no provider returns content you get a 502 and pay nothing.

Cost: pages converted x $0.003 on lite. 1,000 pages cost $3.00 and 10 pages cost $0.03. Prefer a balance? A $10 monthly plan (30 days) bills lite pages at a plan rate of $0.0025 ($10 covers 4,000 lite pages); leftover balance stays on your key.

Code examples

curl: unpaid call shows the price (HTTP 402, $0.003)

curl -i -G https://api.switch402.com/v1/scrape/lite \
  -H 'User-Agent: my-agent/1.0' \
  --data-urlencode 'url=https://example.com'
# HTTP 402 with x402 v2 terms: exact, eip155:8453 (Base), USDC, amount 3000 (= $0.003).
# An x402 client signs the payment and retries; the 200 response is JSON:
# {"url": "...", "title": "...", "markdown": "# ...", "own_service": false, "ms": 1800, "attempts": 1}

Python: URL to markdown

# pip install "x402[requests,evm]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact import ExactEvmScheme

client = x402ClientSync()
client.register("eip155:8453", ExactEvmScheme(signer=EthAccountSigner(Account.from_key(os.environ["AGENT_KEY"]))))
session = x402_requests(client)
session.headers["User-Agent"] = "my-agent/1.0"

def url_to_markdown(url: str) -> str:
    """Public page as markdown ($0.003 per successful call)."""
    r = session.post("https://api.switch402.com/v1/scrape/lite", json={"url": url})
    r.raise_for_status()  # 502 = no content, not charged
    return r.json()["markdown"]

print(url_to_markdown("https://example.com")[:500])

MCP: the scrape_lite tool ($0.003)

curl -s -X POST https://api.switch402.com/mcp -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -H 'User-Agent: my-agent/1.0' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"scrape_lite","arguments":{"url":"https://example.com"}}}'
# Unpaid: an isError result with the x402 terms. Retry with params._meta["x402/payment"] to get the markdown.

FAQ

Is this an HTML to markdown API?
It converts web pages, by URL. switch402 fetches the public page and returns its markdown. It does not accept a raw HTML string in the request body.
What does the response look like?
JSON with url, title, markdown, own_service, ms and attempts. own_service is true when the result came from a fallback service we operate.
Are links kept in the markdown?
Headings, lists and links come back as markdown text. Exact formatting depends on the page, so test a few of your target URLs; the free quote checks availability first.
Lite or standard?
Both return the same response shape. Lite costs $0.003 per call, standard $0.008 per call. Start with lite and use standard if a page does not come back the way you need.
Just need one page converted, by hand?
The free URL to Markdown converter on youraitools.co (built and operated by the same team) does that in a browser. This API is for code and agents.

Related

More API pages