x402 support is currently in beta. Endpoints, pricing, and supported networks may change. Join the Mobula Telegram to report issues or share feedback.
Endpoints
| Endpoint | Data returned | Price per call |
|---|---|---|
GET /x402/market/details | DEX pool price, liquidity, volume, and trade metrics | $0.001 USDC |
GET /x402/token/details | Token price, market cap, holder stats, and security flags | $0.001 USDC |
GET /x402/cefi/funding-rate | Perpetual funding rates across Binance, Bybit, OKX, Deribit, Hyperliquid, Gate, and Lighter | $0.001 USDC |
How Payment Works
On the first request (no payment), the server returns402 Payment Required with a payment-required header describing what to pay, on which network, and to which address. Your client signs the USDC transfer and retries with an x-payment header. The server verifies and settles on-chain, then returns the data. The entire handshake happens within your existing HTTP client — no wallet UI, no browser extension.
TypeScript — Base Mainnet (EVM)
x402 endpoints require a cryptographically signed USDC transfer in the request header — a standardfetch call cannot produce this on its own. The three packages below handle it:
| Package | Role |
|---|---|
@x402/core | Decodes the payment-required header and orchestrates the handshake |
@x402/evm | Signs the EIP-3009 transferWithAuthorization payload using your EVM wallet |
viem | Converts your private key into a compatible signer |
fetch.
- EVM private key (
0x…) — MetaMask: Account Details → Export Private Key - USDC on Base mainnet at
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 - ETH on Base for gas (a few cents covers hundreds of calls)
TypeScript — Solana Mainnet
The samemobulaFetch pattern works for Solana. The only difference is the signer — @x402/svm produces an SPL token transfer instead of an EIP-3009 payload.
- Solana private key in base58 format — Phantom or Backpack: Settings → Security → Export Private Key
- USDC on Solana mainnet at
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v - SOL for transaction fees
Exposing as Agent Tools
RegistermobulaFetch once at agent startup, then wrap each endpoint in a named function. The x402 Bazaar extension embedded in the 402 response includes a machine-readable JSON schema of the response, so an agent can inspect what it will receive before committing to payment.
Verifying the Flow End-to-End
Two ready-made scripts in the repository exercise the complete 402 → sign → settle cycle against the live API. Run either one to confirm your wallet and USDC balance are configured correctly before integrating into your application. Solana mainnet/tmp/x402-response.json.