Skip to main content
GET
{EP_STATEMENT_AVAILABLE_TOKEN}
Get Token Statement
curl --request GET \
  --url https://api.example.com/{EP_STATEMENT_AVAILABLE_TOKEN}
{
  "data": {
    "currency": {
      "id": "<string>",
      "name": "<string>",
      "decimals": 123,
      "allowTransfers": true,
      "disabled": true,
      "priority": 123
    },
    "quoteCurrency": {},
    "amount": "<string>",
    "estPrice": "<string>",
    "estValue": "<string>"
  },
  "status": 123
}
Retrieve detailed statement information for a specific cryptocurrency or token. This endpoint provides the available balance, current price, and estimated value for an individual token.

Endpoint Pattern

The endpoint URL includes a token parameter:
{EP_STATEMENT_AVAILABLE_TOKEN}
The %TOKEN placeholder in the endpoint URL is replaced with the specific token symbol (e.g., BTC, ETH, USDT).

Path Parameters

token
string
required
The token symbol to retrieve statement forExamples: "BTC", "ETH", "USDT", "SOL"

Polling Configuration

This endpoint supports automatic polling for real-time balance updates:
  • Stale Time: 5 minutes (300,000ms)
  • Default Poll Interval: Configurable via pollIntervalMs parameter
  • Background Polling: Enabled when pollIntervalMs > 0

Authentication

Requires valid session authentication. The endpoint automatically includes credentials from the active session.

Response

The response contains detailed information about the specified token’s available balance and valuation.
data
object
required
Token statement data
status
number
required
HTTP status codeExample: 200

Example Request

# Get Bitcoin statement
GET {EP_STATEMENT_AVAILABLE_TOKEN}/BTC

# Get Ethereum statement  
GET {EP_STATEMENT_AVAILABLE_TOKEN}/ETH

# Get USDT statement
GET {EP_STATEMENT_AVAILABLE_TOKEN}/USDT

Example Response

Bitcoin (BTC) Statement

{
  "data": {
    "currency": {
      "id": "BTC",
      "name": "Bitcoin",
      "decimals": 8,
      "allowTransfers": true,
      "disabled": false,
      "priority": 3
    },
    "quoteCurrency": {
      "id": "USDT",
      "name": "Tether",
      "decimals": 2,
      "allowTransfers": true,
      "disabled": false,
      "priority": 3
    },
    "amount": "0.0083506",
    "estPrice": "91141.05",
    "estValue": "761.08"
  },
  "status": 200
}

Ethereum (ETH) Statement

{
  "data": {
    "currency": {
      "id": "ETH",
      "name": "Ethereum",
      "decimals": 8,
      "allowTransfers": true,
      "disabled": false,
      "priority": 2
    },
    "quoteCurrency": {
      "id": "USDT",
      "name": "Tether",
      "decimals": 2,
      "allowTransfers": true,
      "disabled": false,
      "priority": 3
    },
    "amount": "0.04256646",
    "estPrice": "3143.105",
    "estValue": "133.79"
  },
  "status": 200
}

TypeScript Types

import { z } from "zod";
import { AvailableTokenDataSchema } from "./availables-data";

export type AvailableTokenData = z.infer<typeof AvailableTokenDataSchema>;

export const availableTokenDataResponseSchema = z.object({
  data: AvailableTokenDataSchema,
  status: z.number(),
});

export type AvailableTokenDataResponse = z.infer<
  typeof availableTokenDataResponseSchema
>;

// Formatted UI type
export type AvailablesDataItemUI = {
  id: string;
  name: string;
  amount: string;
  value: string;
};

Usage Example

import { useAvailableToken } from '@/services/hooks/use-available-token';

function TokenStatementComponent({ tokenSymbol }: { tokenSymbol: string }) {
  const userId = "user-123";
  const pollInterval = 30000; // Poll every 30 seconds
  
  const { data: tokenData, isLoading, error } = useAvailableToken(
    userId,
    tokenSymbol,
    pollInterval
  );
  
  if (isLoading) return <div>Loading {tokenSymbol} balance...</div>;
  if (error) return <div>Error loading {tokenSymbol} balance</div>;
  
  return (
    <div>
      <h1>{tokenData?.name} Statement</h1>
      <p>Symbol: {tokenData?.id}</p>
      <p>Amount: {tokenData?.amount}</p>
      <p>Value: ${tokenData?.value}</p>
    </div>
  );
}

// Usage
<TokenStatementComponent tokenSymbol="BTC" />
<TokenStatementComponent tokenSymbol="ETH" />

Data Formatting

The hook automatically formats the raw API response into a simplified UI structure:
// Raw API response is transformed to:
{
  id: "BTC",           // currency.id
  name: "Bitcoin",     // currency.name
  amount: "0.0083506", // amount
  value: "761.08"      // estValue
}

Error Handling

The endpoint handles various error scenarios:

Token Not Found

If the specified token doesn’t exist in the available tokens list, the endpoint will throw an error:
Error: Available token not found for token: INVALID

Fallback to Mock Data

The endpoint gracefully falls back to mock data when:
  • Network requests fail
  • Authentication is invalid
  • The session mode is set to “mock”

Common Use Cases

Display Single Token Balance

function BitcoinBalance() {
  const { data } = useAvailableToken(userId, "BTC", 30000);
  return <div>BTC Balance: {data?.amount}</div>;
}

Compare Multiple Tokens

function TokenComparison() {
  const { data: btc } = useAvailableToken(userId, "BTC", 30000);
  const { data: eth } = useAvailableToken(userId, "ETH", 30000);
  
  return (
    <div>
      <h2>Portfolio Comparison</h2>
      <p>BTC Value: ${btc?.value}</p>
      <p>ETH Value: ${eth?.value}</p>
    </div>
  );
}

Watch for Balance Changes

import { useEffect } from 'react';

function BalanceMonitor({ token }: { token: string }) {
  const { data } = useAvailableToken(userId, token, 5000); // Poll every 5s
  
  useEffect(() => {
    if (data) {
      console.log(`${token} balance updated:`, data.amount);
      // Trigger notifications or alerts based on balance changes
    }
  }, [data, token]);
  
  return <div>{token}: {data?.amount}</div>;
}

Supported Tokens

The endpoint supports all tokens available in the platform, including but not limited to:
  • Major Cryptocurrencies: BTC, ETH, SOL, ADA, DOT, AVAX
  • Stablecoins: USDT, USDC, DAI
  • Altcoins: LINK, UNI, AAVE, POL, LTC, TRX, XRP
  • Gaming/Metaverse: SAND, MANA, CHZ
  • Layer 1/2 Tokens: S (Sonic)

Build docs developers (and LLMs) love