Get Current Rates
The FX Rates API allows users to retrieve the latest indicative exchange rates for supported currency pairs.
This endpoint provides real-time exchange rate data, allowing businesses to convert between currencies. This API supports custom exchange calculations based on a fixed base or quote currency.
First, you need to understand the conversion logic:
Conversion Logic
The API supports two conversion types based on the fixed_side
parameter:
- Fixed Quote Currency (
fixed_side=quote
)- You specify how much quote currency you need.
- The API returns how much base currency is required.
- Example: "How much NGN do I need to get 10,000 USD?"
- Fixed Base Currency (
fixed_side=base
)- You specify how much base currency you have.
- The API returns how much quote currency you will receive.
- Example: "How much USD will I get for 10,000 NGN?"
Query Parameters
Parameter | Required | Description |
---|---|---|
base_currency | ✅ Yes | The source currency for the exchange. |
quote_currency | ✅ Yes | The destination currency for the exchange. |
amount | ❌ No | The amount to be exchanged in either base or quote currency (major currency units). |
fixed_side | ❌ No | Required if amount is set. Specifies which currency (base or quote ) should be fixed for conversion. |
Example Request
GET http://api.sandbox.waza.co/lync/rates/current?base_currency=NGN"e_currency=USD&amount=10000&fixed_side=quote
Explaining the Example:In the sample request, we are:
- Fetching the exchange rate for NGN to USD.
- The quote side is fixed, meaning we want to know how much NGN is needed to receive exactly 10,000 USD.
- If
fixed_side=base
, the API would return how much USD we would get for 10,000 NGN.
Example Response
A successful request returns a JSON response containing the latest exchange rates for multiple currency pairs.
{
"data": {
"pair": "NGN/USD",
"timestamp": 1743601175091,
"base_currency": "NGN",
"quote_currency": "USD",
"rate": "1765",
"conversion": {
"amount": "10000",
"fixed_side": "quote",
"base_amount": "17650000",
"quote_amount": "10000"
}
}
}
** Response Fields**
Field | Type | Description |
---|---|---|
pair | string | Currency pair in the format base/quote (e.g., NGN/USD ). |
timestamp | integer | Epoch timestamp (milliseconds) when this rate was generated. |
base_currency | string | The source currency in the exchange. |
quote_currency | string | The destination currency in the exchange. |
rate | string | The exchange rate represents how much base currency is needed for 1 quote currency. |
conversion | object | (Optional) Only present if amount and fixed_side are specified. Contains calculated exchange values. |
conversion.amount | string | The requested exchange amount. |
conversion.fixed_side | string | The fixed side of the exchange (base or quote ). |
conversion.base_amount | string | The amount of base currency required for the conversion. |
conversion.quote_amount | string | The amount of quote currency in the conversion. |
The API returns an error response with relevant details if the request fails.
Additional Notes
- Real-time Data: Exchange rates may fluctuate frequently. Ensure you fetch fresh data before making conversions.
- Timestamps: Use the
timestamp
field to track when the rate was generated to prevent outdated conversions.
Updated 3 months ago