FX Get a quote
Get a quote
Returns a firm price to sell an amount of one currency for another. The quote lasts 5 minutes and can be used once, only by `POST /v1/fx/orders`. It does not set the rate of a transfer. A pair that is not enabled for you returns `quote currency pair is not supported`.
Api-Key
Headers
NameDescription
Idempotency-Key1 to 255 printable ASCII characters. A retry with the same key within 24 hours returns the first response, including a 400. After you correct a request, send a new key.
Body parameters
NameDescription
currency_pairThe currency you sell, then the currency you buy, in
FROM_TO form, such as USD_XAF. The four-part form USD_US_XAF_CM is also accepted; its countries do not change the price. It takes precedence over direction.directionThe same
FROM_TO form as currency_pair. It is not BUY or SELL.amountAmount you sell, in major units of the FROM currency, as a string. The API rejects a JSON number.
Response
Returns 200 OK. The quote
NameDescription
dataShow 7 child attributesobject
quote_idUse it once, with
POST /v1/fx/orders, before expires_atfrom_currencyto_currencyfrom_amountThe amount you sell
to_amountThe amount you buy, which is
from_amount times rate, not roundedrateUnits of the TO currency for 1 unit of the FROM currency
expires_atWhen the quote expires, 5 minutes after it is made
errorErrors
| Status | Meaning |
|---|---|
| 200 | The quote |
| 400 | The pair is not enabled for you, or the amount is invalid |
Was this page helpful? Yes No
Previous
Next
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl --request POST \
--url 'https://api.gravv.xyz/v1/fx/quote' \
--header 'Api-Key: <api-key>' \
--header 'Idempotency-Key: usd-xaf-order-1042' \
--header 'Content-Type: application/json' \
--data '{
"currency_pair": "USD_XAF",
"amount": "10000"
}'
const response = await fetch('https://api.gravv.xyz/v1/fx/quote', {
method: 'POST',
headers: {
'Api-Key': '<api-key>',
'Idempotency-Key': 'usd-xaf-order-1042',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"currency_pair": "USD_XAF",
"amount": "10000"
}),
});
const data = await response.json();
console.log(response.status, data);
import requests
url = "https://api.gravv.xyz/v1/fx/quote"
headers = {
"Api-Key": "<api-key>",
"Idempotency-Key": "usd-xaf-order-1042",
}
payload = {
"currency_pair": "USD_XAF",
"amount": "10000",
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{
"currency_pair": "USD_XAF",
"amount": "10000"
}`)
req, err := http.NewRequest("POST", "https://api.gravv.xyz/v1/fx/quote", bytes.NewReader(payload))
if err != nil {
panic(err)
}
req.Header.Set("Api-Key", "<api-key>")
req.Header.Set("Idempotency-Key", "usd-xaf-order-1042")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status)
fmt.Println(string(body))
}
require "json"
require "net/http"
require "uri"
uri = URI("https://api.gravv.xyz/v1/fx/quote")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
request = Net::HTTP::Post.new(uri)
request["Api-Key"] = "<api-key>"
request["Idempotency-Key"] = "usd-xaf-order-1042"
request["Content-Type"] = "application/json"
request.body = JSON.generate({
"currency_pair" => "USD_XAF",
"amount" => "10000",
})
response = http.request(request)
puts response.code
puts response.body
<?php
$payload = [
'currency_pair' => 'USD_XAF',
'amount' => '10000',
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.gravv.xyz/v1/fx/quote',
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Api-Key: <api-key>',
'Idempotency-Key: usd-xaf-order-1042',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
echo $status, PHP_EOL, $response, PHP_EOL;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"currency_pair": "USD_XAF",
"amount": "10000"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.gravv.xyz/v1/fx/quote"))
.header("Api-Key", "<api-key>")
.header("Idempotency-Key", "usd-xaf-order-1042")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.gravv.xyz/v1/fx/quote");
request.Headers.TryAddWithoutValidation("Api-Key", "<api-key>");
request.Headers.TryAddWithoutValidation("Idempotency-Key", "usd-xaf-order-1042");
request.Content = new StringContent(
"""
{
"currency_pair": "USD_XAF",
"amount": "10000"
}
""",
Encoding.UTF8,
"application/json");
using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
Responseapplication/json
200400OK
{
"data": {
"quote_id": "GRVOTC_3F9A1C",
"from_currency": "USD",
"to_currency": "XAF",
"to_amount": "6052500",
"from_amount": "10000",
"rate": "605.25",
"expires_at": "2026-10-12T09:25:00Z"
},
"error": null
}
{
"data": null,
"error": "quote currency pair is not supported"
}