Cambrian Wallet Token Balance History API
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. Each entry includes transaction details, pre- and post-balances, and timing information, giving a complete audit trail of portfolio changes. Use it for portfolio tracking and compliance monitoring.
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: 10000) |
| offset | integer | No | 0 | Offset the results, allows you to skip a number of rows before starting to return rows. (min: 0, max: 100000000) |
| order_asc | array | No | - | List of column names to order by in ascending order divided by comma. Leave empty items to combine with descending order. Allowed values: txHash, slot, blockTime, blockHumanTime, tokenAddress, tokenSymbol, tokenDecimals, preBalance, postBalance, changeAmount, uiPreBalance, uiPostBalance, uiChangeAmount |
| order_desc | array | No | - | List of column names to order by in descending order divided by comma. Leave empty items to combine with ascending order. Allowed values: txHash, slot, blockTime, blockHumanTime, tokenAddress, tokenSymbol, tokenDecimals, preBalance, postBalance, changeAmount, uiPreBalance, uiPostBalance, uiChangeAmount |
Response Field Descriptions
| Response Field | Type | Description |
|---|---|---|
| txHash | String | Transaction signature/hash associated with the balance change |
| slot | UInt64 | Solana slot number in which the transaction was processed |
| blockTime | UInt64 | 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 | UInt8 | Number of decimal places for the token |
| preBalance | UInt64 | Raw token balance before the change |
| postBalance | UInt64 | Raw token balance after the change |
| changeAmount | Int64 | Raw change in balance (can be negative) |
| uiPreBalance | Float64 | Human-readable (decimal-adjusted) balance before the change |
| uiPostBalance | Float64 | Human-readable (decimal-adjusted) balance after the change |
| uiChangeAmount | Float64 | Human-readable (decimal-adjusted) change in balance |
Examples
1. Retrieve wallet balance history for a token within a time range
This example retrieves balance change history for a specific wallet's holdings of a token (wrapped SOL) within a defined Unix time 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 example, no balance change records matched the specified wallet, token, and time range, so columns and data come back empty and rows is 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
- Send a normal request to the endpoint (no API key needed)
- Server returns
402 Payment Requiredwith payment details - The x402 SDK automatically signs a payment authorization with your wallet
- The SDK resubmits the request with the signed payment
- 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