The currencies API enables you to retrieve the current exchange rates being utilized within Violet. These exchange rates are used when the base currency of an Offer or Bag does not match the source currency of the merchants external store. By directly accessing these exchange rates you are able to perform currency conversion within your application without the need to constantly retrieve Offer data from the Violet catalog. Instead you can use currency property of the Offer object to determine the source currency then use the relevant exchange rate to determine the price that should displayed in a shoppers currency.

GET /currencies/latest

Required Query Parameters

base_currency
required

The three-letter (ISO 4217 Alpha-3) currency code of your preferred base currency.

Optional Query Parameters

symbols

A list of comma-separated three-letter (ISO 4217 Alpha-3) currency codes to limit output currencies. If no symbols are included, the rates for all currencies will be included in the response.

Request

Curl
curl GET 'https://sandbox-api.violet.io/v1/currencies/latest?base_currency=USD&symbols=GBP,JPY,EUR' \
-H "X-Violet-App-Id: your-app-id-here" \
-H "X-Violet-App-Secret: your-app-secret-here" \
-H "X-Violet-Token: your-token-here" \
-H "Content-type: application/json"

Response

JSON
{
  "success": true,
  "timestamp": 1519296206,
  "base": "USD",
  "date": "2021-03-17",
  "rates": {
    "GBP": 0.72007,
    "JPY": 107.346001,
    "EUR": 0.813399
  }
}

Exchange rates will typically be cached within Violet for 60 minutes.

Was this page helpful?