Cambrian Token Price (Unix) API

By Cambrian Network solana

GET /api/v1/solana/price-unix

Token Price (Unix)

Overview

Retrieves historical price data for a Solana token at the hour nearest to a given Unix timestamp, returning the price, the actual update time, and the 24-hour price change. Useful 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
updateUnixTime UInt32 Unix timestamp (nearest hour) of the returned price
updateUTCTime String UTC timestamp of the returned price in ISO 8601 format
priceUSD Float64 Token price in USD at the given hour
change24h Float64 Percentage price change over the preceding 24 hours
dataSource String Source of the price data (e.g., historical)
availability String Availability status of the requested data point (e.g., available)

Examples

1. Retrieve Historical SOL Price at a Specific Hour

This example fetches the price of wrapped SOL at the hour nearest to the Unix timestamp 1750110000, useful for backtesting a trade or reconciling a historical portfolio value.

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
  }
]

Result collections are limited to 10 items. The response shows that at the hour nearest to the requested timestamp (rounded down to 2025-06-16T21:00:00Z), wrapped SOL traded at approximately $157.03, up 5.10% over the preceding 24 hours, with the data marked as historical and available.

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 through 5 automatically.

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