Getting Started with the Cambrian API
Welcome to the Cambrian API! This guide will help you make your first API calls and understand the core functionalities.
Authentication
All requests to the Cambrian API require an API key. You must include your key in the x-api-key
header of every request.
Example using cURL:
curl -H "x-api-key: YOUR_API_KEY" "https://opabinia.cambrian.org/api/v1/evm/chains"
Replace YOUR_API_KEY
with your actual API key. You can obtain an API key from [Your Cambrian Dashboard Link - You'll need to add this link].
Base URL
The base URL for all API endpoints is:
https://opabinia.cambrian.org/api/v1
Core Concepts & Example Endpoints
The Cambrian API provides access to DeFi data across multiple blockchains, currently focusing on Solana and Base. Here are some key areas you can explore:
-
Supported Chains: Find out which blockchains are supported.
- Endpoint:
GET /evm/chains
- Example:
curl -H "x-api-key: YOUR_API_KEY" "https://opabinia.cambrian.org/api/v1/evm/chains"
- Endpoint:
-
Token Information: Get lists of tokens, their prices, and holder information.
- List all whitelisted tokens across chains:
GET /tokens
- Get hourly price for a specific token:
GET /price_hour?symbol=PEPE&limit=100
- List Solana tokens (paginated):
GET /solana/tokens?offset=0&limit=100
- List holders for a specific Solana token:
GET /solana/tokens/{programId}/holders
(e.g.,GET /solana/tokens/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/holders
)
- List all whitelisted tokens across chains:
-
DEX & Pool Data (Base Chain - Solana Coming Soon): Explore Decentralized Exchanges and Liquidity Pools.
- List available DEXes on Base:
GET /base/dexes
- List all pools for a specific DEX on Base:
GET /base/UniswapV3/pools
- Get detailed information for a specific pool on Base:
GET /base/pools/{poolAddress}
(e.g.,GET /base/pools/0x4c36388be6f416a29c8d8eee81c771ce6be14b18
)
- List available DEXes on Base:
Making Requests
You can interact with the API using standard HTTP requests from your preferred programming language or tools like cURL or Postman. Remember to always include your API key in the x-api-key
header.
Understanding Endpoint Relationships
Many Cambrian API endpoints provide identifiers needed to query other endpoints. Here's a common workflow:
-
Get Chain Information: Start with
GET /evm/chains
to find the supportedchain
identifiers (e.g.,base
,solana
). This identifier is needed for chain-specific endpoints. -
Find Tokens:
- Use
GET /tokens
to list all whitelisted tokens and find asymbol
(e.g.,PEPE
,WETH
) required for theGET /price_hour
endpoint. - Use
GET /solana/tokens
(with pagination) to find theprogramId
for a specific Solana token. ThisprogramId
is needed for theGET /solana/tokens/{programId}/holders
endpoint.
- Use
-
Explore DEXes and Pools (Currently Base Chain):
- Use
GET /{chain}/dexes
(e.g.,GET /base/dexes
) to list DEXes available on a chain and get theirdex
name (e.g.,UniswapV3
). - Use
GET /{chain}/{dex}/pools
(e.g.,GET /base/UniswapV3/pools
) with the chain and DEX name to get a list ofpool
addresses. - Use
GET /{chain}/pools/{pool}
with the chain and a specificpool
address to get detailed pool metrics.
- Use
By using the outputs of broader endpoints (like /evm/chains
, /tokens
, /{chain}/dexes
) as inputs for more specific ones, you can effectively navigate the API.
Next Steps
- Explore the full API Reference for detailed information on all available endpoints, parameters, and response schemas. (You'll need to update this link)
Happy building!
Updated 1 day ago