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 and create a CDP Client API key.1. Write a query
Our example retrieves the most recent indexed event from thebase.events
table.
2. Run a query
The SQL API/run
endpoint accepts this query as a string value. Before running, replace $CLIENT_TOKEN
with your CDP Client API key.
What to read next
- Schema reference: Familiarize yourself with our supported tables for SQL queries.