Getting Started

Getting Started

The Cambrian API is a comprehensive blockchain and DeFi data API that provides real-time and historical financial intelligence across major protocols. We currently support Solana and Base. This guide will help you get started with your first API calls and understand the powerful DeFi analytics capabilities at your fingertips.

Getting Your API Key

  1. Sign up for a free Cambrian API key at the following link
  2. Store your API key securely (never expose it in client-side code)
  3. Include it in all requests as shown below

Cambrian CLI & MCP

We have a CLI and an MCP so that any agent, including Claude Code, Codex, and Cursor, can access Cambrian’s financial intelligence easily. We recommend getting started with them to leverage the API.

Cambrian’s CLI and MCP authentication follow the BYOK (bring your own key) approach. You just need to add your API key.

Follow our guides:

Solana

The base URL for all Solana API endpoints is:

https://api.cambrian.org/solana

Example Request with Authentication

curl -X GET "https://api.cambrian.org/solana/token-details?token_address=So11111111111111111111111111111111111111112" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"

Replace YOUR_API_KEY with your actual API key.

Base

The base URL for all Base API endpoints is:

https://api.cambrian.org/evm

Base's chain_id is 8453

Example Request with Authentication

curl -X GET "https://api.cambrian.org/evm/lending/morpho/curators" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"

Replace YOUR_API_KEY with your actual API key.

Core Concepts & Quick Start

Your First API Calls

Let's start with some basic examples to get you familiar with the API:

Get the Latest Block Information

curl -X GET "https://api.cambrian.org/solana/latest-block" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"

Get Current Price for a Token

curl -X GET "https://api.cambrian.org/solana/price-current?token_address=So11111111111111111111111111111111111111112" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"

List Available Tokens

curl -X GET "https://api.cambrian.org/solana/tokens" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"

Workflow Example: Pool Analysis

Query pools for a specific Solana token, pull detailed info on the chosen pool, then fetch recent fee metrics to evaluate its performance.

Step 1: Find Pools for a Token

curl -X GET "https://api.cambrian.org/solana/token-pool-search?token_address=TOKEN_ADDRESS&limit=10" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"

Step 2: Get Pool Details (Orca Example)

curl -H "X-API-Key: YOUR_API_KEY" \
  "https://api.cambrian.org/solana/orca/pool?pool_address=POOL_ADDRESS"

Step3: Analyze Pool Performance

curl -H "X-API-Key: YOUR_API_KEY" \
  "https://api.cambrian.org/solana/orca/pools/fee-metrics?pool_address=POOL_ADDRESS&timeframe_days=7"

Advanced Features

Time-Bounded Queries

For precise historical analysis, use time-bounded endpoints:

# Get transactions between specific timestamps
curl -H "X-API-Key: YOUR_API_KEY" \
  "https://api.cambrian.org/solana/token-transactions-time-bounded?token_address=TOKEN_ADDRESS&after_time=1753988933&before_time=1754248133"

Pagination

Most list endpoints support pagination:

curl -H "X-API-Key: YOUR_API_KEY" \
  "https://api.cambrian.org/solana/tokens?limit=50&offset=100"

Error Handling

The API uses standard HTTP status codes:

  • 200: Success
  • 400: Bad Request (check parameters)
  • 401: Unauthorized (invalid API key)
  • 404: Not Found
  • 429: Too Many Requests (rate limit exceeded)
  • 500: Internal Server Error

Example error response:

{
  "error": "Invalid token address",
  "message": "The provided token address is not valid",
  "status": 400
}

Best Practices

  • Use batch endpoints (price_multi, pool_multi) when possible
  • Use pagination for large datasets

Next Steps

  • Explore the Full API Reference: Visit docs.cambrian.org for detailed documentation on all endpoints
  • Get a Cambrian API key for free: Create an account at the following link, get your API key and start making queries.