Get gas price
curl --request GET \
--url https://api.leokit.dev/gas-price/{asset} \
--header 'Api-Key: <api-key>'import requests
url = "https://api.leokit.dev/gas-price/{asset}"
headers = {"Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'Api-Key': '<api-key>'}};
fetch('https://api.leokit.dev/gas-price/{asset}', 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.leokit.dev/gas-price/{asset}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Api-Key: <api-key>"
],
]);
$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.leokit.dev/gas-price/{asset}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Api-Key", "<api-key>")
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.leokit.dev/gas-price/{asset}")
.header("Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.leokit.dev/gas-price/{asset}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"type": "dynamic",
"units": "gwei",
"gas_prices": [
[
0.01,
1765208995726
],
[
0.026389,
1765209584945
],
[
0.155186,
1765285082322
]
]
}{
"message": "<string>",
"code": "<string>"
}Endpoint Details
Gas Price
Get current gas price of given network
GET
/
gas-price
/
{asset}
Get gas price
curl --request GET \
--url https://api.leokit.dev/gas-price/{asset} \
--header 'Api-Key: <api-key>'import requests
url = "https://api.leokit.dev/gas-price/{asset}"
headers = {"Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'Api-Key': '<api-key>'}};
fetch('https://api.leokit.dev/gas-price/{asset}', 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.leokit.dev/gas-price/{asset}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Api-Key: <api-key>"
],
]);
$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.leokit.dev/gas-price/{asset}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Api-Key", "<api-key>")
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.leokit.dev/gas-price/{asset}")
.header("Api-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.leokit.dev/gas-price/{asset}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"type": "dynamic",
"units": "gwei",
"gas_prices": [
[
0.01,
1765208995726
],
[
0.026389,
1765209584945
],
[
0.155186,
1765285082322
]
]
}{
"message": "<string>",
"code": "<string>"
}Authorizations
Demo API-Key (Sandbox): 7037d2b3-9c76-4f62-b730-c544f7570fa4
Path Parameters
Network/asset identifier to fetch gas prices for (e.g., ETH.ETH).
Response
Gas price
- Option 1
- Option 2
Gas price response. The shape of gas_prices depends on type.
Indicates a dynamic time series response.
Available options:
dynamic Gas price unit. This depends on the network (e.g., gwei).
Array of [gas_price, timestamp_ms] points.
A historical gas price point as [price, timestamp_ms].
Required array length:
2 elementsGas price value.