Get exchange rate
curl --request GET \
--url https://api.fernhq.com/exchange-rates \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.fernhq.com/exchange-rates"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.fernhq.com/exchange-rates', 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.fernhq.com/exchange-rates",
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.fernhq.com/exchange-rates"
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.fernhq.com/exchange-rates")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fernhq.com/exchange-rates")
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{
"exchangeRate": "1000.00",
"feeComponents": [
{
"feeType": "FLAT",
"feeAmount": "5.45",
"feeCurrency": {
"label": "USDC",
"chain": "ETHEREUM",
"contractAddress": "0x123456789abcd123456789abcd123456789abcd",
"currencyDecimals": 18
}
}
],
"destinationAmount": "100",
"fees": {
"feeCurrency": {
"label": "USDC",
"chain": "ETHEREUM",
"contractAddress": "0x123456789abcd123456789abcd123456789abcd",
"currencyDecimals": 18
},
"fernFee": {
"feeAmount": "5.45",
"feeUSDAmount": "5.45"
}
}
}Get exchange rate
Get the exchange rate and fees between a source currency and destination currency
GET
/
exchange-rates
Get exchange rate
curl --request GET \
--url https://api.fernhq.com/exchange-rates \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.fernhq.com/exchange-rates"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.fernhq.com/exchange-rates', 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.fernhq.com/exchange-rates",
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.fernhq.com/exchange-rates"
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.fernhq.com/exchange-rates")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fernhq.com/exchange-rates")
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{
"exchangeRate": "1000.00",
"feeComponents": [
{
"feeType": "FLAT",
"feeAmount": "5.45",
"feeCurrency": {
"label": "USDC",
"chain": "ETHEREUM",
"contractAddress": "0x123456789abcd123456789abcd123456789abcd",
"currencyDecimals": 18
}
}
],
"destinationAmount": "100",
"fees": {
"feeCurrency": {
"label": "USDC",
"chain": "ETHEREUM",
"contractAddress": "0x123456789abcd123456789abcd123456789abcd",
"currencyDecimals": 18
},
"fernFee": {
"feeAmount": "5.45",
"feeUSDAmount": "5.45"
}
}
}Query Parameters
The payment method for the source exchangeRate The payment method for the source funds (fiat)
Available options:
ACH, WIRE, SEPA, AE_UAEFTS, AR_TRANSFERS_3, AU_BECS, BD_BEFTN, BO_RTGS, BR_TED_DOC_PIX, CA_INTERAC, CL_TEF, CN_CNAPS, CO_ACH, CR_SINPE, CZ_CERTIS, DK_NEMKONTO_FI, DO_ACH, EC_LOCAL, EG_RTGS_IPN, GB_BACS_CHAPS_FPS, GH_GHIPSS, GT_ACH, HK_HKICL_CHATS_ECG, HU_GIRO, ID_SKN_RTGS, IL_ZAHAV, IN_NEFT_RTGS_IMPS, JM_LOCAL, JO_ACH, JP_ZENGIN, KE_KIBBS_PESALINK, KR_LOCAL, LK_LOCAL, MX_SPEI, MY_IBG_RENTAS, NG_NIBSS_NEFT, NO_NICS, NP_LOCAL, NZ_LOCAL, PE_CCE, PH_INSTAPAY_PESONET, PK_RAAST_IBFT, PL_ELIXIR_BLUE_CASH, QA_QPS, RO_RTGS, SA_MADA, SE_BANKGIROT, SG_FAST_MEPS, SV_LOCAL, SWIFT, TH_BAHTNET_PROMPTPAY, TR_FAST_EFT, TZ_RTGS, VN_IBPS, ZA_RTGS_EFT, ACH_SAME_DAY destinationPaymentMethod
Fiat Payment Method · enum<string>Crypto Payment Method · enum<string>
required
The payment method for the destination exchangeRate The payment method for the source funds (fiat)
Available options:
ACH, WIRE, SEPA, AE_UAEFTS, AR_TRANSFERS_3, AU_BECS, BD_BEFTN, BO_RTGS, BR_TED_DOC_PIX, CA_INTERAC, CL_TEF, CN_CNAPS, CO_ACH, CR_SINPE, CZ_CERTIS, DK_NEMKONTO_FI, DO_ACH, EC_LOCAL, EG_RTGS_IPN, GB_BACS_CHAPS_FPS, GH_GHIPSS, GT_ACH, HK_HKICL_CHATS_ECG, HU_GIRO, ID_SKN_RTGS, IL_ZAHAV, IN_NEFT_RTGS_IMPS, JM_LOCAL, JO_ACH, JP_ZENGIN, KE_KIBBS_PESALINK, KR_LOCAL, LK_LOCAL, MX_SPEI, MY_IBG_RENTAS, NG_NIBSS_NEFT, NO_NICS, NP_LOCAL, NZ_LOCAL, PE_CCE, PH_INSTAPAY_PESONET, PK_RAAST_IBFT, PL_ELIXIR_BLUE_CASH, QA_QPS, RO_RTGS, SA_MADA, SE_BANKGIROT, SG_FAST_MEPS, SV_LOCAL, SWIFT, TH_BAHTNET_PROMPTPAY, TR_FAST_EFT, TZ_RTGS, VN_IBPS, ZA_RTGS_EFT, ACH_SAME_DAY Response
Response Schema for retrieving the exchangeRate of a payment account
Response Schema for retrieving the exchangeRate of a payment account
Was this page helpful?