The API layer is how everything — the explorer frontend, wallets, analytics tools, and your own applications — reads indexed blockchain data from OpenScan.AI. It is a REST API (v2) served over HTTP with JSON responses.
The production instance for XDC Network is live at https://xdcscan.io/api/v2 with interactive documentation at xdcscan.io/api-docs.
What the API Serves
The API reads exclusively from the indexing layer’s database — never directly from the chain node — so responses are fast and consistent:
- Blocks — by number or hash, with transaction lists
- Transactions — full detail, receipts, decoded input, internal transactions
- Addresses — balances, token holdings, transaction history
- Tokens — metadata, holders, transfers for ERC-20 / ERC-721 / ERC-1155
- Smart contracts — source code and ABI for verified contracts
- Stats — chain-level metrics such as transaction counts and gas prices
Quick Examples
Fetch the latest blocks:
curl "https://xdcscan.io/api/v2/blocks"Look up a transaction:
curl "https://xdcscan.io/api/v2/transactions/0xYOUR_TX_HASH"Get an address balance:
curl "https://xdcscan.io/api/v2/addresses/0xYOUR_ADDRESS"List token transfers for an address:
curl "https://xdcscan.io/api/v2/addresses/0xYOUR_ADDRESS/token-transfers"Using the API from Code
const base = "https://xdcscan.io/api/v2";
async function getAddress(hash) { const res = await fetch(`${base}/addresses/${hash}`); if (!res.ok) throw new Error(`API error: ${res.status}`); return res.json();}
const address = await getAddress("0x0000000000000000000000000000000000000000");console.log(address.coin_balance);import requests
base = "https://xdcscan.io/api/v2"
resp = requests.get(f"{base}/blocks", params={"type": "block"})resp.raise_for_status()for block in resp.json().get("items", []): print(block["height"], block["transactions_count"])Pagination
List endpoints return an items array plus next_page_params. Pass those parameters back on the next request to page through large result sets:
curl "https://xdcscan.io/api/v2/addresses/0xYOUR_ADDRESS/transactions?block_number=90000000&index=3"Rate Limits and Keys
Public endpoints are rate-limited per IP. For higher throughput or commercial use — or if you run a self-hosted instance and control your own limits — contact the team.
For Self-Hosters
If you operate your own OpenScan.AI deployment, the same v2 API is served by your own API service. Point your frontend and integrations at your instance’s base URL — the endpoint structure is identical to the production one documented at xdcscan.io/api-docs.
Related
- REST API Documentation
- Indexing Layer — where API data comes from
- Explorer Verification — health-checking your API service