Get an FX Rate (Legacy)
Overview
The Get FX Rate API provides real-time foreign exchange rates for currency pairs. Users specify the source (currencyFrom) and target (currencyTo) currencies (e.g. USD to NGN) to retrieve the live exchange rate. The response contains a vfx_token with an expiry of 30 seconds used to execute an FX trade.
Resource Access
- HTTP Method:
GET - Endpoint:
/orders/v2.1/fx - Authentication: Bearer token required
Request Headers
| Header | Value | Required | Description |
|---|---|---|---|
Accept | application/json | Yes | Content type for the response |
Authorization | Bearer {access_token} | Yes | Bearer token for authentication |
x-api-key | string | No | API key for additional authentication |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
currencyFrom | string | Yes | The 3-letter ISO 4217 source currency code (e.g. USD). |
currencyTo | string | Yes | The 3-letter ISO 4217 target currency code (e.g. NGN). |
Response
Success Response (200 OK)
{
"success": true,
"rate": 571.48838125,
"vfx_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXJyZW5jeUZyb20iOiJVU0QiLCJjdXJyZW5jeVRvIjoiTkdOIiwiY29tcGFueUlkIjoiNTI1IiwicmF0ZSI6NTcxLjQ4ODM4MTI1LCJzcHJlYWQiOjkuNjYxNjE4NzUsImlhdCI6MTcyMTAzODkwMiwiZXhwIjoxNzIxMDM4OTMyfQ.pI2LSZ8ulaWVuxqGVRe_ORv8yyXepx771glEVFcIluo",
"expiry": "2024-07-15T10:22:12.812Z"
}
Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Flag indicating whether the quote request was successful. |
rate | number | The current exchange rate between the currency pair. |
vfx_token | string | Rate token valid for 30 seconds. Required to execute an FX trade. |
expiry | string (date-time) | ISO 8601 timestamp when the rate token expires. |
Error Responses
- 400 Bad Request: Invalid parameters or malformed request
- 401 Unauthorized: Missing or invalid Bearer authentication token
- 403 Forbidden: Insufficient account permissions
- 404 Not Found: Resource not found
- 500 Internal Server Error: An internal server error occurred
Code Examples
Base URL
Production: https://api.ahrvo.network
Staging: https://gateway.ahrvo.network
cURL
curl -X GET \
'https://gateway.ahrvo.network/banking/ibans/v2/orders/v2.1/fx?currencyFrom=USD¤cyTo=NGN' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
Python
import requests
url = "https://gateway.ahrvo.network/banking/ibans/v2/orders/v2.1/fx"
params = {"currencyFrom": "USD", "currencyTo": "NGN"}
headers = {
"Accept": "application/json",
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
response = requests.get(url, params=params, headers=headers)
print(response.json())
JavaScript (Node.js)
const axios = require('axios');
const url = 'https://gateway.ahrvo.network/banking/ibans/v2/orders/v2.1/fx';
const headers = {
'Accept': 'application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
};
const params = { currencyFrom: 'USD', currencyTo: 'NGN' };
axios.get(url, { headers, params })
.then(response => console.log(response.data))
.catch(error => console.error(error.response ? error.response.data : error.message));
Usage Notes
- The
vfx_tokenis strictly valid for 30 seconds. - Use the token immediately with the Create an FX Trade API to lock in the quoted rate.
- If the token expires, you must make another call to Get an FX Rate to obtain a fresh token.