x402 — Pay-Per-Request API

Birdeye supports the x402 HTTP payment protocol, allowing AI agents and programmatic clients to access real-time DeFi data without API keys. Each request is paid individually on-chain using USDC on Solana.


How It Works

x402 extends HTTP 402 (Payment Required) into a machine-negotiable flow:

  1. Client sends a request without payment — server responds 402 Payment Required with a PAYMENT-REQUIRED header describing payment terms (price, network, recipient address).
  2. Client signs a Solana transaction fulfilling the payment terms and retries the request with a PAYMENT-SIGNATURE header.
  3. Server verifies and settles the payment via the Coinbase CDP facilitator, then returns the data along with a PAYMENT-RESPONSE header confirming settlement.

No API key. No subscription. No custody of funds — agents hold their own keys.


Base URL

https://public-api.birdeye.so

All x402 endpoints are prefixed with /x402.


Payment Details

ParameterValue
Schemeexact
Networksolana-mainnet
CurrencyUSDC
PricePer-request (see route configurations)
FacilitatorCoinbase CDP (https://api.cdp.coinbase.com/platform/v2/x402)
Max Timeout60 seconds

Quick Start

import { withPaymentInterceptor } from "@x402/fetch";

const fetch = withPaymentInterceptor(globalThis.fetch, {
  wallet: myWallet, // Solana wallet with USDC
});

const response = await fetch(
  "https://public-api.birdeye.so/x402/defi/token_overview?address=So11111111111111111111111111111111111111112"
);
const data = await response.json();

Protocol Headers

HeaderDirectionDescription
PAYMENT-REQUIREDServer → ClientBase64-encoded JSON with payment terms (on 402 response)
PAYMENT-SIGNATUREClient → ServerSigned payment payload for verification
PAYMENT-RESPONSEServer → ClientSettlement confirmation after successful payment

Extensions

Every x402 endpoint includes two extensions that enhance security and verifiability:

Payment Identifier (payment-identifier)

Enforces idempotency and prevents replay attacks. Each request must include a unique id in the payment extension.

id pattern: ^pay_[a-zA-Z0-9_-]{10,120}$

Offer & Receipt (offer-receipt)

Provides cryptographic commitment for payment terms and proof of service delivery:

  • Offer — signed before payment, commits the server to the price and service
  • Receipt — signed after successful delivery, provides an audit trail

Rate Limits

  • 100 requests/second per IP applied before payment verification.
  • Exceeding this returns 429 Too Many Requests.

Supported Endpoints

DeFi (v1) — /x402/defi

MethodPathDescription
GET/x402/defi/priceToken price
GET/x402/defi/history_priceHistorical price
GET/x402/defi/historical_price_unixHistorical price at Unix timestamp
GET/x402/defi/txs/tokenToken transactions
GET/x402/defi/txs/pairPair transactions
GET/x402/defi/txs/token/seek_by_timeToken transactions seek by time
GET/x402/defi/txs/pair/seek_by_timePair transactions seek by time
GET/x402/defi/ohlcvOHLCV candlestick data
GET/x402/defi/ohlcv/pairOHLCV data for a trading pair
GET/x402/defi/ohlcv/base_quoteOHLCV data by base/quote addresses
GET/x402/defi/tokenlistToken list
GET/x402/defi/token_trendingTrending tokens
GET/x402/defi/token_creation_infoToken creation information
GET/x402/defi/token_securityToken security analysis
GET/x402/defi/token_overviewToken overview
GET/x402/defi/price_volume/singleSingle token price and volume

DeFi v2 — /x402/defi/v2

MethodPathDescription
GET/x402/defi/v2/tokens/new_listingNew token listings
GET/x402/defi/v2/tokens/top_tradersTop traders for a token
GET/x402/defi/v2/marketsAll market list for a token

DeFi v3 — /x402/defi/v3

MethodPathDescription
GET/x402/defi/v3/token/meta-data/singleToken metadata (single)
GET/x402/defi/v3/pair/overview/singlePair overview (single)
GET/x402/defi/v3/token/market-dataToken market data
GET/x402/defi/v3/token/trade-data/singleToken trade data (single)
GET/x402/defi/v3/token/holderToken holders
GET/x402/defi/v3/searchSearch tokens and market data
GET/x402/defi/v3/token/mint-burn-txsToken mint/burn transactions
GET/x402/defi/v3/holder-stats/singleHolder statistics (single)
GET/x402/defi/v3/token/listToken list (v3)
GET/x402/defi/v3/all-time/trades/singleAll-time trades (single)
GET/x402/defi/v3/txs/recentRecent trades (v3)
GET/x402/defi/v3/txsAll trades (v3)
GET/x402/defi/v3/token/txsToken trades (v3)
GET/x402/defi/v3/txs/latest-blockLatest block number
GET/x402/defi/v3/token/exit-liquidityToken exit liquidity
GET/x402/defi/v3/token/meme/listMeme token list
GET/x402/defi/v3/token/meme/detail/singleMeme token detail (single)
GET/x402/defi/v3/token/txs-by-volumeToken trades filtered by volume
GET/x402/defi/v3/ohlcvOHLCV (v3)
GET/x402/defi/v3/ohlcv/pairOHLCV pair (v3)
GET/x402/defi/v3/price/stats/singlePrice stats (single)

Trader — /x402/trader

MethodPathDescription
GET/x402/trader/gainers-losersTop gainers and losers
GET/x402/trader/txs/seek_by_timeTrader transactions seek by time

Token — /x402/token/v1

Solana only.

MethodPathDescription
POST/x402/token/v1/transferToken transfer list
POST/x402/token/v1/transfer/totalToken transfer total

Holder — /x402/holder/v1

Solana only.

MethodPathDescription
GET/x402/holder/v1/distributionToken holder distribution

Smart Money — /x402/smart-money/v1

Solana only.

MethodPathDescription
GET/x402/smart-money/v1/token/listSmart money token list

Notes

  • Multi-address endpoints excluded — Routes that accept multiple addresses (e.g., /token/meta-data/multiple) are not available on the x402 API. Use the standard API with an API key for bulk operations.
  • Solana-only routes — Token, Holder, and Smart Money endpoints are restricted to the Solana chain.
  • Idempotent retries — If your request is retried with the same payment ID, the server returns a cached response without charging again (within the TTL window).
  • Replay protection — Payment IDs are stored in Redis. Reusing a payment ID with a different request is rejected.

Error Responses

StatusMeaning
402 Payment RequiredNo valid payment provided. Inspect the PAYMENT-REQUIRED header for terms.
429 Too Many RequestsIP rate limit exceeded (100 req/s).
503 Service UnavailablePayment validation service failed to initialize.

Resources