Cambrian Token Price (Current) API

By Cambrian Network solana

GET /api/v1/solana/price-current

Token Price (Current)

Retrieves the latest available USD price for a given Solana token program address. This endpoint provides real-time pricing data for any SPL token on the Solana blockchain, aggregated across major DEX platforms to ensure accurate and up-to-date market information.

Business Value

  • Real-time Price Discovery - Get instant access to current market prices for any Solana token
  • Portfolio Valuation - Calculate accurate portfolio values using real-time token prices
  • Trading Decision Support - Enable trading algorithms and applications with current price data
  • Market Analysis - Support price monitoring and analysis workflows
  • DeFi Integration - Power DeFi applications requiring current token valuations

Endpoint Details

URL:

https://opabinia.cambrian.network/api/v1/solana/price-current

Method: GET
Authentication: Required via X-API-Key header

Query Parameters

Parameter Type Required Default Description
token_address string Yes - The Solana token program address (base58 string). Must be a valid Solana address between 32-44 characters

Response Field Descriptions

Response Field Type Description
tokenAddress string The Solana token program address
symbol string The token symbol (e.g., SOL, USDC)
priceUSD number Current USD price of the token

Examples

1. Get Current SOL Price

Get the latest USD price for Solana's native token (SOL).

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

Response:

{
  "columns": [
    {
      "name": "tokenAddress",
      "type": "String"
    },
    {
      "name": "symbol",
      "type": "String"
    },
    {
      "name": "priceUSD",
      "type": "Float64"
    }
  ],
  "data": [
    [
      "So11111111111111111111111111111111111111112",
      "SOL",
      126.84264001904396
    ]
  ],
  "rows": 1
}

The response returns the current price of SOL at approximately $126.84 USD, formatted in a columnar structure with the token address, symbol, and USD price.

x402 Payment Option

This endpoint supports pay-per-use access via the x402 payment protocol (v2) — pay $0.05 USDC per request using blockchain micropayments. No API key required.

Quick Start (TypeScript)

npm install @x402/fetch @x402/evm viem
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const signer = privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`);
const client = new x402Client();
client.register("eip155:*", new ExactEvmScheme(signer));

const fetchWithPayment = wrapFetchWithPayment(fetch, client);
const response = await fetchWithPayment(
  "https://deep42.cambrian.network/api/v1/solana/price-current"
);
const data = await response.json();

Quick Start (Python)

pip install "x402[httpx]"
import asyncio, os
from eth_account import Account
from x402 import x402Client
from x402.http.clients import x402HttpxClient
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client

async def main():
    client = x402Client()
    account = Account.from_key(os.getenv("EVM_PRIVATE_KEY"))
    register_exact_evm_client(client, EthAccountSigner(account))

    async with x402HttpxClient(client) as http:
        response = await http.get("https://deep42.cambrian.network/api/v1/solana/price-current")
        print(response.json())

asyncio.run(main())

Payment Flow

  1. Send a normal request to the endpoint (no API key needed)
  2. Server returns 402 Payment Required with payment details
  3. The x402 SDK automatically signs a payment authorization with your wallet
  4. The SDK resubmits the request with the signed payment
  5. Server verifies payment and returns the API response

The x402 SDK handles steps 2–5 automatically.

Network: Base (chain ID 8453) | Currency: USDC | Price: $0.05 per request


Related Endpoints

  • /api/v1/solana/price-multi - Retrieves the latest available USD prices for multiple Solana token program addresses (comma-separated)
  • /api/v1/solana/price-hour - Aggregated USD price of a Solana token by program address, grouped by the specified interval (e.g., 1H, 1D, 1W, etc). Returns the average price for each interval
  • /api/v1/solana/price-unix - Retrieve historical price data for a specified Solana token at the nearest hour to a specific Unix timestamp
  • /api/v1/solana/price-volume/single - Retrieve current USD price, timeframe volume, and percentage changes for any SPL token
  • /api/v1/solana/price-volume/multi - Retrieve current USD price, timeframe volume, and percentage changes for any SPL token (multiple tokens)