Skip to main content

What is x402?

x402 is an open standard introduced by Coinbase. It uses the HTTP 402 Payment Required status code to allow machines (such as AI Agents) to automatically complete on-chain micropayments when initiating API requests. Payments are made using stablecoins (like USDC), with instant, transparent settlement and no need for trusted intermediaries.

Pricing

All Chainbase Web3 API endpoints accessed via x402 are charged at a flat rate: No subscriptions, no monthly fees — just pay per request with your wallet.

Supported Endpoints

All Chainbase Web3 API endpoints support x402 access. See the API Reference for the complete list of available endpoints.

Integration Steps (Python Example)

Install Dependencies

Prepare Your Private Key

Please ensure you have an Ethereum wallet with sufficient USDC (it is recommended to use a testnet or mainnet cold wallet). Never expose your real private key in public code!

Initialize x402 Session

Call Chainbase API

For all Chainbase Web3 API endpoints, simply add x-api-key: x402 to the request header. The rest of the usage is consistent with the standard API.

Use Cases

  • AI Agent automatically monitors token address changes: Query once per hour, pay per request, no monthly fee required.
  • One-time data fetching: Analyze a specific Token project, call only once, and pay just $0.002.
  • Experimental development: No need to register an enterprise account, pay directly with a wallet to test interfaces.

Next Steps