api/v2/xpub - Litecoin

This endpoint returns wallet-level balance and transaction data for an extended public key or output descriptor. Blockbook derives the addresses from the key and returns the combined result, so each address does not have to be tracked separately.

Litecoin derives at BIP44 coin type 2, so its account paths read m/44'/2'/0'/.... The BIP scheme is inferred from the key prefix.

Parameters

ParameterTypeLocationRequiredDescription
xpubstringpathYesExtended public key or supported output descriptor. URL-encode descriptors
detailsstringqueryNoDetail level: basic, tokens, tokenBalances, txids, txslight, or txs
tokensstringqueryNoWhich derived addresses to include: nonzero, used, or derived. Default nonzero
pageintegerqueryNo1-based page index for transaction history
pageSizeintegerqueryNoHistory items per page. Default and maximum is 1000
gapintegerqueryNoDerivation gap limit, capped by the server

Request

bashcurl --location --request GET 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz?details=tokens&tokens=used'

example.js

javascriptconst response = await fetch(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz?details=tokens&tokens=used'
);
console.log(await response.json());

example.py

pythonimport requests

response = requests.get('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/api/v2/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz?details=tokens&tokens=used')

print(response.json())

Response

json{
    "address": "xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz",
    "balance": "2680044",
    "totalReceived": "2680044",
    "totalSent": "0",
    "unconfirmedBalance": "0",
    "unconfirmedTxs": 0,
    "txs": 1,
    "addrTxCount": 1,
    "usedTokens": 1,
    "tokens": [
        {
            "type": "XPUBAddress",
            "standard": "XPUBAddress",
            "name": "LLwLECw5AyVcFsB8bbXVhvtfAxgiYr1v5Q",
            "path": "m/44'/2'/0'/0/1",
            "transfers": 1,
            "decimals": 8
        }
    ]
}

Response Parameters

FieldTypeDescription
addressstringThe queried extended public key or descriptor
balancestringCombined confirmed balance of the wallet in litoshis
totalReceivedstringCombined total received in litoshis
totalSentstringCombined total sent in litoshis
txsintegerNumber of transactions across the derived addresses
usedTokensintegerTotal number of used derived addresses
tokensarrayDerived address rows, each with its own path and transfer count
tokens[].namestringThe derived address
tokens[].pathstringBIP32 derivation path of that address

usedTokens always reports the total number of used addresses for the key, regardless of the tokens filter. Blockbook expects the key at level 3 of the derivation path, for example m/purpose'/coin_type'/account', and derives the remaining change and index levels itself.

Use Cases

  • Wallet Balances: Read a whole wallet in one call instead of per address
  • History Aggregation: Collect transactions across every derived address
  • Address Discovery: List which derived addresses have been used
  • Accounting: Reconcile wallet-level totals

Error Handling

HTTP StatusMessageDescription
400Bad requestThe extended public key or descriptor is malformed
403ForbiddenMissing or invalid ACCESS-TOKEN
500Internal errorThe indexer failed to derive or read the account