How It Works
Understanding the API architecture helps you build better integrations.
Architecture Overviewโ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Client โ โโโโโโโบ โ Web3 Identity API โ โโโโโโโบ โ Data Sources โ
โ (Your App) โ โโโโโโโ โ (api.web3...) โ โโโโโโโ โ (DefiLlama, โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โ Neynar, etc) โ
โ โ โโโโโโโโโโโโโโโโโโโ
โ โ
โ โผ
โ โโโโโโโโโโโโโโโโโโโโโโโ
โ โ CDP Facilitator โ
โโโโโโโโโโโโโโโโโบโ (Base Network) โ
โ USDC Settlement โ
โโโโโโโโโโโโโโโโโโโโโโโ
Request Flowโ
1. Free Tierโ
Client โ API โ Response (if under 100 calls/day)
2. Paid Request (x402)โ
Client โ API โ 402 Response
Client โ Sign Payment โ API โ Settle on Base โ Response
Payment Protocol (x402)โ
The x402 protocol enables HTTP-native micropayments:
- Request โ You call an endpoint
- 402 Response โ If free tier exhausted, API returns payment requirements
- Sign โ You sign an EIP-712 authorization to transfer USDC
- Retry โ Send the same request with the signed payment
- Settle โ API settles the payment on Base via CDP
- Response โ You receive the data
Payment Flow Diagramโ
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ
โ Client โ โ API โ โ Base โ
โโโโโโฌโโโโโโ โโโโโโฌโโโโโโ โโโโโโฌโโโโโโ
โ โ โ
โ 1. GET /api/ens/nick.eth โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบโ โ
โ โ โ
โ 2. 402 Payment Required โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ (price, recipient, etc) โ โ
โ โ โ
โ 3. Sign EIP-712 โ โ
โ (local, no network) โ โ
โ โ โ
โ 4. Retry with X-PAYMENT โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบโ โ
โ โ 5. Verify + Settle โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโบโ
โ โ โ
โ โ 6. Confirmed โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ โ
โ 7. 200 OK + Data โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
Data Sourcesโ
The API aggregates data from multiple sources with automatic fallbacks:
| Category | Primary Source | Fallbacks |
|---|---|---|
| Prices | DefiLlama | CoinGecko, CoinCap, CoinPaprika |
| ENS | ENS Subgraph | Direct RPC |
| Farcaster | Neynar | โ |
| DeFi | DefiLlama | โ |
| Wallet | Alchemy | Etherscan |
Cachingโ
Responses are cached based on data volatility:
| Data Type | Cache TTL |
|---|---|
| Prices | 30 seconds |
| Gas | 15 seconds |
| ENS records | 5 minutes |
| DeFi TVL | 5 minutes |
| Fear & Greed | 1 hour |
Rate Limitingโ
| Tier | Daily Limit | Per Minute |
|---|---|---|
| Anonymous | 100 | 30 |
| SIWE | 200 | 60 |
| API Key | 500 | 30 |
Next Stepsโ
- Features โ See all capabilities
- Pricing โ Understand the cost model
- Quick Start โ Start building