Cambrian Token Price (Unix) API

By Cambrian Network solana

GET /api/v1/solana/price-unix

Token Price (Unix)

Overview

Retrieve historical price data for a specified Solana token at the nearest hour to a specific Unix timestamp. Returns the price, actual update time, and 24-hour price change, making it well suited for time-specific price analysis, backtesting, and historical data queries.

Business Value

  • Historical Analysis: Access accurate price data for any specific point in time for backtesting and analysis
  • Time-Series Research: Build comprehensive datasets for token price movements and volatility studies
  • Portfolio Tracking: Calculate exact portfolio values at specific timestamps for performance analysis
  • Data Integration: Seamlessly integrate historical price data into trading algorithms and research platforms
  • Precise Timestamps: Get hour-level granular price data with UTC timestamp alignment for global consistency

Endpoint Details

URL:

https://api.cambrian.org/solana/price-unix

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

Query Parameters

Parameter Type Required Default Description
token_address String Yes - Solana token mint address (base58 format). Example: So11111111111111111111111111111111111111112
unixtime Integer Yes - Hour in unix timestamp to query price for (0 to 10000000000, rounded down to the nearest hour). Example: 1750110000

Response Field Descriptions

Response Field Type Description
tokenAddress String Solana token mint address that was queried
updateUnixTime UInt32 Unix timestamp (nearest hour) at which the price was recorded
updateUTCTime String Human-readable UTC timestamp corresponding to updateUnixTime
priceUSD Float64 Token price in USD at the given hour
change24h Float64 Percentage price change over the 24 hours leading up to updateUnixTime
dataSource String Source classification of the data (e.g., historical)
availability String Availability status of the data point (e.g., available)

Examples

1. Historical Price for Wrapped SOL

Retrieve the USD price of Wrapped SOL (SOL) at a specific historical hour, useful for backtesting a trade that occurred at that time.

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

Response:

[
  {
    "columns": [
      { "name": "tokenAddress", "type": "String" },
      { "name": "updateUnixTime", "type": "UInt32" },
      { "name": "updateUTCTime", "type": "String" },
      { "name": "priceUSD", "type": "Float64" },
      { "name": "change24h", "type": "Float64" },
      { "name": "dataSource", "type": "String" },
      { "name": "availability", "type": "String" }
    ],
    "data": [
      [
        "So11111111111111111111111111111111111111112",
        1750107600,
        "2025-06-16T21:00:00Z",
        157.03180938284908,
        5.096096498184193,
        "historical",
        "available"
      ]
    ],
    "rows": 1
  }
]

The requested unix time (1750110000) was rounded down to the nearest hour (1750107600, i.e. 2025-06-16T21:00:00Z), at which point SOL traded at approximately $157.03, up ~5.10% over the prior 24 hours.

2. Historical Price for a Stablecoin (USDC)

Retrieve the historical price of USDC at the same hour to verify stablecoin peg stability over time.

curl -X GET "https://api.cambrian.org/solana/price-unix?token_address=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&unixtime=1750110000" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response:

[
  {
    "columns": [
      { "name": "tokenAddress", "type": "String" },
      { "name": "updateUnixTime", "type": "UInt32" },
      { "name": "updateUTCTime", "type": "String" },
      { "name": "priceUSD", "type": "Float64" },
      { "name": "change24h", "type": "Float64" },
      { "name": "dataSource", "type": "String" },
      { "name": "availability", "type": "String" }
    ],
    "data": [
      [
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        1750107600,
        "2025-06-16T21:00:00Z",
        0.9999439763517698,
        -0.0013210433825215158,
        "historical",
        "available"
      ]
    ],
    "rows": 1
  }
]

At the same historical hour, USDC traded at approximately $0.99994, confirming the stablecoin held close to its $1.00 peg with a negligible 24-hour change of -0.0013%.

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://x402.cambrian.org/solana/price-unix"
);
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://x402.cambrian.org/solana/price-unix")
        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

  • /solana/price-current - Retrieves the latest available USD price for a given Solana token program address
  • /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.
  • /solana/price-multi - Retrieves the latest available USD prices for multiple Solana token program addresses (comma-separated)
  • /solana/price-volume/single - Retrieve current USD price, timeframe volume, and percentage changes for any SPL token.
  • /solana/price-volume/multi - Retrieve current USD price, timeframe volume, and percentage changes for any SPL token (batch).