switch402

Web Search API for AI Agents: Pay per Call, No Subscription or API Key

Give your agent a search tool it can pay for by itself. /v1/search returns up to 10 ranked results with title, URL and snippet for $0.008 USDC on Base per call, paid over x402. No signup, API key or monthly plan, and you are charged only when at least one result comes back.

  • Up to 10 ranked results

    Each result has rank, title, url and snippet. Send q (1 to 400 characters) and an optional limit from 1 to 10 (default 10).

  • No API key to manage

    An unpaid call answers HTTP 402 with the price. Any x402 client signs the USDC payment from the agent's wallet and retries.

  • Charged only for results

    Payment settles only when at least one result comes back. Errors, failures and capacity limits are not charged.

  • Search, then read

    Results are snippets, not full pages. Pass the best URL to /v1/scrape ($0.008) to read it as markdown in the same workflow.

Cost: searches x $0.008. An agent that runs 5 searches per task for 100 tasks a month pays $4.00. Reading one result page as markdown adds $0.008 per page, and a month with no searches costs $0.

Weighing a scraping plan as well? See the Firecrawl pricing calculator.

Using an MCP agent? See the MCP web search server and the

Claude Code guide.

Code example

Python agent tool: search, then read the top result

# 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 web_search(q: str, limit: int = 5) -> list[dict]:
    """Web search, up to 10 results ($0.008 per successful call)."""
    r = session.post("https://api.switch402.com/v1/search", json={"q": q, "limit": limit})
    r.raise_for_status()
    return r.json()["results"]  # [{"rank", "title", "url", "snippet"}, ...]

def read(url: str) -> str:
    """Read one page as markdown ($0.008 per successful call)."""
    r = session.post("https://api.switch402.com/v1/scrape", json={"url": url})
    r.raise_for_status()
    return r.json()["markdown"]

hits = web_search("x402 payment protocol")
top_page = read(hits[0]["url"]) if hits else ""

curl: an unpaid call shows the price (HTTP 402)

curl -i -G https://api.switch402.com/v1/search \
  -H 'User-Agent: my-agent/1.0' \
  --data-urlencode 'q=x402 payment protocol' \
  --data-urlencode 'limit=10'
# HTTP 402 with x402 payment terms ($0.008); an x402 client pays and retries.

FAQ

Is the search API live?
Yes. GET https://api.switch402.com/v1/search?q=... (or POST {"q": "...", "limit": 10}) returns up to 10 ranked results for $0.008 USDC on Base per call, paid over x402. An unpaid call answers HTTP 402 with the exact terms.
How many results do I get?
Up to 10 per call. Set limit from 1 to 10 (default 10); the price is $0.008 either way. The response has query, count and results, each with rank, title, url and snippet.
Can I filter by country, language, date or site?
Not today. The inputs are q (1 to 400 characters) and limit.
Does it return full page content?
No. Search returns titles, URLs and snippets. To read a result, send its URL to /v1/scrape ($0.008) for markdown.
Do I need an account or API key?
No. Your agent pays each call over x402 in USDC on Base from its own wallet. There is no signup.
Am I charged if nothing comes back?
No. Payment settles only when at least one result comes back. Errors, failures and capacity limits are not charged.

Next steps