api/v2/xpub - Bitcoin Cash
Example code for the api/v2/xpub REST method. Complete guide on how to use the api/v2/xpub REST method in the GetBlock Web3 documentation.
Parameters
Parameter
Type
Location
Required
Description
Request
curl --location --request GET 'https://go.getblock.io/<ACCESS-TOKEN>/api/v2/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz?details=tokens&tokens=used'const response = await fetch(
'https://go.getblock.io/<ACCESS-TOKEN>/api/v2/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz?details=tokens&tokens=used'
);
console.log(await response.json());import requests
response = requests.get('https://go.getblock.io/<ACCESS-TOKEN>/api/v2/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz?details=tokens&tokens=used')
print(response.json())Response
{
"page": 1,
"totalPages": 1,
"itemsOnPage": 1000,
"address": "xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz",
"balance": "18452100",
"totalReceived": "58452100",
"totalSent": "40000000",
"unconfirmedBalance": "0",
"unconfirmedTxs": 0,
"txs": 12,
"usedTokens": 3,
"tokens": [
{
"type": "XPUBAddress",
"name": "bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a",
"path": "m/44'/145'/0'/0/0",
"transfers": 7,
"balance": "9407625",
"totalReceived": "45231890",
"totalSent": "35824265"
}
]
}Response Parameters
Field
Type
Description
Use Cases
Error Handling
HTTP Status
Message
Description
Last updated
Was this helpful?