Create FX Quote
curl --request POST \
--url https://api.hopnow.io/v1/accounts/{account_id}/fx/quotes \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"source_currency": "<string>",
"target_currency": "<string>",
"amount": "<string>",
"amount_type": "<string>"
}
'import requests
url = "https://api.hopnow.io/v1/accounts/{account_id}/fx/quotes"
payload = {
"source_currency": "<string>",
"target_currency": "<string>",
"amount": "<string>",
"amount_type": "<string>"
}
headers = {
"X-API-Key": "<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': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source_currency: '<string>',
target_currency: '<string>',
amount: '<string>',
amount_type: '<string>'
})
};
fetch('https://api.hopnow.io/v1/accounts/{account_id}/fx/quotes', 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.hopnow.io/v1/accounts/{account_id}/fx/quotes",
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([
'source_currency' => '<string>',
'target_currency' => '<string>',
'amount' => '<string>',
'amount_type' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hopnow.io/v1/accounts/{account_id}/fx/quotes"
payload := strings.NewReader("{\n \"source_currency\": \"<string>\",\n \"target_currency\": \"<string>\",\n \"amount\": \"<string>\",\n \"amount_type\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<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.hopnow.io/v1/accounts/{account_id}/fx/quotes")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source_currency\": \"<string>\",\n \"target_currency\": \"<string>\",\n \"amount\": \"<string>\",\n \"amount_type\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hopnow.io/v1/accounts/{account_id}/fx/quotes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source_currency\": \"<string>\",\n \"target_currency\": \"<string>\",\n \"amount\": \"<string>\",\n \"amount_type\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"account_id": "<string>",
"source_currency": "<string>",
"target_currency": "<string>",
"amount_type": "<string>",
"source_amount": "<string>",
"target_amount": "<string>",
"all_in_rate": "<string>",
"expires_at": "<string>",
"executed_at": "<string>",
"created": "<string>",
"updated": "<string>"
}Foreign Exchange
Create FX Quote
Request a foreign exchange quote for currency conversion
POST
/
v1
/
accounts
/
{account_id}
/
fx
/
quotes
Create FX Quote
curl --request POST \
--url https://api.hopnow.io/v1/accounts/{account_id}/fx/quotes \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"source_currency": "<string>",
"target_currency": "<string>",
"amount": "<string>",
"amount_type": "<string>"
}
'import requests
url = "https://api.hopnow.io/v1/accounts/{account_id}/fx/quotes"
payload = {
"source_currency": "<string>",
"target_currency": "<string>",
"amount": "<string>",
"amount_type": "<string>"
}
headers = {
"X-API-Key": "<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': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source_currency: '<string>',
target_currency: '<string>',
amount: '<string>',
amount_type: '<string>'
})
};
fetch('https://api.hopnow.io/v1/accounts/{account_id}/fx/quotes', 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.hopnow.io/v1/accounts/{account_id}/fx/quotes",
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([
'source_currency' => '<string>',
'target_currency' => '<string>',
'amount' => '<string>',
'amount_type' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hopnow.io/v1/accounts/{account_id}/fx/quotes"
payload := strings.NewReader("{\n \"source_currency\": \"<string>\",\n \"target_currency\": \"<string>\",\n \"amount\": \"<string>\",\n \"amount_type\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<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.hopnow.io/v1/accounts/{account_id}/fx/quotes")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source_currency\": \"<string>\",\n \"target_currency\": \"<string>\",\n \"amount\": \"<string>\",\n \"amount_type\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hopnow.io/v1/accounts/{account_id}/fx/quotes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source_currency\": \"<string>\",\n \"target_currency\": \"<string>\",\n \"amount\": \"<string>\",\n \"amount_type\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"account_id": "<string>",
"source_currency": "<string>",
"target_currency": "<string>",
"amount_type": "<string>",
"source_amount": "<string>",
"target_amount": "<string>",
"all_in_rate": "<string>",
"expires_at": "<string>",
"executed_at": "<string>",
"created": "<string>",
"updated": "<string>"
}Path Parameters
string
required
The account’s external ID (starts with
acc_)Request Body
string
required
Currency to convert from (e.g., USD, EUR, USDC)
string
required
Currency to convert to (e.g., EUR, USD, USDT)
string
required
Amount to convert (decimal string, must be positive)
string
required
Whether the amount is in source or target currency:
source or targetResponse
string
FX quote identifier (starts with
fxq_)string
Always returns
"fx_quote"string
Account ID
string
Source currency code
string
Target currency code
string
Whether the amount is
source or targetstring
Source currency amount (decimal)
string
Target currency amount (decimal)
string
All-in exchange rate including spread (decimal)
string
ISO 8601 timestamp when quote expires
string
ISO 8601 timestamp when quote was executed (null if not yet executed)
string
ISO 8601 timestamp when created
string
ISO 8601 timestamp when last updated
Response Example
{
"id": "fxq_1234567890abcdef",
"object": "fx_quote",
"account_id": "acc_1234567890abcdef",
"source_currency": "USD",
"target_currency": "EUR",
"amount_type": "source",
"source_amount": "1000.00",
"target_amount": "855.69",
"all_in_rate": "0.85569",
"expires_at": "2024-01-15T10:05:00Z",
"executed_at": null,
"created": "2024-01-15T10:00:00Z",
"updated": "2024-01-15T10:00:00Z"
}
⌘I