Get Transaction Info by Transaction Hash
curl --request GET \
--url 'https://api.blockscout.com/v2/api?module=transaction&action=gettxinfo' \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.blockscout.com/v2/api?module=transaction&action=gettxinfo"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.blockscout.com/v2/api?module=transaction&action=gettxinfo', 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.blockscout.com/v2/api?module=transaction&action=gettxinfo",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.blockscout.com/v2/api?module=transaction&action=gettxinfo"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.blockscout.com/v2/api?module=transaction&action=gettxinfo")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.blockscout.com/v2/api?module=transaction&action=gettxinfo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "1",
"message": "OK",
"result": {
"blockNumber": "<string>",
"timeStamp": "<string>",
"hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"nonce": "<string>",
"blockHash": "<string>",
"transactionIndex": "<string>",
"from": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
"to": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
"value": "<string>",
"gas": "<string>",
"gasPrice": "<string>",
"isError": "0",
"txreceipt_status": "0",
"input": "<string>",
"contractAddress": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
"cumulativeGasUsed": "<string>",
"gasUsed": "<string>",
"confirmations": "<string>"
}
}Transaction
Get Transaction Info by Transaction Hash
Returns transaction information including revert reason if available
GET
/
v2
/
api?module=transaction&action=gettxinfo
Get Transaction Info by Transaction Hash
curl --request GET \
--url 'https://api.blockscout.com/v2/api?module=transaction&action=gettxinfo' \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.blockscout.com/v2/api?module=transaction&action=gettxinfo"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.blockscout.com/v2/api?module=transaction&action=gettxinfo', 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.blockscout.com/v2/api?module=transaction&action=gettxinfo",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.blockscout.com/v2/api?module=transaction&action=gettxinfo"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.blockscout.com/v2/api?module=transaction&action=gettxinfo")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.blockscout.com/v2/api?module=transaction&action=gettxinfo")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "1",
"message": "OK",
"result": {
"blockNumber": "<string>",
"timeStamp": "<string>",
"hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"nonce": "<string>",
"blockHash": "<string>",
"transactionIndex": "<string>",
"from": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
"to": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
"value": "<string>",
"gas": "<string>",
"gasPrice": "<string>",
"isError": "0",
"txreceipt_status": "0",
"input": "<string>",
"contractAddress": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
"cumulativeGasUsed": "<string>",
"gasUsed": "<string>",
"confirmations": "<string>"
}
}Authorizations
bearerAuthapiKeyAuth
API key passed as a Bearer token in the Authorization header.
Query Parameters
The ID of the blockchain
Module name (must be 'transaction')
Available options:
transaction Available options:
gettxinfo Transaction hash 64-character hexadecimal transaction hash with 0x prefix
Pattern:
^0x[a-fA-F0-9]{64}$Example:
"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
Was this page helpful?