Skip to main content

Overview

The SQL API allows you to create custom queries to pull real-time and historical onchain data from Base. In this quickstart, you will learn how to:
  • Read and use the tables in CDP’s curated schema.
  • Pull data from the Base blockchain with a SQL query. ​

Prerequisites

Sign in to the CDP Portal.
Using the SQL Playground? No API keys needed!Using the API programmatically? Create a free CDP Client API key for the cURL example below.

1. Try it in the playground

Use our SQL API to query onchain data in milliseconds. With SQL API, you can:
  • Query transactions, events, blocks, and transfers across Base with < 500ms latency
  • Join data across tables for complex analytics
  • Track token flows, smart contract activity, and wallet behavior
The fastest way to query onchain data is through the SQL Playground in CDP Portal.
1

Open SQL Playground

Navigate to the SQL Playground in Portal.
2

Try a query

Copy this query to see recent USDC transfers on Base:
See results in milliseconds! ⚡
SQL Playground query results showing USDC transfers

2. Run a query programmatically

The SQL API /run endpoint accepts your query as a string value. Before running, replace $CLIENT_TOKEN with your CDP Client API key.
After running the above, you should see a similar response to the following: