Skip to main content
What you’ll build:
  • Fetch and display a wallet’s transaction history with human-readable labels
  • Filter transactions by type, chain, and date range
  • Paginate through the full history
Time: ~10 minutes

Prerequisites

Steps

1
Fetch recent transactions
2
Use the wallet transactions endpoint to get a wallet’s history.
3
JavaScript
Python
cURL
4
Each transaction includes:
5
  • operation_type — the high-level action (trade, send, receive, deposit, etc.)
  • transfers[] — individual token movements with direction (in/out/self)
  • fee — gas fee paid, with USD value
  • application_metadata — the DApp involved (e.g., “Uniswap”, “Aave”)
  • 6
    Filter by operation type
    7
    To show only specific transaction types, use filter[operation_types].
    8
    # Show only trades (swaps)
    curl -u "YOUR_API_KEY:" \
      "https://api.zerion.io/v1/wallets/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/transactions/?currency=usd&filter[operation_types]=trade"
    
    9
    Available operation types:
    10
    TypeDescriptionsendSent tokens to another addressreceiveReceived tokens from another addresstradeSwapped tokens (e.g., on a DEX)depositDeposited into a DeFi protocolwithdrawWithdrew from a DeFi protocolmintMinted new tokensburnBurned tokensapproveApproved token spendingclaimClaimed rewards or airdropsexecuteGeneric smart contract interactiondeployDeployed a smart contract
    11
    Filter by chain and date range
    12
    Narrow results to specific chains or time windows. The filter[min_mined_at] value is a Unix timestamp in milliseconds.
    13
    # Ethereum transactions since Feb 26, 2024 (1708905600000 ms)
    curl -u "YOUR_API_KEY:" \
      "https://api.zerion.io/v1/wallets/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/transactions/?currency=usd&filter[chain_ids]=ethereum&filter[min_mined_at]=1708905600000"
    
    14
    Paginate through full history
    15
    Use links.next from each response to fetch the next page.
    16
    JavaScript
    Python
    17
    Full working example
    18
    Save as tx-history.mjs and run with node tx-history.mjs:
    19
    const API_KEY = process.env.ZERION_API_KEY;
    const BASE_URL = "https://api.zerion.io/v1";
    const headers = {
      accept: "application/json",
      authorization: `Basic ${btoa(API_KEY + ":")}`,
    };
    
    async function getTransactions(address, { types, chains, limit } = {}) {
      const params = new URLSearchParams({ currency: "usd", "page[size]": limit || 20 });
      if (types) params.set("filter[operation_types]", types);
      if (chains) params.set("filter[chain_ids]", chains);
    
      const res = await fetch(
        `${BASE_URL}/wallets/${address}/transactions/?${params}`,
        { headers }
      );
      return res.json();
    }
    
    async function displayHistory(address) {
      const { data } = await getTransactions(address, { limit: 10 });
    
      for (const tx of data) {
        const { operation_type, mined_at, transfers, fee, application_metadata } = tx.attributes;
        const chain = tx.relationships.chain.data.id;
    
        console.log(`[${mined_at}] ${operation_type} on ${chain}`);
        if (application_metadata?.name) {
          console.log(`  via ${application_metadata.name}`);
        }
        for (const transfer of transfers) {
          const symbol = transfer.fungible_info?.symbol || "NFT";
          const dir = transfer.direction === "out" ? "-" : "+";
          console.log(`  ${dir}${transfer.quantity.float} ${symbol} (${transfer.value != null ? `$${transfer.value.toFixed(2)}` : "N/A"})`);
        }
        console.log(`  Fee: ${fee.value != null ? `$${fee.value.toFixed(2)}` : "N/A"}\n`);
      }
    }
    
    displayHistory("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
    

    Next steps

    • Use filter[asset_types]=nft to show NFT transfers
    • Combine with the DApps endpoint to enrich application_metadata
    • Build real-time alerts using the webhook recipe instead of polling