In a nutshell
AI agents can pay for APIs and data per request, in stablecoins, through open agent payment protocols. With Blockradar, an agent pays from a wallet whose private key never leaves Blockradar, using the Typed Data Signing endpoint you already have.
AI agents can pay for APIs and data per request, in stablecoins, through open agent payment protocols. With Blockradar, an agent pays from a wallet whose private key never leaves Blockradar, using the Typed Data Signing endpoint you already have.
Supported Protocols
Prerequisites
1
API Key
Get your API key from the Blockradar Dashboard. Navigate to Developers to generate one.
2
EVM Master Wallet
Create a master wallet in the dashboard on the chain the API charges on, such as Base (see Create a Master Wallet). Agent payments through Blockradar are EVM only.
3
USDC Enabled
Enable USDC on the wallet so balances and deposits are tracked. See Asset Management.
Give the Agent Its Own Budget
A child address with auto-sweep turned off works well as an agent budget. Top it up with the amount the agent may spend, and the agent can never pay more than that balance.Keep
disableAutoSweep: true on an agent’s address. With auto-sweep on, the USDC you send to fund the agent is swept to the master wallet, and the agent’s payments fail for lack of funds.addressId. The master wallet’s whole balance is then within the agent’s reach, so do this only with a master wallet dedicated to the agent.
On the Checkout plan, child address operations are not available, so use a master wallet dedicated to the agent.
How x402 Works
x402 is an open protocol that lets an API charge per request: it answers with HTTP402 Payment Required, and the caller retries with a signed USDC payment. x402 has three parties: the buyer (your agent), the seller (the API being paid), and a facilitator that checks the payment and submits it on-chain.
1
The API asks for payment
The agent calls a paid endpoint. The API responds with
402 Payment Required and a PAYMENT-REQUIRED header listing what it accepts: network, token, amount, and the payTo address.2
Blockradar signs the payment
The agent turns one of those options into an EIP-3009
TransferWithAuthorization and signs it with Blockradar’s typed data endpoint. Nothing is sent on-chain yet.3
The agent retries with the signature
The agent repeats the request with the signed payment in the
PAYMENT-SIGNATURE header.4
The facilitator settles
The seller’s facilitator verifies the signature and submits the transfer on-chain, paying the gas itself. The API returns the response, with the settlement result in a
PAYMENT-RESPONSE header.Pay with x402
Fund the agent’s address first, as described in Give the Agent Its Own Budget.Option 1: Use the x402 client SDK
The official@x402/fetch client handles the 402 exchange for you. It only needs a signer with an address and a signTypedData method. The adapter below implements that signer on Blockradar’s typed data endpoint, so the key stays in Blockradar.
JavaScript
eip155:84532 for Base Sepolia while testing), with a wallet on that chain behind each.
Option 2: Build the payment yourself
Without the SDK, or in another language, a payment takes three HTTP calls: the first request, the signing call to Blockradar, and the paid retry. The steps below pay 0.01 USDC on Base.Step 1: Read the payment requirements
Call the API. A402 response carries a base64-encoded PAYMENT-REQUIRED header. Decoded, it looks like this:
accepts that your wallet can pay:
schemeisexact.networkis the wallet’s chain.eip155:8453is Base mainnet.extra.assetTransferMethodis absent oreip3009. Thepermit2method needs an on-chain token approval first, which costs gas, so this guide does not cover it.
amount is in the token’s smallest unit. USDC has 6 decimals, so 10000 is 0.01 USDC.
Step 2: Sign the authorization
Build theTransferWithAuthorization from the requirements and sign it from the agent’s address:
POST /v1/wallets/{walletId}/signing/typed-data and set from to the master wallet’s address. The response is the standard typed data response; the signature is in data.signedTransaction.signature.
Step 3: Retry with the payment
Wrap the signature and authorization in a payment payload, base64-encode it, and send it in thePAYMENT-SIGNATURE header on the same request:
JavaScript
Step 4: Check the settlement
A successful response includes a base64-encodedPAYMENT-RESPONSE header:
transaction is the on-chain hash of the USDC transfer. If the payment fails, the API answers 402 again, and PAYMENT-RESPONSE carries an errorReason such as insufficient_funds.
Calling an x402 v1 API
Calling an x402 v1 API
Servers on x402 version 1 differ from the flow above in four ways:
- The payment requirements are in the
402response body, not a header. - Networks are named (
base,base-sepolia) rather thaneip155:<chainId>. Base is chain ID8453; Base Sepolia is84532. - The amount field is
maxAmountRequired, notamount. - The payment goes in the
X-PAYMENTheader as base64-encoded JSON withx402Version: 1,scheme,network, and the samepayloadobject, and the settlement comes back inX-PAYMENT-RESPONSE.
Signing rules that trip up integrations
Every signature is recorded as a
SIGNED transaction and triggers a signed.success webhook, which gives you an audit trail of every payment your agent authorized. A signature is not a payment: the USDC only moves when the seller’s facilitator settles it. When the seller is outside Blockradar, the settlement appears as an outgoing transfer from the agent’s address. To reconcile, match signed.success webhooks against the on-chain transaction in the PAYMENT-RESPONSE header.
x402 Limitations
- EVM only. Payments are signed with EIP-712 typed data, which Blockradar supports on EVM chains only. Solana and other non-EVM x402 networks are not supported.
- EIP-3009
exactpayments only. Tokens withtransferWithAuthorization, such as USDC, work. Thepermit2transfer method and other schemes are not covered. - No Circle Gateway nanopayments. Circle’s batched sub-cent payment option has not been tested with Blockradar wallets.
Best Practices
- Enforce limits in your agent. Blockradar signs any well-formed request from a valid API key. Put per-payment and per-day limits in your agent’s code, and cap total exposure with the balance of the agent’s address.
- One address per agent. Separate budgets make it obvious which agent spent what, and let you cut one off by draining its address.
- Check the price before signing. Compare
amountagainst the most your agent should pay for that resource, and refuse anything higher. - Check the recipient. If your agent only pays known APIs, keep an allowlist of
payToaddresses. - Use
metadataand webhooks. Tag agent addresses withmetadata, and reconcilesigned.successwebhooks against the on-chain transaction in eachPAYMENT-RESPONSE. - Lock down API access. Accept API requests only from your own servers with IP Whitelisting, so a leaked key cannot be used elsewhere.
- Test on Base Sepolia first. Use a testnet wallet,
eip155:84532, and testnet USDC from the faucets before spending real funds.

