Build on Ethereum with EthScan's REST API, webhooks, and flexible query interface.
Anonymous requests are rate-limited to 10 req/min per IP. With an API key, you get 100 req/min — 10x more capacity.
# Step 1 — sign a message with your wallet to prove ownership
# Message format (sign this exact string with eth_sign or personal_sign):
# BNBScan API Key Request
# Address: 0xyouraddress
# Timestamp: <unix ms>
#
# Example using ethers.js:
# const ts = Date.now()
# const msg = `BNBScan API Key Request\nAddress: ${addr.toLowerCase()}\nTimestamp: ${ts}`
# const sig = await signer.signMessage(msg)
# Step 2 — submit the signed request
TS=$(date +%s000) # current time in milliseconds
SIG="0xYourSignatureHere"
curl -X POST https://ethscan.io/api/v1/keys \
-H "Content-Type: application/json" \
-d "{
\"ownerAddress\": \"0xYourAddress\",
\"label\": \"My App\",
\"signature\": \"$SIG\",
\"timestamp\": $TS
}"
# Response:
{
"id": 1,
"key": "bnbs_abc123...",
"keyPrefix": "bnbs_abc123",
"message": "API key created. Save it now — the full key will not be shown again."
}# Pass your key via the X-API-Key header curl https://ethscan.io/api/v1/blocks \ -H "X-API-Key: bnbs_abc123..." # List your keys curl "https://ethscan.io/api/v1/keys?owner=0xYourAddress"
Subscribe to real-time on-chain events. EthScan will POST to your URL whenever the specified events occur for the watched address. Requests are signed with HMAC-SHA256.
curl -X POST https://ethscan.io/api/v1/webhooks \
-H "Content-Type: application/json" \
-d '{
"ownerAddress": "0xYourAddress",
"url": "https://your-app.com/webhook",
"watchAddress": "0xWatchedAddress",
"eventTypes": ["tx", "token_transfer"]
}'
# Response:
{
"id": 42,
"secret": "abcdef1234...",
"message": "Webhook created. Keep the secret..."
}// POST to your URL:
{
"event": "tx",
"timestamp": "2024-01-01T00:00:00.000Z",
"data": {
"hash": "0xabc...",
"from": "0x111...",
"to": "0x222...",
"value": "1000000000000000000",
"blockNumber": 42000000
}
}
// Headers included:
// X-BNBScan-Signature: sha256=<hmac>
// X-BNBScan-Event: tx
// User-Agent: BNBScan-Webhook/1.0const crypto = require('crypto')
function verifyWebhook(body, signature, secret) {
const expected = 'sha256=' +
crypto.createHmac('sha256', secret)
.update(body)
.digest('hex')
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
)
}# List your webhooks curl "https://ethscan.io/api/v1/webhooks?owner=0xYourAddress" # Delete a webhook curl -X DELETE https://ethscan.io/api/v1/webhooks/42
A single endpoint for querying any entity with flexible filters, ordering, pagination, and offset. Ideal for analytics and data pipelines.
/api/v1/querycurl -X POST https://ethscan.io/api/v1/query \
-H "Content-Type: application/json" \
-d '{
"entity": "transactions",
"filter": { "address": "0x..." },
"limit": 50,
"orderBy": "desc"
}'curl -X POST https://ethscan.io/api/v1/query \
-H "Content-Type: application/json" \
-d '{
"entity": "token_transfers",
"filter": {
"tokenAddress": "0x...",
"blockFrom": 42000000,
"blockTo": 42001000
},
"limit": 100
}'| Entity | Available Filters |
|---|---|
| transactions | address, from, to, blockNumber, blockFrom, blockTo |
| blocks | blockFrom, blockTo |
| tokens | — (ordered by holderCount) |
| token_transfers | address, from, to, tokenAddress, blockFrom, blockTo |
| dex_trades | address (maker), dex, blockFrom, blockTo |