Create Exchange Rate
Creates an exchange rate record with a base currency and a list of conversion rates.
HTTP Request
- URL:
/exchangeRate/create - Method:
POST - Headers:
accessToken: Required. Your API access token.Content-Type:application/json
- Required scope:
READ_WRITE_EXCHANGE_RATE
Request Body
The request body is a JSON object with the following fields:
| Field | Type | Required | Description |
|---|---|---|---|
baseCurrency | String | Yes | Currency the rates convert from, for example USD. |
updatedAt | String | Yes | Date and time of the rates (ISO 8601). |
rates | Array | No | Conversion rates. See below. |
Rate Object
| Field | Type | Required | Description |
|---|---|---|---|
currency | String | Yes | Currency code, for example EUR. |
rate | Number | Yes | How much of this currency equals 1 unit of the base currency. |
cURL Example
curl --location '<BASE_URL>/exchangeRate/create' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"baseCurrency": "USD",
"updatedAt": "2024-10-14T09:00:00.000Z",
"rates": [
{ "currency": "EUR", "rate": 0.9214 },
{ "currency": "GBP", "rate": 0.7712 }
]
}'
Response
- 200 OK: The exchange rate record was created successfully.
- 400 Bad Request: The access token is missing or invalid, the token does not have the required scope, or a field is missing or not valid.
Sample JSON Response
{
"success": true,
"message": "ExchangeRate added Successfully",
"data": "670cf1a2b3c4d5e6f708192a"
}
Response Details
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the request was successful. |
message | String | Confirmation message. |
data | String | ID of the new exchange rate record. |