Calling the Router
Payment wires: every paid endpoint accepts x402 and MPP (Machine Payments Protocol) on the same 402 - see Paying with x402 and Paying with MPP. Agent402 is the applied layer of Agentic Finance: agents that pay and get paid on their own.
The request forms of POST /api/route and every field of its answer. What the router is, how sellers get in and how it ranks them: x402 Index and Router.
Calling the router
# Default - include everything (local + crawled remotes), pick the cheapest healthy match
curl -X POST https://agent402.tools/api/route \
-H 'content-type: application/json' \
-d '{"query":"ocr image to text","top":5}'
# Neutral discovery: rank only OTHER x402 sellers (exclude Agent402 itself)
curl -X POST https://agent402.tools/api/route \
-H 'content-type: application/json' \
-d '{"query":"ocr image to text","top":5,"include":"external"}'
# Local-only escape hatch (Agent402's catalog only)
curl -X POST https://agent402.tools/api/route \
-H 'content-type: application/json' \
-d '{"query":"ocr image to text","top":5,"include":"local"}'
Returns an object, not a bare array. The matches are in results:
{
"query": "screenshot webpage",
"include": "all",
"count": 2,
"sellers": 2,
"results": [
{
"seller": "https://seller.example",
"sellerHome": "https://seller.example",
"sellerName": "seller.example",
"slug": "screenshot",
"name": "Screenshot any URL through headless Chromium",
"method": "POST",
"route": "/shot",
"url": "https://seller.example/shot",
"price": 0.005,
"priceUsd": 0.005,
"category": "other",
"description": "…",
"tags": ["screenshot", "browser"],
"score": 13,
"health": 1,
"networks": ["eip155:8453"],
"paymentNetworksKnown": true,
"routerDispatchEligible": true,
"routerDispatchReason": "eligible",
"executeViaCallableNow": true,
"executeVia": {
"tool": "route-execute",
"price": "$0.01",
"underlyingPriceUsd": 0.005,
"resaleMarginUsd": 0.005,
"routingFeeUsd": 0.005
},
"untrustedContent": true,
"source": "https://seller.example"
}
]
}
selleris"self"for the local catalog, or the origin URL for a remote seller, so a buyer can address the right seller directly.urlis the full callable endpoint.priceis whatever the seller published (a number or a string);priceUsdis the normalized number to compare on, andpriceKnownsays whether that number could actually be read from what the seller published. When it isfalse,priceUsdis a placeholder and must not be compared.routerDispatchEligible/routerDispatchReasonsay whether this host's router will buy from the seller right now and why not otherwise (crawl_failed,network_unknown,no_supported_route,url_template,price_unknown,usdc_domain_mismatch,gateway_rail_unsupported,delivery_failing,settlement_self_funded,settlement_required,category_excluded,settlement_checked_at_pay_time,eligible,local_catalog);routableandhealthare crawl readiness, never a promise to pay. The response'sdispatchLegendspells each out and is the full list.- Routes that sell personal data about individuals are listed but not bought by
the router: they read
category_excludedon/api/index?seller=, are not ranked here, andcategoryExcludedcounts the matching routes left out. executeVianames the cheapest execution rung that covers this result (see the ladder) and appears only on a row the router will pay now (executeViaCallableNow: true). A row that is not dispatch-eligible carriesexecuteViaWhenEligiblewithexecuteViaCallableNow: falseinstead, so a tier name never reads as a callable action.networksInferred: truemarks a row whose chains were inherited from its seller rather than read on its own 402.tagsis the tool's own tag list (the catalog's for a local row, the crawled listing's for an external one), an empty array when the listing has none.countis the number of results returned;sellersis how many distinct sellers they came from.- The response echoes back the resolved
includevalue (invalid values fall back toall). capabilityGapandcapabilityGapCoveredappear only on a query that asks for a capability this host's catalog does not offer. The list is short and named in the source (src/capability-gaps.js); today it holds four entries,ip-geolocation,coin-price-on-date(the look-back tools answer statistics computed from a coin's history, never a past price),stock-price-history(the price-history tools read coins and tokens; the entry applies while this host lists no stock history tool) andstock-price(a stock's current price: the tokenized-stock tools read a token's pool price, not the share's, so a query that names the token is answered by them and one that asks for the stock is a miss). Such a query is a miss unless a row is named for the capability in its slug or name (a description does not count), and a row that is named for it, an outside seller's included, is ranked first. On a miss the answer carriescapabilityGapCovered: false,weakMatches: true,weak: trueon every row and ahintsaying none of the rows does the task: treat the rows as near word matches, not as answers. Every other query is ranked and answered as before.