Etherscan API
api.etherscan.io · Finance
Ethereum blockchain explorer API — wallet balances, transaction history, smart contract ABIs, event logs, gas prices, and token data. Free tier: 5 calls/second, 100,000/day.
Authentication
API Key
Free API key at etherscan.io/myapikey. Pass as &apikey= query parameter.
Sample Requests
GET
Get ETH balance
Get ETH balance for vitalik.eth.
https://api.etherscan.io/api?tag=latest&action=balance&apikey=YOUR_KEY&module=account&address=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
Hover any highlighted part to learn what it does
curl -X GET "https://api.etherscan.io/api?tag=latest&action=balance&apikey=YOUR_KEY&module=account&address=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
import requests
params = {
"tag": "latest",
"action": "balance",
"apikey": "YOUR_KEY",
"module": "account",
"address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}
response = requests.get(
"https://api.etherscan.io/api",
params=params,
)
print(response.json())const url = new URL('https://api.etherscan.io/api');
url.searchParams.set('tag', 'latest');
url.searchParams.set('action', 'balance');
url.searchParams.set('apikey', 'YOUR_KEY');
url.searchParams.set('module', 'account');
url.searchParams.set('address', '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.etherscan.io/api")
q := baseURL.Query()
q.Set("tag", "latest")
q.Set("action", "balance")
q.Set("apikey", "YOUR_KEY")
q.Set("module", "account")
q.Set("address", "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.etherscan.io/api")
uri.query = URI.encode_www_form({
"tag" => "latest",
"action" => "balance",
"apikey" => "YOUR_KEY",
"module" => "account",
"address" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.etherscan.io/api?" . http_build_query([
"tag" => "latest",
"action" => "balance",
"apikey" => "YOUR_KEY",
"module" => "account",
"address" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET
Get transactions
Get recent transactions for an address.
https://api.etherscan.io/api?page=1&sort=desc&action=txlist&apikey=YOUR_KEY&module=account&offset=5&address=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
Hover any highlighted part to learn what it does
curl -X GET "https://api.etherscan.io/api?page=1&sort=desc&action=txlist&apikey=YOUR_KEY&module=account&offset=5&address=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
import requests
params = {
"page": "1",
"sort": "desc",
"action": "txlist",
"apikey": "YOUR_KEY",
"module": "account",
"offset": "5",
"address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}
response = requests.get(
"https://api.etherscan.io/api",
params=params,
)
print(response.json())const url = new URL('https://api.etherscan.io/api');
url.searchParams.set('page', '1');
url.searchParams.set('sort', 'desc');
url.searchParams.set('action', 'txlist');
url.searchParams.set('apikey', 'YOUR_KEY');
url.searchParams.set('module', 'account');
url.searchParams.set('offset', '5');
url.searchParams.set('address', '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.etherscan.io/api")
q := baseURL.Query()
q.Set("page", "1")
q.Set("sort", "desc")
q.Set("action", "txlist")
q.Set("apikey", "YOUR_KEY")
q.Set("module", "account")
q.Set("offset", "5")
q.Set("address", "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.etherscan.io/api")
uri.query = URI.encode_www_form({
"page" => "1",
"sort" => "desc",
"action" => "txlist",
"apikey" => "YOUR_KEY",
"module" => "account",
"offset" => "5",
"address" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.etherscan.io/api?" . http_build_query([
"page" => "1",
"sort" => "desc",
"action" => "txlist",
"apikey" => "YOUR_KEY",
"module" => "account",
"offset" => "5",
"address" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- Get a free API key at etherscan.io/myapikey
- All requests use query params: ?module=MODULE&action=ACTION&apikey=KEY
- ETH balance: ?module=account&action=balance&address=0x...&tag=latest&apikey=KEY
- Gas oracle: ?module=gastracker&action=gasoracle&apikey=KEY
- Token transfers: ?module=account&action=tokentx&address=0x...&apikey=KEY