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 IS the identity, so nobody can read another wallet's profile. Send POST /api/my-usage with no required fields (2 optional) and pay $0.005 per call over x402 with USDC on an EVM chain (the paying wallet is the identity). It returns a JSON object with wallet, days, persistent, totals, byNetwork and 4 more.
Returns totals, per-tool counts, per-chain breakdown, recent receipts with settle tx hashes (independently verifiable on-chain), and this wallet's refunds: any payment that settled for a call that failed to deliver, with its status and our refund transaction once sent. Anyone holding a settlement tx can also check it for free at GET /api/refunds/lookup?tx=<hash>. Requires an EIP-3009 payment (USDC on Base, Polygon, or Arbitrum); Solana/Stellar payments carry no signed payer the server can verify.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
days | number | no | Aggregation window in days, 1-365 (default 30). The recent list is always the latest rows regardless. |
limit | number | no | Max recent receipts to return, 1-200 (default 50) |
Example request
curl -i -X POST https://agent402.tools/api/my-usage \
-H "Content-Type: application/json" \
-d '{"days":30}'
Without payment this returns HTTP 402 Payment Required with the exact price for my-usage; any x402 v2 or MPP client pays it and retries.
Example response
{
"wallet": "0x902dcf34e53695bdea2ffb354b1a2e58bd598256",
"days": 30,
"persistent": true,
"totals": {
"calls": 42,
"paidUsd": 1.234,
"firstAt": "2026-07-01T00:00:00.000Z",
"lastAt": "2026-07-09T00:00:00.000Z"
},
"byNetwork": {
"base": {
"calls": 40,
"usd": 1.2
},
"polygon": {
"calls": 2,
"usd": 0.034
}
},
"bySlug": [
{
"slug": "hash",
"calls": 12,
"usd": 0.012,
"lastAt": "2026-07-09T00:00:00.000Z"
}
],
"recent": [
{
"at": "2026-07-09T00:00:00.000Z",
"slug": "hash",
"priceUsd": 0.001,
"network": "base",
"tx": "0x…"
}
],
"refunds": {
"count": 1,
"owedUsd": 0,
"paidUsd": 0.005,
"rows": [
{
"tx": "0x…",
"status": "paid",
"amountUsd": 0.005,
"network": "eip155:8453",
"chain": "base",
"refundTx": "0x…",
"refundTxUrl": "https://basescan.org/tx/0x…",
"refundedAt": "2026-07-09T01:00:00.000Z",
"recordedAt": "2026-07-09T00:00:00.000Z"
}
]
},
"note": "Every USDC row keeps its settle tx - verifiable on-chain."
}
| Field | Type | Always present | In the example |
|---|---|---|---|
wallet | string | yes | 0x902dcf34e53695bdea2ffb354b1a2e58bd598256 |
days | number | yes | 30 |
persistent | boolean | yes | true |
totals | object | yes | 4 fields: calls, paidUsd, firstAt, lastAt |
byNetwork | object | yes | 2 fields: base, polygon |
bySlug | array of objects | yes | 1 item in the example |
recent | array of objects | yes | 1 item in the example |
refunds | object | yes | 4 fields: count, owedUsd, paidUsd, rows |
note | string | yes | Every USDC row keeps its settle tx - verifiable on-chain. |
From an MCP client
catalog.call {
"slug": "my-usage",
"params": {
"days": 30
}
}
The hosted connector at https://agent402.tools/mcp needs a payment for my-usage; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY (wallet only for this tool). Local install: npx -y agent402-mcp.
Errors and behavior
- Every field is optional. An input the tool rejects returns an HTTP 4xx whose body carries
error,tool,expected,requiredandexample. - A paid call that ends in any status of 400 or above is not charged over x402 or MPP: settlement is cancelled when the tool fails.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier.
- Identity-bound: results are keyed to the wallet that signed the payment, so only EVM x402 payments are accepted; credits keys and Tempo are refused.
- A
GETorHEADto /api/my-usage 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?.(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/my-usage", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"days": 30
}),
});
Related tools
Receipts (your settled calls, as accounting rows)
POST /api/receiptsYour own settled calls in the shape a finance system posts: one row per payment with what was bought, the amount settled…
x402 security audit
GET /api/x402-auditGrade any x402 seller's payment-security posture from the outside - a read-only black-box check mapped to the 'Five Atta…
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…
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…
USDC balance
GET /api/usdc-balanceRead the USDC balance of any address on Base, Polygon, Arbitrum, Optimism, Ethereum, Monad, Celo, Avalanche, or Sei. Rea…
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…