Algorand - Get Account Transactions

Call the Algorand Indexer, not algod, to list an account's transactions: the account transactions endpoint returns them newest first, paged by next-token.

You can retrieve all transactions from an Algorand account by querying the Indexer endpoint, https://algorand-mainnet-indexer.gateway.tatum.io, with GET /v2/accounts/{account-id}/transactions. The algod endpoint doesn't have this path. The Indexer returns transactions newest to oldest; pass the next-token from each response as next to get the following page.

Symptom

You request an account's transaction history from the algod endpoint and get HTTP 404 with an empty body:

curl 'https://algorand-mainnet-algod.gateway.tatum.io/v2/accounts/{ADDRESS}/transactions' \
  --header 'x-api-key: {YOUR_API_KEY}'
HTTP/2 404
content-length: 0

Cause

Algorand nodes split their REST API in two: algod serves node status, account state and transaction submission, and the separate Indexer searches historical data, including an account's transactions. On algod, the only transaction list for an account is /v2/accounts/{account-id}/transactions/pending, with its pending transactions. On Tatum, each API has its own endpoint:

NetworkAlgodIndexer
Mainnethttps://algorand-mainnet-algod.gateway.tatum.iohttps://algorand-mainnet-indexer.gateway.tatum.io
Testnethttps://algorand-testnet-algod.gateway.tatum.iohttps://algorand-testnet-indexer.gateway.tatum.io

Solution

  1. Call the Indexer endpoint. Replace {ADDRESS} with the account address:

    curl 'https://algorand-mainnet-indexer.gateway.tatum.io/v2/accounts/{ADDRESS}/transactions' \
      --header 'x-api-key: {YOUR_API_KEY}'

    The endpoint /v2/accounts/{account-id}/transactions returns all transactions for a given account, sorted from newest to oldest. The response, trimmed to its first transaction:

    {
      "current-round": 26834617,
      "next-token": "0DOZAQAAAAAMAAAA",
      "transactions": [
        {
          "asset-transfer-transaction": {
            "amount": 0,
            "asset-id": 27165954,
            "close-amount": 0,
            "receiver": "MLD3LCNGOK2SXAVNUYMW3WVG5LBN4Z5HFARB3VLMZCENFW############"
          },
          "close-rewards": 0,
          "closing-amount": 0,
          "confirmed-round": 26834571,
          "fee": 1000,
          "first-valid": 26834569
        }
      ]
    }
  2. Page through the results. Use the next-token field in the response to paginate through additional results: send it as the next query parameter. limit sets the maximum number of results per page, and there can be more pages even when a page has fewer results than the limit. Repeat with each new next-token to go further back in history:

    curl 'https://algorand-mainnet-indexer.gateway.tatum.io/v2/accounts/{ADDRESS}/transactions?limit=100&next={NEXT_TOKEN}' \
      --header 'x-api-key: {YOUR_API_KEY}'
  3. Narrow the query. Filter by round with min-round and max-round, by time with after-time and before-time (RFC 3339), by type with tx-type (for example pay or axfer), or by asset with asset-id. Narrow ranges matter for old history: on Tatum, queries for rounds older than about 19,000,000 (around February 2022 and earlier) can take over 60 seconds or time out (see Node data history).

    curl 'https://algorand-mainnet-indexer.gateway.tatum.io/v2/accounts/{ADDRESS}/transactions?min-round=40000000&tx-type=pay' \
      --header 'x-api-key: {YOUR_API_KEY}'

FAQ

How do I get the current Algorand round number?

Every Indexer response includes current-round, the round at which the results were computed. On algod, GET /v2/status returns the latest round as last-round.

How do I look up a single Algorand transaction?

Call GET /v2/transactions/{transaction-id} on the Indexer endpoint, or add txid={TRANSACTION_ID} to the account transactions request.

Still stuck?

Report an issue to support with the full request, the HTTP status, the response and its x-request-id.


Did this page help you?