Get Exchange Rate
Retrieves a single exchange rate record with its base currency and conversion rates.
HTTP Request
- URL:
/exchangeRate/{id} - Method:
GET - Headers:
accessToken: Required. Your API access token.
- Required scope: None. Any valid access token can call this endpoint.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the exchange rate record. |
cURL Example
curl --location '<BASE_URL>/exchangeRate/66f1a2b3c4d5e6f708192a3b' \
--header 'accessToken: <ACCESS_TOKEN>'
Response
- 200 OK: The exchange rate record was returned successfully.
- 400 Bad Request: The ID is not valid.
Sample JSON Response
{
"success": true,
"data": {
"id": "66f1a2b3c4d5e6f708192a3b",
"baseCurrency": "USD",
"rates": [
{ "_id": "66f1a2b3c4d5e6f708192a3c", "currency": "EUR", "rate": 0.9214 },
{ "_id": "66f1a2b3c4d5e6f708192a3d", "currency": "GBP", "rate": 0.7712 }
],
"updatedAt": "2024-10-13T00:00:02.415Z",
"createdAt": "2024-09-23T17:41:07.902Z"
}
}
Response Details
Exchange Rate Data
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier of the exchange rate record. |
baseCurrency | String | Currency the rates convert from, for example USD. |
rates | Array | Conversion rates. Each rate has _id, currency and rate. |
updatedAt | String | Date and time the rates were last updated (ISO 8601). |
createdAt | String | Date and time the record was created (ISO 8601). |
Notes
- If no record matches the ID,
datais an empty object.