Skip to main content

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:

FieldTypeRequiredDescription
baseCurrencyStringYesCurrency the rates convert from, for example USD.
updatedAtStringYesDate and time of the rates (ISO 8601).
ratesArrayNoConversion rates. See below.

Rate Object​

FieldTypeRequiredDescription
currencyStringYesCurrency code, for example EUR.
rateNumberYesHow 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​

FieldTypeDescription
successBooleanWhether the request was successful.
messageStringConfirmation message.
dataStringID of the new exchange rate record.