relayer_getFeeData
curl --request POST \
--url https://api.gelato.cloud/rpc \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "relayer_getFeeData",
"params": {
"chainId": "1",
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
}
}
'import requests
url = "https://api.gelato.cloud/rpc"
payload = {
"id": 1,
"jsonrpc": "2.0",
"method": "relayer_getFeeData",
"params": {
"chainId": "1",
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
}
}
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: 1,
jsonrpc: '2.0',
method: 'relayer_getFeeData',
params: {chainId: '1', token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'}
})
};
fetch('https://api.gelato.cloud/rpc', 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.gelato.cloud/rpc",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 1,
'jsonrpc' => '2.0',
'method' => 'relayer_getFeeData',
'params' => [
'chainId' => '1',
'token' => '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <x-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gelato.cloud/rpc"
payload := strings.NewReader("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"relayer_getFeeData\",\n \"params\": {\n \"chainId\": \"1\",\n \"token\": \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gelato.cloud/rpc")
.header("X-API-Key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"relayer_getFeeData\",\n \"params\": {\n \"chainId\": \"1\",\n \"token\": \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gelato.cloud/rpc")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"relayer_getFeeData\",\n \"params\": {\n \"chainId\": \"1\",\n \"token\": \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"jsonrpc": "2.0",
"result": {
"chainId": "1",
"token": {
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"decimals": 6
},
"rate": 2000.5,
"minFee": "4.5",
"expiry": 1755917874,
"gasPrice": "0x4a817c800",
"context": "0x..."
}
}{
"jsonrpc": "2.0",
"id": 123,
"error": {
"code": 123,
"message": "<string>"
}
}{
"jsonrpc": "2.0",
"id": 123,
"error": {
"code": 123,
"message": "<string>"
}
}Relayer API Endpoints
relayer_getFeeData
Fetches the exchange rate for a payment token along with current gas prices. Returns a quote with an expiry timestamp.
POST
/
rpc
relayer_getFeeData
curl --request POST \
--url https://api.gelato.cloud/rpc \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "relayer_getFeeData",
"params": {
"chainId": "1",
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
}
}
'import requests
url = "https://api.gelato.cloud/rpc"
payload = {
"id": 1,
"jsonrpc": "2.0",
"method": "relayer_getFeeData",
"params": {
"chainId": "1",
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
}
}
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
id: 1,
jsonrpc: '2.0',
method: 'relayer_getFeeData',
params: {chainId: '1', token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'}
})
};
fetch('https://api.gelato.cloud/rpc', 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.gelato.cloud/rpc",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 1,
'jsonrpc' => '2.0',
'method' => 'relayer_getFeeData',
'params' => [
'chainId' => '1',
'token' => '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <x-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gelato.cloud/rpc"
payload := strings.NewReader("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"relayer_getFeeData\",\n \"params\": {\n \"chainId\": \"1\",\n \"token\": \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gelato.cloud/rpc")
.header("X-API-Key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"relayer_getFeeData\",\n \"params\": {\n \"chainId\": \"1\",\n \"token\": \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gelato.cloud/rpc")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 1,\n \"jsonrpc\": \"2.0\",\n \"method\": \"relayer_getFeeData\",\n \"params\": {\n \"chainId\": \"1\",\n \"token\": \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"jsonrpc": "2.0",
"result": {
"chainId": "1",
"token": {
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"decimals": 6
},
"rate": 2000.5,
"minFee": "4.5",
"expiry": 1755917874,
"gasPrice": "0x4a817c800",
"context": "0x..."
}
}{
"jsonrpc": "2.0",
"id": 123,
"error": {
"code": 123,
"message": "<string>"
}
}{
"jsonrpc": "2.0",
"id": 123,
"error": {
"code": 123,
"message": "<string>"
}
}Headers
Gelato API key for authentication.
Body
application/json
⌘I