Price change webhook
POST /api/price-webhookRegister an https URL and get a signed POST when the list price of a tool you watch changes on this server (a retry carries the same X-Agent402-Delivery id). Send POST /api/price-webhook with the required field url and pay $0.01 per call over x402 or MPP (there is no free tier). It returns a JSON object with id, url, slugs, secret, signature and 6 more.
Give "url" and, optionally, "slugs" (up to 50 tool slugs; omit it to watch every tool). The answer carries the subscription id and its secret: each delivery is JSON ({ type: "price.changed", changes: [{ slug, from, to }] }) with an X-Agent402-Signature header, t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<body>" with the secret>, so the receiver can check it came from here. A subscription lasts 90 days ("expiresAt"); register the same url again from the same wallet to renew it (same id and secret). One wallet holds up to 25. A delivery is tried up to 5 times; a 2xx ends it and a 410 removes the subscription. Remove it yourself, free, with POST /api/price-webhook/unsubscribe and the id and secret. The watched price is the list price on /api/pricing; a tool that is quoted per request keeps its list price there. Deterministic code, no model.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
url | string | yes | The https URL that receives the signed POST. No credentials in the URL; it must resolve to a public address. Also accepted as link, uri, href, page. |
slugs | array of string | no | Tool slugs to watch (up to 50), as listed on /api/pricing. Omit it to watch every tool. |
Example request
curl -i -X POST https://agent402.tools/api/price-webhook \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/","slugs":["search","answer"]}'Without payment this returns HTTP 402 Payment Required with the exact price for price-webhook; any x402 v2 or MPP client pays it and retries.
Watch a call get paid
POST /api/price-webhook$0.01 USDCPAYMENT-SIGNATUREon 14 chains200 OKAgent402-ReceiptEd25519Example response
{
"id": "pw_3f9a1c2e4b6d8f0a1c3e5a7b9d1f2e4c",
"url": "https://example.com/",
"slugs": [
"answer",
"search"
],
"secret": "a402whsec_<64 hex characters>",
"signature": {
"header": "X-Agent402-Signature",
"scheme": "t=<unix seconds>,v1=<hex HMAC-SHA256, with the secret, of \"<t>.<body>\": the timestamp, a dot, and the body as sent>"
},
"event": "price.changed",
"unsubscribe": {
"method": "POST",
"url": "https://agent402.tools/api/price-webhook/unsubscribe",
"body": {
"id": "pw_3f9a1c2e4b6d8f0a1c3e5a7b9d1f2e4c",
"secret": "<the secret above>"
}
},
"expiresAt": "2027-02-19T12:00:00.000Z",
"registered": false,
"delivers": false,
"note": "example.com is a documentation host: the registration is answered as a real one would be, and nothing is stored or sent."
}| Field | Type | Always present | In the example |
|---|---|---|---|
id | string | yes | pw_3f9a1c2e4b6d8f0a1c3e5a7b9d1f2e4c |
url | string | yes | https://example.com/ |
slugs | array of string | yes | 2 items in the example |
secret | string | yes | a402whsec_<64 hex characters> |
signature | object | yes | 2 fields: header, scheme |
event | string | yes | price.changed |
unsubscribe | object | yes | 3 fields: method, url, body |
expiresAt | string | yes | 2027-02-19T12:00:00.000Z |
registered | boolean | yes | false |
delivers | boolean | yes | false |
note | string | yes | example.com is a documentation host: the registration is answered as a real o... |
From an MCP client
catalog.call {
"slug": "price-webhook",
"params": {
"url": "https://example.com/",
"slugs": [
"search",
"answer"
]
}
}The hosted connector at https://agent402.tools/mcp needs a payment for price-webhook; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.14.1.
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 runs after the tool and only on a successful response. 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. - A
GETorHEADto /api/price-webhook returns the same 402 quote, so the price can be read without a body. - 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?.({ maxAmountPerPayment: "$0.01" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/price-webhook", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"url": "https://example.com/",
"slugs": [
"search",
"answer"
]
}),
});Related tools
Audit report (one wallet's paid history, signed)
An audit report of your own wallet's paid history here, a record of every paid call: each call over a window of up.
B20 activation check
Is B20 live on Base mainnet?
B20 feature id
Pure-CPU helper: turn a B20 feature string (e.g. base.b20_asset) into its bytes32 feature id and ready-to-send.
B20 payment memos
Payment memos attached to B20 transfers: pairs each Memo(address,bytes32) log with its Transfer at the previous log.
New B20 tokens
Recently deployed B20 tokens on Base: scans the factory's B20Created logs over a block window, locates each new token.
B20 token info
ERC-20 metadata plus B20 signals for any Base address: name, symbol, decimals, total supply, best-effort paused/cap.