Update currency rates

The Update currency rates method is used to update exchange currency rates for the current reseller or any of its downstream resellers:

  • For the list of available currencies, see Get list of currency rates.
  • You can update several currency rates at once.
  • If the same currency pair is specified several times in a request, the currency rate is updated sequentially several times.

Currency rates and adjustment coefficients are automatically updated for every reseller on all downstream levels if a downstream reseller did not specify custom values. By default, all currency rates and adjustment coefficients are equal to 1. For details, see Managing currency rates.

An API token of a manager is required for authorization. To get an API token via the Operator Control Panel, see Viewing and updating manager's information

The manager's API token specified in an API request determines:

  • The role and access level of the manager, which determine the availability of a method.
  • The current reseller and downstream resellers accessible within a method.

PATCH {base_url}/api/v3/resellers/{reseller_id}/currency_rates

Arguments

Name

Parameter type

Data type

Required/Optional

Description

X-Api-TokenheaderstringRequiredAPI token of a manager that performs the operation (see Viewing and updating manager's information)
Content-TypeheaderstringRequiredMedia type of the request. Specify the following: application/vnd.api+json
AcceptheaderstringRequired

Supported media types of the answer. Specify the following: application/vnd.api+json

base_urlpathstringRequiredActivePlatform URL
reseller_idpathintegerRequiredThe ID of the current reseller or any of its downstream resellers (see Viewing and updating reseller general information)
base_currencyformstringRequiredThe ISO 4217:2008 code of a currency, in relation to which the exchange rate is updated. For example, the reseller's currency
foreign_currencyformstringRequiredThe ISO 4217:2008 code of a currency, the exchange rate of which is being updated. For example, the currency of a plan
quantityformintegerRequiredNumber of currency units used for a currency rate
rateformnumberRequiredThe new currency rate for the specified quantity
adjustmentformnumberOptionalThe new adjustment value for customers — the coefficient by which the currency rate is multiplied (from 0.0001 to 1000)
show_for_clientformboolOptional

Indicates whether a currency rate is displayed in the Customer Control Panel (see Screen layout):

  • true — currency rate is displayed in the Customer Control Panel.
  • false — currency rate is not displayed in the Customer Control Panel.

Response model

NameData typeDescription
dataarray of objectsResponse data

idstringID of the currency rate

typestringData type

attributesobject

Attributes of the currency rates set for the reseller currency



created_atstringDate and time of the currency rates creation


updated_atstringDate and time when the currency rates were updated


from_idstringThe ID of a currency, the exchange rate of which is set. Corresponds to foreign_currency in a request 


to_idstringThe ID of a currency, in relation to which the exchange rate is set. Corresponds to base_currency in a request 


ratestringCurrency rate for the specified quantity


quantityintegerNumber of currency units used for a currency rate


currentboolIndicates whether the value is a current currency rate. Always returns true


reseller_idintegerThe reseller ID


show_for_clientbool

Indicates whether a currency rate is displayed in the Customer Control Panel (see Screen layout):

  • true — currency rate is displayed in the Customer Control Panel.
  • false — currency rate is not displayed in the Customer Control Panel.

Request example

PATCH /api/v3/resellers/1/currency_rates
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetest3gJXZH5uHCw
Accept: application/vnd.api+json
{
    "data": {
        "attributes": [
            {
                "base_currency": "USD",
                "foreign_currency": "EUR",
                "quantity": 1,
                "rate": 1.2200,
                "adjustment": 1.2000,
                "show_for_client": true
            },
            {
                "base_currency": "USD",
                "foreign_currency": "MYR",
                "quantity": 100,
                "rate": 1.43,
                "adjustment": 1.1100,
                "show_for_client": true
            }
        ]
    }
}

Response example

{
    "data": [
        {
            "id": "606",
            "type": "currency_rates",
            "attributes": {
                "created_at": "2024-10-04T16:23:46.198+03:00",
                "updated_at": "2024-10-04T16:23:46.198+03:00",
                "from_id": 2,
                "to_id": 1,
                "rate": "1.22",
                "quantity": 1,
                "current": true,
                "reseller_id": 1,
                "show_for_client": true,
                "adjustment": "1.2"
            }
        },
        {
            "id": "607",
            "type": "currency_rates",
            "attributes": {
                "created_at": "2024-10-04T16:23:46.235+03:00",
                "updated_at": "2024-10-04T16:23:46.235+03:00",
                "from_id": 4,
                "to_id": 1,
                "rate": "1.43",
                "quantity": 100,
                "current": true,
                "reseller_id": 1,
                "show_for_client": true,
                "adjustment": "1.11"
            }
        }
    ]
}