Skip to main content
x402 is well-suited for trading data: your agent pays per call in USDC, with no API key registration, subscription management, or rate-limit tiers to negotiate. The agent gets the data, the provider gets paid — that’s the entire relationship.

Mock Demo

Why x402 for market data

  • No API key management — your agent pays on demand; no credentials to rotate or store securely
  • Pay only for what you use — no monthly subscription for data you might not always need
  • Works across any walletSponge Wallet’s x402 proxy, CDP Agentic Wallet skills, and x402-axios all handle payment automatically
  • Composable — your agent can call multiple data providers in the same session, paying each separately

Discovering x402-compatible endpoints

x402-compatible services publish a discovery document at /.well-known/x402.json. You can also browse the Bazaar catalog for a curated list of x402 data providers.
Use the search-for-service skill to search the x402 Bazaar:
Terminal
npx awal@latest x402 bazaar search "price feed"
To browse all available resources:
Terminal
npx awal@latest x402 bazaar list --network base

Example x402 data sources

CoinGecko — price feeds

CoinGecko provides cryptocurrency price feeds, market cap data, and historical OHLCV via x402-enabled endpoints. Fetch the current ETH price:
Use the pay-for-service skill:
Terminal
npx awal@latest x402 pay "https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd"

Alchemy — onchain data

Alchemy exposes enhanced APIs for onchain data — token balances, NFT metadata, mempool visibility, and decoded transaction history — via their Agentic Gateway at https://x402.alchemy.com.
Alchemy’s x402 gateway uses SIWE wallet authentication via their own @alchemy/x402 CLI — not a generic x402 bazaar endpoint. Follow the setup steps below before making requests.
Step 1 — Install and set up a wallet:
Terminal
npx @alchemy/x402 wallet generate
Step 2 — Generate a SIWE auth token:
Terminal
npx @alchemy/x402 sign --private-key ./wallet-key.txt > siwe-token.txt
Step 3 — Fetch token balances on Base:
Terminal
TOKEN=$(cat siwe-token.txt)

curl -s -X POST "https://x402.alchemy.com/base-mainnet/v2" \
  -H "Content-Type: application/json" \
  -H "Authorization: SIWE $TOKEN" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "alchemy_getTokenBalances",
    "params": ["0xYourAddress"]
  }'
If the gateway returns 402, handle payment with the CLI and retry:
Terminal
PAYMENT_SIG=$(npx @alchemy/x402 pay --private-key ./wallet-key.txt --payment-required "$PAYMENT_REQUIRED")
See the full Alchemy Agentic Gateway skill for wallet bootstrap, payment handling, and SDK integration.

Making data calls inside an OpenClaw agent

Install the Sponge Wallet skill or CDP Agentic Wallet skills, then prompt your agent directly:
Get the current prices of ETH, BTC, and SOL from a paid data source
Check the token balances at 0xYourWatchAddress on Base
The agent handles service discovery, payment, and data extraction. For a custom implementation using x402-axios:
Terminal
npm install x402-axios axios
TypeScript
import { withPaymentInterceptor } from "x402-axios";
import axios from "axios";

// walletClient must be a viem-compatible WalletClient
const client = withPaymentInterceptor(axios.create(), walletClient);

// If the endpoint returns 402, the interceptor pays automatically and retries
const response = await client.get("https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd");
console.log(response.data);
The interceptor handles the full 402 → pay → retry flow. For wiring a viem WalletClient to your setup, see the x402 client docs.

Trade execution

Execute swaps using Flashblocks timing and Base fee calibration.

x402 protocol

Full x402 flow, supported networks, and error handling.