Skip to main content
GET
/
v1
/
wallet
/
history
[
  {
    "name": "Credit withdrawal",
    "amount": "10.00",
    "currency": "usdc",
    "sign": "debit",
    "date": "2024-02-02T15:01:09.091Z"
  },
  {
    "name": "Card purchase - Starbucks",
    "amount": "5.50",
    "currency": "usdc",
    "sign": "debit",
    "date": "2024-02-01T10:30:45.123Z"
  },
  {
    "name": "Deposit",
    "amount": "100.00",
    "currency": "usdc",
    "sign": "credit",
    "date": "2024-01-31T09:15:22.456Z"
  }
]

Overview

Retrieve paginated transaction history for any wallet type. Returns up to 10 transactions per page, ordered by date descending (newest first). Supports credit, reward, and internal wallet types with filtering and pagination. Use Cases:
  • Display transaction history to users
  • Generate transaction reports or statements
  • Audit wallet activity
  • Track deposits, withdrawals, and purchases
  • Reconcile balances

Authentication

x-client-key
string
required
Your public API client key
Authorization
string
required
Bearer token for authentication

Query Parameters

walletId
string
required
Wallet identifier obtained from wallet details endpoint (e.g., from GET /v1/wallet/credit, /v1/wallet/reward, or /v1/wallet/internal)
walletType
string
required
Type of wallet to query: CREDIT, REWARD, or INTERNAL
walletCurrency
string
Wallet currency (required only if walletType is INTERNAL). Examples: “usdc”, “usdt”, “xrp”
page
string
Page number for pagination, zero-indexed. Defaults to page 0 if omitted or invalid. Each page returns up to 10 transactions.
x-us-env
boolean
default:false
Route to US backend environment

Response

Returns an array of transaction objects, up to 10 per page.
name
string
Transaction description (e.g., “Credit withdrawal”, “Card purchase”, “Deposit”)
amount
string
Transaction amount (decimal string)
currency
string
Currency code (e.g., “usdc”, “usdt”, “xrp”)
sign
string
Transaction direction: "debit" for outgoing, "credit" for incoming
date
string
ISO 8601 timestamp of the transaction
[
  {
    "name": "Credit withdrawal",
    "amount": "10.00",
    "currency": "usdc",
    "sign": "debit",
    "date": "2024-02-02T15:01:09.091Z"
  },
  {
    "name": "Card purchase - Starbucks",
    "amount": "5.50",
    "currency": "usdc",
    "sign": "debit",
    "date": "2024-02-01T10:30:45.123Z"
  },
  {
    "name": "Deposit",
    "amount": "100.00",
    "currency": "usdc",
    "sign": "credit",
    "date": "2024-01-31T09:15:22.456Z"
  }
]

Code Examples

# Credit wallet history
curl -X GET "https://dev.api.baanx.com/v1/wallet/history?walletId=098aeb90-e7f7-4f81-bc2e-4963330122c5&walletType=CREDIT&page=0" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

# Internal wallet history (requires currency)
curl -X GET "https://dev.api.baanx.com/v1/wallet/history?walletId=098aeb90-e7f7-4f81-bc2e-4963330122c5&walletType=INTERNAL&walletCurrency=usdc&page=0" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Pagination Example

Complete Pagination Implementation
async function getAllTransactions(walletId, walletType) {
  let allTransactions = [];
  let page = 0;
  let hasMore = true;

  while (hasMore) {
    const transactions = await getWalletHistory(walletId, walletType, page);

    allTransactions = allTransactions.concat(transactions);

    hasMore = transactions.length === 10;
    page++;
  }

  return allTransactions;
}

const allTxs = await getAllTransactions(
  '098aeb90-e7f7-4f81-bc2e-4963330122c5',
  'CREDIT'
);

console.log(`Total transactions: ${allTxs.length}`);

Integration Patterns

Transaction Display with Formatting

function formatTransaction(tx) {
  const date = new Date(tx.date);
  const amount = parseFloat(tx.amount);
  const sign = tx.sign === 'debit' ? '-' : '+';

  return {
    date: date.toLocaleDateString(),
    time: date.toLocaleTimeString(),
    description: tx.name,
    amount: `${sign}$${amount.toFixed(2)}`,
    currency: tx.currency.toUpperCase(),
    type: tx.sign
  };
}

const history = await getWalletHistory(walletId, walletType);
const formatted = history.map(formatTransaction);

Filter Transactions by Type

const history = await getWalletHistory(walletId, 'CREDIT');

const withdrawals = history.filter(tx =>
  tx.sign === 'debit' && tx.name.includes('withdrawal')
);

const deposits = history.filter(tx => tx.sign === 'credit');

const purchases = history.filter(tx =>
  tx.sign === 'debit' && tx.name.includes('purchase')
);

Calculate Period Summary

function calculateSummary(transactions, startDate, endDate) {
  const start = new Date(startDate);
  const end = new Date(endDate);

  const filtered = transactions.filter(tx => {
    const txDate = new Date(tx.date);
    return txDate >= start && txDate <= end;
  });

  const totalDebits = filtered
    .filter(tx => tx.sign === 'debit')
    .reduce((sum, tx) => sum + parseFloat(tx.amount), 0);

  const totalCredits = filtered
    .filter(tx => tx.sign === 'credit')
    .reduce((sum, tx) => sum + parseFloat(tx.amount), 0);

  return {
    period: `${startDate} to ${endDate}`,
    transactionCount: filtered.length,
    totalIn: totalCredits,
    totalOut: totalDebits,
    net: totalCredits - totalDebits
  };
}

Important Notes

Page Size: Each page returns up to 10 transactions. If a page has fewer than 10 transactions, you’ve reached the end of the history.
Zero-Indexed Pagination: Page numbers start at 0. First page is page=0, second page is page=1, etc.
Internal Wallet Currency: When querying history for INTERNAL wallet type, you must provide the walletCurrency parameter. Omitting it will result in an error.

Edge Cases

Empty History

A wallet with no transactions returns an empty array:
[]

Invalid Page Numbers

Invalid or out-of-range page numbers default to page 0:
/wallet/history?walletId=xxx&walletType=CREDIT&page=-1
/wallet/history?walletId=xxx&walletType=CREDIT&page=abc

Transaction Ordering

Transactions are always ordered by date descending (newest first). To get oldest first, reverse the array:
const history = await getWalletHistory(walletId, walletType);
const oldestFirst = history.reverse();

Large History Sets

For wallets with thousands of transactions:
  • Implement efficient pagination with loading indicators
  • Cache historical data client-side
  • Consider date range filters for performance
  • Lazy-load transactions as user scrolls