Getting Started

Getting Started with the Cambrian API

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. 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. Contact the Cambrian team to obtain your API key by filling out this form: https://form.typeform.com/to/FlAoEzva
  2. Store your API key securely (never expose it in client-side code)
  3. Include it in all requests as shown below

Base URL

The base URL for all Solana API endpoints is:

https://opabinia.cambrian.network/api/v1/solana

Example Request with Authentication

curl -X GET "https://opabinia.cambrian.network/api/v1/solana/latest-block" \
  -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 -H "X-API-Key: YOUR_API_KEY" \
  "https://opabinia.cambrian.network/api/v1/solana/latest-block"

Get Current Price for a Token

curl -H "X-API-Key: YOUR_API_KEY" \
  "https://opabinia.cambrian.network/api/v1/solana/price-current?token_address=So11111111111111111111111111111111111111112"

List Available Tokens

curl -H "X-API-Key: YOUR_API_KEY" \
  "https://opabinia.cambrian.network/api/v1/solana/tokens?limit=10&offset=0"

Workflow Example 1: Token Research & Analysis

List high‑volume trending tokens, pull comprehensive details for a chosen token, then retrieve 24‑hour trading stats to gauge market activity.

  1. Discover Tokens

    curl -H "X-API-Key: YOUR_API_KEY" \
      "https://opabinia.cambrian.network/api/v1/solana/trending-tokens?order_by=volume_usd_24h&limit=10"
    
  2. Get Token Details

    curl -H "X-API-Key: YOUR_API_KEY" \
      "https://opabinia.cambrian.network/api/v1/solana/token-details?token_address=TOKEN_ADDRESS"
    
  3. Analyze Token Trading

    curl -H "X-API-Key: YOUR_API_KEY" \
      "https://opabinia.cambrian.network/api/v1/solana/trade-statistics?token_addresses=TOKEN_ADDRESS&timeframe=24h"
    

Workflow Example 2: 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.

  1. Find Pools for a Token

    curl -H "X-API-Key: YOUR_API_KEY" \
      "https://opabinia.cambrian.network/api/v1/solana/token-pool-search?token_address=TOKEN_ADDRESS&limit=10"
    
  2. Get Pool Details (Orca Example)

    curl -H "X-API-Key: YOUR_API_KEY" \
      "https://opabinia.cambrian.network/api/v1/solana/orca/pool?pool_address=POOL_ADDRESS"
    
  3. Analyze Pool Performance

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

Workflow Example 3: Portfolio Tracking

Get a wallet's current token balances and track historical balance changes for selected assets over a defined period.

  1. Get Wallet Token Balances

    curl -H "X-API-Key: YOUR_API_KEY" \
      "https://opabinia.cambrian.network/api/v1/solana/holder-token-balances?holder=WALLET_ADDRESS&limit=20"
    
  2. Track Balance Changes

    curl -H "X-API-Key: YOUR_API_KEY" \
      "https://opabinia.cambrian.network/api/v1/solana/wallet-balance-history?wallet_address=WALLET_ADDRESS&token_address=TOKEN_ADDRESS&after_time=UNIX_TIMESTAMP&before_time=UNIX_TIMESTAMP"
    

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://opabinia.cambrian.network/api/v1/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://opabinia.cambrian.network/api/v1/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

  1. Explore the Full API Reference: Visit docs.cambrian.org for detailed documentation on all endpoints
  2. Check the OpenAPI Specification: View the complete schema at opabinia.cambrian.org/openapi.json
  3. Join the Community: Connect with other developers and get support on Discord