Get the network exchange rate to estimate costs
curl --request GET \
--url https://mainnet.mirrornode.hedera.com/api/v1/network/exchangerateimport requests
url = "https://mainnet.mirrornode.hedera.com/api/v1/network/exchangerate"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://mainnet.mirrornode.hedera.com/api/v1/network/exchangerate', 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://mainnet.mirrornode.hedera.com/api/v1/network/exchangerate",
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://mainnet.mirrornode.hedera.com/api/v1/network/exchangerate"
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://mainnet.mirrornode.hedera.com/api/v1/network/exchangerate")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.mirrornode.hedera.com/api/v1/network/exchangerate")
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{
"current_rate": {
"cent_equivalent": 596987,
"expiration_time": 1649689200,
"hbar_equivalent": 30000
},
"next_rate": {
"cent_equivalent": 596987,
"expiration_time": 1649689200,
"hbar_equivalent": 30000
},
"timestamp": "1586567700.453054000"
}{
"_status": {
"messages": [
{
"message": "Invalid parameter: account.id"
},
{
"message": "Invalid Transaction id. Please use \\shard.realm.num-sss-nnn\\ format where sss are seconds and nnn are nanoseconds"
}
]
}
}{
"_status": {
"messages": [
{
"message": "Not found"
}
]
}
}{
"_status": {
"messages": [
{
"message": "Require at least 1/3 signature files to prove consensus, got 1 out of 4 for file 2019-10-11T13_33_25.526889Z.rcd_sig"
}
]
}
}Network
Get the network exchange rate to estimate costs
Returns the network’s exchange rate, current and next.
GET
/
api
/
v1
/
network
/
exchangerate
Get the network exchange rate to estimate costs
curl --request GET \
--url https://mainnet.mirrornode.hedera.com/api/v1/network/exchangerateimport requests
url = "https://mainnet.mirrornode.hedera.com/api/v1/network/exchangerate"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://mainnet.mirrornode.hedera.com/api/v1/network/exchangerate', 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://mainnet.mirrornode.hedera.com/api/v1/network/exchangerate",
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://mainnet.mirrornode.hedera.com/api/v1/network/exchangerate"
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://mainnet.mirrornode.hedera.com/api/v1/network/exchangerate")
.asString();require 'uri'
require 'net/http'
url = URI("https://mainnet.mirrornode.hedera.com/api/v1/network/exchangerate")
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{
"current_rate": {
"cent_equivalent": 596987,
"expiration_time": 1649689200,
"hbar_equivalent": 30000
},
"next_rate": {
"cent_equivalent": 596987,
"expiration_time": 1649689200,
"hbar_equivalent": 30000
},
"timestamp": "1586567700.453054000"
}{
"_status": {
"messages": [
{
"message": "Invalid parameter: account.id"
},
{
"message": "Invalid Transaction id. Please use \\shard.realm.num-sss-nnn\\ format where sss are seconds and nnn are nanoseconds"
}
]
}
}{
"_status": {
"messages": [
{
"message": "Not found"
}
]
}
}{
"_status": {
"messages": [
{
"message": "Require at least 1/3 signature files to prove consensus, got 1 out of 4 for file 2019-10-11T13_33_25.526889Z.rcd_sig"
}
]
}
}Query Parameters
The consensus timestamp as a Unix timestamp in seconds.nanoseconds format with an optional comparison operator. See unixtimestamp.com for a simple way to convert a date to the 'seconds' part of the Unix time.
Pattern:
^((eq|gt|gte|lt|lte|ne):)?\d{1,10}(\.\d{1,9})?$Was this page helpful?
⌘I