LLM-Ready Markdown from Any URL: One Call, Clean Text for Your Prompt
Need one page inside a prompt right now, not a crawl pipeline? One call turns a public URL into markdown with its title, ready to put in an LLM context window to summarize it, answer questions about it, or let an agent reason over it. $0.008 per successful page, paid per call over x402.
- Markdown, not raw HTML
Headings, lists and links come back as markdown text, so there are no tags to strip before the model reads it.
- Source and title included
The response carries url and title, so the model can cite where the text came from.
- Fallback is disclosed
own_service is true if the result came from a fallback service we operate, so you always know the source path.
- Callable from MCP too
The scrape tool on https://api.switch402.com/mcp returns the same markdown to MCP clients that can pay over x402.
Cost: $0.008 per page. An agent that reads 20 pages for one task pays $0.16 for that task, with no monthly plan required.
Converting a whole docs site? See scrape a docs site to markdown and the
URL to markdown API ($0.003 per call on lite).
Code example
JavaScript: page to prompt
// 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.AGENT_KEY)
const fetchWithPayment = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [{ network: 'eip155:8453', client: new ExactEvmScheme(account) }],
})
async function pageAsContext(url, maxChars = 20000) {
const res = await fetchWithPayment('https://api.switch402.com/v1/scrape', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'User-Agent': 'my-agent/1.0' },
body: JSON.stringify({ url }),
})
if (!res.ok) throw new Error('scrape failed: ' + res.status) // 502 is not charged
const { title, markdown } = await res.json()
return `Source: ${url}\nTitle: ${title ?? ''}\n\n${markdown.slice(0, maxChars)}`
}
const context = await pageAsContext('https://example.com')
const prompt = `Summarize this page in 3 bullet points.\n\n${context}`FAQ
- Is switch402 live?
- Yes. POST https://api.switch402.com/v1/scrape with {"url": "..."} returns the page as markdown for $0.008 USDC on Base per call, paid over x402 and charged only on success. The lite tier at /v1/scrape/lite costs $0.003.
- What if the page is longer than my context window?
- switch402 returns the markdown the provider extracted. Trim it or split it into chunks yourself to fit your model; the RAG use case shows a chunking example.
- Which pages work?
- Public http(s) pages. Pages behind a login are not supported.
- Do I need an API key?
- No. Your code or agent pays per call over x402 in USDC on Base, with no signup.