Get NFT Balance
This endpoint allows you to fetch the NFT balances for a given address.
Endpoint
- Mainnet
- Testnet
GET https://api.spacescan.io/address/nft-balance/{address}
GET https://api-testnet11.spacescan.io/address/nft-balance/{address}
Parameters
Parameter | Type | Description |
---|---|---|
address | string | The XCH address to fetch NFT balances for |
Use api.spacescan.io
for free tier access. See our API Plans for rate limits and features.
Use pro-api.spacescan.io
with your API key in the x-api-key
header. See our API Plans for details.
curl -X GET "https://pro-api.spacescan.io/address/nft-balance/{address}" \
-H "x-api-key: YOUR_API_KEY"
Live API Test
- Mainnet
- Testnet
Request Examples
- cURL
- Python
- JavaScript
- Mainnet
- Testnet
import requests
address = "xch1a6cd558gqsz2hch5pt0l8mx7zhavf32q5lyde09zjtqcmkelr9ns59k0j8"
url = f"https://api.spacescan.io/address/nft-balance/{address}"
response = requests.get(url)
data = response.json()
print(data)
import requests
address = "xch1a6cd558gqsz2hch5pt0l8mx7zhavf32q5lyde09zjtqcmkelr9ns59k0j8"
url = f"https://api-testnet11.spacescan.io/address/nft-balance/{address}"
response = requests.get(url)
data = response.json()
print(data)
- Mainnet
- Testnet
const address = "xch1a6cd558gqsz2hch5pt0l8mx7zhavf32q5lyde09zjtqcmkelr9ns59k0j8";
const url = https://api.spacescan.io/address/nft-balance/${address}
;
fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
const address = "xch1a6cd558gqsz2hch5pt0l8mx7zhavf32q5lyde09zjtqcmkelr9ns59k0j8";
const url = https://api-testnet11.spacescan.io/address/nft-balance/${address}
;
fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Response
- Mainnet
- Testnet
Failed to load API response. Please try again later.
Failed to load API response. Please try again later.
Response Schema
Field | Type | Description |
---|---|---|
status | string | Success or failure status |
balance | array | List of NFT balances |
balance[].nft_id | string | The unique identifier of the NFT |
balance[].name | string | The name of the NFT (null if not available) |
balance[].collection_id | string | The collection ID the NFT belongs to |
balance[].preview_url | string | URL to the NFT preview image (null if not available) |