Cambrian Wallet Token Balance History API

By Cambrian Network solana

GET /api/v1/solana/wallet-balance-history

Wallet Token Balance History

Overview

Returns a paginated list of balance changes for a specified Solana wallet address and token. Together, the records form a complete audit trail of portfolio changes, with transaction details, pre/post balances, and timing information for a given time range.

Business Value

  • Portfolio Tracking: Track detailed balance changes over time for comprehensive wallet monitoring and analysis
  • Compliance Monitoring: Provide complete audit trail of all token balance changes with transaction-level detail
  • Transaction Analysis: Analyze balance impact of each transaction with before/after balance states
  • Historical Analysis: Access complete historical balance data for research and backtesting purposes
  • Risk Management: Monitor wallet activity patterns and balance fluctuations for risk assessment

Endpoint Details

URL:

https://api.cambrian.org/solana/wallet-balance-history

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

Query Parameters

Parameter Type Required Default Description
wallet_address String Yes - Solana wallet address (base58 format, 32-44 characters)
token_address String Yes - Filter by specific token address (base58 format)
after_time Integer Yes - Unix timestamp - start time for data range
before_time Integer Yes - Unix timestamp - end time for data range
limit Integer No 100 Limit the number of results. (min 1, max 1000)
offset Integer No 0 Offset the results, allows you to skip a number of rows before starting to return rows. (min 0, max 100000)
order_asc Array[String] No - List of column names to order by in ascending order, comma-separated. Leave empty items to combine with descending order. Valid values: txHash, slot, blockTime, blockHumanTime, tokenAddress, tokenSymbol, tokenDecimals, preBalance, postBalance, changeAmount, uiPreBalance, uiPostBalance, uiChangeAmount
order_desc Array[String] No - List of column names to order by in descending order, comma-separated. Leave empty items to combine with ascending order. Valid values: txHash, slot, blockTime, blockHumanTime, tokenAddress, tokenSymbol, tokenDecimals, preBalance, postBalance, changeAmount, uiPreBalance, uiPostBalance, uiChangeAmount

Response Field Descriptions

Response Field Type Description
txHash String Transaction hash of the balance-changing transaction
slot UInt64 Solana slot number in which the transaction was processed
blockTime Integer Unix timestamp of the block containing the transaction
blockHumanTime String Human-readable timestamp of the block
tokenAddress String Token mint address for the balance change
tokenSymbol String Symbol of the token
tokenDecimals Integer Number of decimals used by the token
preBalance UInt64 Raw token balance immediately before the transaction
postBalance UInt64 Raw token balance immediately after the transaction
changeAmount Int64 Raw change in balance (postBalance - preBalance)
uiPreBalance Float Human-readable (decimal-adjusted) balance before the transaction
uiPostBalance Float Human-readable (decimal-adjusted) balance after the transaction
uiChangeAmount Float Human-readable (decimal-adjusted) change in balance

Examples

1. Query Wallet Balance History for a Token Over a Time Range

Retrieve balance change history for a specific wallet's holdings of a specific token (SOL) within a defined Unix timestamp range, limited to 10 results.

curl -X GET "https://api.cambrian.org/solana/wallet-balance-history?wallet_address=DKxRinQQhKnZcfdaSnKov5v4ja95pEncjBYU8ajzVgsW&token_address=So11111111111111111111111111111111111111112&after_time=1735689600&before_time=1735776000&limit=10" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"

Response:

[
  {
    "columns": [],
    "data": [],
    "rows": 0
  }
]

Result collections are limited to 10 items. In this case, no balance-change records were found for the specified wallet, token, and time range, so the response returns an empty column/data set with rows: 0.

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/wallet-balance-history"
);
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/wallet-balance-history")
        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 to 5 automatically.

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