Cambrian Holder Token Balances (USD) API

By Cambrian Network solana

GET /api/v1/solana/holder-token-balances

Holder Token Balances (USD)

Overview

This endpoint returns token balances in USD for a specific user wallet on Solana, sorted by balance descending. It provides a quick snapshot of all SPL tokens held by a wallet along with their raw balances and current USD valuations.

Business Value

  • Portfolio Management: Track the complete token portfolio value across different assets for investment analysis
  • Risk Assessment: Monitor token concentration and diversification for risk management purposes
  • Financial Reporting: Generate accurate USD valuations for accounting and tax reporting requirements
  • Trading Decisions: Make informed trading decisions based on current holdings and their market values
  • Wealth Tracking: Monitor overall portfolio performance and changes in token values over time

Endpoint Details

URL:

https://api.cambrian.org/solana/holder-token-balances

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

Query Parameters

Parameter Type Required Default Description
wallet_address string Yes - Wallet address
limit integer No 10 Limit the number of results. Minimum: 1. Maximum: 300.
offset integer No 0 Offset the results, allows you to skip a number of rows before starting to return rows. Minimum: 0. Maximum: 100000000.

Response Field Descriptions

Response Field Type Description
tokenAddress FixedString(44) SPL token mint address
balanceRaw UInt64 Raw token balance held by the wallet (smallest unit, not adjusted for decimals)
balanceUSD Float64 Current USD value of the held balance for this token

Examples

1. Retrieve Wallet Token Balances in USD

This example retrieves the SPL token balances for a given Solana wallet address, sorted by USD value descending, with results limited to 10 rows.

curl -X GET "https://api.cambrian.org/solana/holder-token-balances?wallet_address=7VHUFJHWu2CuExkJcJrzhQPJ2oygupTWkL2A2For4BmE&limit=10" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response:

[
  {
    "columns": [
      {
        "name": "tokenAddress",
        "type": "FixedString(44)"
      },
      {
        "name": "balanceRaw",
        "type": "UInt64"
      },
      {
        "name": "balanceUSD",
        "type": "Float64"
      }
    ],
    "data": [
      [
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        34722845,
        34.722845
      ],
      [
        "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN",
        33386592,
        8.433347174884306
      ],
      [
        "WCTk5xWdn5SYg56twGj32sUF3W4WFQ48ogezLBuYTBY",
        132731167683,
        3.756470927376151
      ],
      [
        "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
        2000000,
        2
      ],
      [
        "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN",
        280000,
        0.2676504931905329
      ],
      [
        "DRvPqvmHhcSSNbgGvjjquntKuucceVRWxsxRDEuyBqT3",
        198022663070078,
        0
      ],
      [
        "CeUneGP8DUfu8JAgSJBxoWB9xho14i4jjZWpbbvfaink",
        25000000000000000,
        0
      ],
      [
        "CNKSdeoP5yqkhW5q94iqZWvGNN4WS3G8y41dcb1vBePv",
        85000000,
        0
      ],
      [
        "79rxYdGFH9wgkQChVQnyonemFBfcoAys6L3m5myFSTa9",
        330000000000000,
        0
      ],
      [
        "vW7QhFDY3dat6ESbPWLPAxv2opPxeciHFnrCnmuzphs",
        4000000000000,
        0
      ]
    ],
    "rows": 10
  }
]

Note: Result collections are limited to 10 items.

This wallet's largest USD holding is USDC (EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v) at approximately $34.72, followed by Jupiter (JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN) at roughly $8.43. Several lower-ranked tokens show a balanceUSD of 0, indicating either a negligible value or an unavailable price for that token.

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/holder-token-balances"
);
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/holder-token-balances")
        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