The SQL API is a zero-infrastructure indexing solution that allows any developer to pull real-time and historical onchain data on Base using custom SQL queries. Unlike Wallet History API which provides fixed endpoints for wallet data, SQL API gives you complete flexibility to query any blockchain data. Developers can access our SQL API through either the CDP SDK or CDP’s REST endpoints.

Key Features

  • Zero Infra: No setup, no guesswork. Just real-time indexed onchain data.
  • Customizable: Leverage familiar SQL syntax to pull custom data.
  • Responsive: Pull custom onchain data with < 500ms latency.
  • Fresh: < 250ms end-to-end from tip of chain.

Use Cases

  • Payment Service Providers: Track real-time stablecoin transactions for merchants, consumers, and marketplaces.
  • Portfolio & Treasury: Give users and institutions a live view of wallet balances and historical flows. Build dashboards that update instantly as funds move across chains, protocols, and counterparties.
  • Onchain Games: Track player inventory, asset upgrades, and progression in real time as NFT metadata evolves. Enable game mechanics that reflect actual onchain state — not stale snapshots.
  • Onchain Social: Monitor user interactions like tips, follows, and reactions across decentralized social graphs. Surface meaningful engagement and value transfer between users, apps, and agents.

Schema

The SQL API runs queries against an opinionated schema for efficient organization and response delivery. You can read more in our schema reference.

Try it out

Visit the SQL Playground in the CDP Portal to explore how you can create and execute queries.

Support and feedback

Join #onchain-data in the CDP Discord to access FAQs, schedule project discussions, and connect with other developers. We welcome your feedback and suggestions for improvement.