x402 quote
GET /api/x402-quote · Cached 10mProbe any URL and decode its HTTP 402 payment requirements (price, asset, network, pay-to) into clean JSON - what an agent needs to decide whether/how to pay. Send GET /api/x402-quote with the required field url and pay $0.002 per call over x402 or MPP (there is no free tier). It returns a JSON object with url, status, paymentRequired and accepts.
Read-only; does not pay. ?url=https://api.example.com/paid&method=GET
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
url | string | yes | URL of the paid resource to probe Also accepted as link, uri, href, page. |
method | string | no | HTTP method to probe with (default GET) |
Example request
curl -i "https://agent402.tools/api/x402-quote?url=https%3A%2F%2Fagent402.tools%2Fapi%2Fhash&method=POST"
Without payment this returns HTTP 402 Payment Required with the exact price for x402-quote; any x402 v2 or MPP client pays it and retries.
Example response
{
"url": "https://api.example.com/paid",
"status": 402,
"paymentRequired": true,
"accepts": [
{
"scheme": "exact",
"network": "base",
"asset": "USDC",
"maxAmountRequired": "1000",
"payTo": "0x…"
}
]
}
| Field | Type | Always present | In the example |
|---|---|---|---|
url | string | no | https://api.example.com/paid |
status | number | no | 402 |
paymentRequired | boolean | no | true |
accepts | array of objects | no | 1 item in the example |
From an MCP client
catalog.call {
"slug": "x402-quote",
"params": {
"url": "https://agent402.tools/api/hash",
"method": "POST"
}
}
The hosted connector at https://agent402.tools/mcp needs a payment for x402-quote; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.
Errors and behavior
urlis required. An input the tool rejects returns an HTTP 4xx whose body carrieserror,tool,expected,requiredandexample, so the caller can correct it.- A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement is cancelled when the tool fails. The exception is a Tempo push credential, a transfer the buyer sent before the call: it settles before the tool runs, so if the tool then fails the payment is recorded as a refund owed to the paying wallet.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - Cached: an identical request within 10m is answered from cache with
X-Cache: hit. - A
POSTwith a JSON body to /api/x402-quote is served as this GET, with the body as the input. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/x402-quote?url=https%3A%2F%2Fagent402.tools%2Fapi%2Fhash&method=POST");
Related tools
x402 market pulse
GET /api/x402-market-pulseLive cross-provider x402 market sentiment. topProviders: the top x402 sellers ecosystem-wide, ranked by REAL on-chain ac…
x402 trending sellers
GET /api/x402-trendingMomentum radar for the x402 seller ecosystem - which sellers are heating up, graded for wash-trade resistance. Reads the…
New B20 tokens
GET /api/b20-new-tokensRecently deployed B20 tokens on Base: scans the factory's B20Created logs over a block window, locates each new token by…
Rate a call you paid for
POST /api/feedbackTell this server whether a call you paid for delivered what it promised. Bound to the receipt: give it the settlement tr…
My usage (wallet-keyed purchase history)
POST /api/my-usageYour own purchase history, keyed to the wallet that pays for the call - no wallet parameter, no signup: the x402 payment…
Build USDC transfer authorization
POST /api/transfer-authorizationBuild the EIP-3009 transferWithAuthorization typed data for a gasless USDC transfer on Base/Polygon/Arbitrum/Optimism/Et…