curl --request GET \
--url 'https://api.etherscan.io/v2/api?apikey='import requests
url = "https://api.etherscan.io/v2/api?apikey="
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.etherscan.io/v2/api?apikey=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.etherscan.io/v2/api?apikey=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.etherscan.io/v2/api?apikey="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.etherscan.io/v2/api?apikey=")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.etherscan.io/v2/api?apikey=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "1",
"message": "OK",
"result": [
{
"address": "0xbd3531da5cf5857e7cfaa92426877b022e612cf8",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x000000000000000000000000c45a4b3b698f21f88687548e7f5a80df8b99d93d",
"0x00000000000000000000000000000000000000000000000000000000000000b5"
],
"data": "0x",
"blockNumber": "0xc48174",
"blockHash": "0x837e109ab8b1b40ec7d1032bff82397325d85e719b97d900fa0d9aa9745b2c27",
"timeStamp": "0x60f9ce56",
"gasPrice": "0x2e90edd000",
"gasUsed": "0x247205",
"logIndex": "0x",
"transactionHash": "0x4ffd22d986913d33927a392fe4319bcd2b62f3afe1c15a2c59f77fc2cc4c20a9",
"transactionIndex": "0x"
}
]
}
Get Event Logs by Topics
Retrieves event logs within a specified block range, filtered by topics.
curl --request GET \
--url 'https://api.etherscan.io/v2/api?apikey='import requests
url = "https://api.etherscan.io/v2/api?apikey="
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.etherscan.io/v2/api?apikey=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.etherscan.io/v2/api?apikey=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.etherscan.io/v2/api?apikey="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.etherscan.io/v2/api?apikey=")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.etherscan.io/v2/api?apikey=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "1",
"message": "OK",
"result": [
{
"address": "0xbd3531da5cf5857e7cfaa92426877b022e612cf8",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x000000000000000000000000c45a4b3b698f21f88687548e7f5a80df8b99d93d",
"0x00000000000000000000000000000000000000000000000000000000000000b5"
],
"data": "0x",
"blockNumber": "0xc48174",
"blockHash": "0x837e109ab8b1b40ec7d1032bff82397325d85e719b97d900fa0d9aa9745b2c27",
"timeStamp": "0x60f9ce56",
"gasPrice": "0x2e90edd000",
"gasUsed": "0x247205",
"logIndex": "0x",
"transactionHash": "0x4ffd22d986913d33927a392fe4319bcd2b62f3afe1c15a2c59f77fc2cc4c20a9",
"transactionIndex": "0x"
}
]
}
topic0, topic1, topic2, or topic3. A request with no topic returns an empty result shown as "result": "Error!".{
"status": "1",
"message": "OK",
"result": [
{
"address": "0xbd3531da5cf5857e7cfaa92426877b022e612cf8",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x000000000000000000000000c45a4b3b698f21f88687548e7f5a80df8b99d93d",
"0x00000000000000000000000000000000000000000000000000000000000000b5"
],
"data": "0x",
"blockNumber": "0xc48174",
"blockHash": "0x837e109ab8b1b40ec7d1032bff82397325d85e719b97d900fa0d9aa9745b2c27",
"timeStamp": "0x60f9ce56",
"gasPrice": "0x2e90edd000",
"gasUsed": "0x247205",
"logIndex": "0x",
"transactionHash": "0x4ffd22d986913d33927a392fe4319bcd2b62f3afe1c15a2c59f77fc2cc4c20a9",
"transactionIndex": "0x"
}
]
}
Authorizations
Enter your Etherscan API key, or set one up if you don't have one.
Query Parameters
Chain ID to query, eg 1 for Ethereum, 42161 for Arbitrum from our supported chains.
Set to logs for this endpoint.
Set to getLogs for this endpoint.
Starting block number to search from. Keep the range narrow to avoid timeouts and large responses.
Ending block number to search to.
The first topic to filter by. At least one of topic0-topic3 is required.
Topic operator between topic0 and topic1, either and or or. Only apply when both topics are set.
Second topic to filter by.
Topic operator between topic1 and topic2, either and or or. Only apply when both topics are set.
Third topic to filter by.
Topic operator between topic2 and topic3, either and or or. Only apply when both topics are set.
Fourth topic to filter by.
Topic operator between topic0 and topic2, either and or or. Only apply when both topics are set.
Topic operator between topic0 and topic3, either and or or. Only apply when both topics are set.
Topic operator between topic1 and topic3, either and or or. Only apply when both topics are set.
Page number for pagination.
Number of records per page. Use the page parameter for subsequent records.
Response
Successful response
1 if the request returned data, 0 otherwise. A status of 0 can indicate an error or a valid request that returned no records.
OK on success, otherwise an error description such as NOTOK. See common error messages.
Show child attributes
Show child attributes