# Update rate

Updates an existing exchange rate. With this call, you can change `value_type` from `RATE` to `MARGIN` (and vice versa), change the actual `rate` value of the specified value type, or both.
**Example** - Updating an existing margin applied to the live FX rate:
A USD-GBP live FX rate of 0.80 is provided by a third-party rate provider and you currently reduce that rate by 20 BPS. You now want to change it and reduce it by 10 BPS instead. To do so, set `"rate": "10"` in the request. Once the change is applied, the final FX rate is calculated as 0.80*(1-(10/10000))=`0.7992` during the `Get quotes` call, and then applied during quote creation.

Endpoint: PUT /config/rates/{rate_id}
Version: 4.0.0
Security: Bearer

## Security:

  - `Bearer` (unknown)
    apiKey in header Authorization

## Path parameters:

  - `rate_id` (string, required)
    Provide the `rate_id` of the exchange rate you want to update.

## Request fields (application/json):

  - `expiration_offset` (integer, required)
    Set to the amount of time in milliseconds that the rate is valid for after the rate's `created_date` value. Set to `0` to indicate that the rate does not expire. The value returned in the response object for this field is `null`. Refer to the `expires_at` value in the response object to verify your expiration offset timing.
    Example: 95000

  - `order_type` (string, required)
    Set to the order type for the exchange rate.
    Enum: "buy", "sell"

  - `rate` (number, required)
    This value of this field represents either rate or margin based on what you specify in the `value_type` field.
If you specify `value_type=rate`, set the value of this field to the exchange rate for a base and counter currency. The rate can use up to 6 decimal
places.
If you specify `value_type=margin`, set the value of this field depending on the unit of margin you specified in the `margin_type` field.
    Example: 0.89

  - `base_currency` (string, required)
    Set to the base currency of the exchange rate.
    Example: USD

  - `counter_currency` (string, required)
    Set to the counter currency of the exchange rate.
    Example: GBP

  - `ledger` (object)
    Use the `ledger` request object to create an exchange rate that applies to exchanges between a specific source ledger and destination ledger.

  - `ledger.source_ledger` (string, required)
    Set to the source ledger associated with the exchange rate.
    Example: rn.eur.uk.london

  - `ledger.destination_ledger` (string, required)
    Set to the destination ledger associated with the exchange rate.
    Example: rn.eur.uk.london

  - `account` (object)
    Use the `account` request object to create an exchange rate that applies to exchanges between a specific source ledger account and destination ledger account.

  - `account.source_ledger` (string, required)
    Set to the source ledger associated with the exchange rate.
    Example: rn.eur.uk.london

  - `account.destination_ledger` (string, required)
    Set to the destination ledger associated with the exchange rate.
    Example: rn.eur.uk.london

  - `account.source_ledger_account` (string, required)
    Set to the account on the source ledger associated with the rate.
    Example: alias_usd_lon

  - `account.destination_ledger_account` (string, required)
    Set to the account on the destination ledger associated with the rate.
    Example: conct_gbp_lon

  - `lower_limit` (number)
    To create a slab-based exchange rate, provide the lower limit of the slab. You must also provide an `upper_limit` value.
    Example: 0

  - `upper_limit` (number)
    To create a slab-based exchange rate, provide the upper limit of the slab. You must also provide a `lower_limit` value.
    Example: 1000

  - `payout_method` (string)
    The payout method for the rate.
    Example: LOCAL_RAILS

  - `value_type` (string)
    Specify whether you want to use a live exchange rate (`MARGIN`) or an exchange rate manually configured by Ripple (`RATE`). If you set this value to `MARGIN`, you must also provide `margin_type`.
    Enum: "MARGIN", "RATE"

  - `margin_type` (string)
    Specify the unit of margin to be applied (BPS) in addition to the rate provided by Ripple. Specify this field only if you set `value_type` = `MARGIN`.
    Enum: "BPS"

## Response 200:

  - `200` (unknown)
    Successfully updated rate.

## Response 200 fields (application/json):

  - `rate_id` (string, required)
    Unique identifier of the exchange rate.
    Example: 328b3e50-7983-46d5-94a0-ef004d78db1d

  - `expiration_offset` (integer, required)
    (DEPRECATED) This property is deprecated. Refer to `expires_at` to determine rate expiration. Amount of time in milliseconds that the rate is valid for after the rate's `created_date` value. For example, if the `expiration_offset` value is `100000` milliseconds, the rate expires `100000` milliseconds after this `created_date` value. If set to `0`, the rate does not expire.
    Example: 95000

  - `order_type` (string, required)
    Order type for the exchange rate.
    Enum: "buy", "sell"

  - `rate_scale` (integer, required)
    Number of decimal places to which the exchange rate is calculated. For example, if the `rate_scale` value is set to `9` and the `rate` value is set to `1.25`, the scaled value of the rate is `1.250000000`.
    Example: 9

  - `rate` (number, required)
    Exchange rate for the specified base and counter currency.
    Example: 0.89

  - `base_currency` (string, required)
    Base currency of the exchange rate.
    Example: USD

  - `counter_currency` (string, required)
    Counter currency of the exchange rate.
    Example: GBP

  - `source_currency` (string, required)
    If `order_type` is set to `buy`, this is set to the base currency. If `order_type` is set to `sell`, this is set to the counter currency.
    Example: USD

  - `destination_currency` (string, required)
    If `order_type` is set to `buy`, this is set to the counter currency. If `order_type` is set to `sell`, this is set to the base currency.
    Example: GBP

  - `source_ledger` (string, required)
    Source ledger associated with the exchange rate.
    Example: rn.eur.uk.london

  - `destination_ledger` (string, required)
    Destination ledger associated with the exchange rate.
    Example: rn.eur.uk.london

  - `source_ledger_account` (string, required)
    Account on the source ledger associated with rate.
    Example: alias_usd_lon

  - `destination_ledger_account` (string, required)
    Account on the destination ledger associated with rate.
    Example: conct_gbp_lon

  - `created_date` (string, required)
    Date and time at which the exchange rate was created, as an ISO-8601 timestamp in UTC. Fiat determines a rate's expiration date and time based on this value and `expiration_offset` value. For example, if the `expiration_offset` value is `100000` milliseconds, the rate expires `100000` milliseconds after this `created_date` value.

  - `expires_at` (string)
    The time in which this rate expires in system local timezone

  - `lower_limit` (number, required)
    For a slab-based exchange rate, indicates the lower limit of the slab.
    Example: 0

  - `upper_limit` (number, required)
    For a slab-based exchange rate, indicates the upper limit of the slab.
    Example: 1000

  - `payout_method` (string)
    The payout method for the rate.
    Example: LOCAL_RAILS

  - `value_type` (string, required)
    Indicates whether the rate is a live exchange rate (`MARGIN`) or an exchange rate manually configured by Ripple (`RATE`). If this value is `MARGIN`, then `margin_type` will show a value.
    Enum: "MARGIN", "RATE"

  - `margin_type` (string, required)
    Indicates the unit of margin applied in addition to the rate provided by Ripple. This field has a value only if `value_type` = `MARGIN`. If `value_type` is `RATE`, this field is `null`.
    Enum: "BPS"

## Response 400:

  - `400` (unknown)
    Request error.

## Response 400 fields (application/json):

  - `type` (string)
    URL to the error documentation.
    Example: https://errors.ripplenet.ripple.com/error/json-processing-error

  - `title` (string)
    Summary of the returned problem.
    Example: Invalid Request Object

  - `detail` (string)
    Description of the returned problem.
    Example: The request parameter [account_id] is not in the correct format.

  - `status` (number)
    HTTP error code.
    Example: 400

  - `ripplenet_error_code` (string)
    RippleNet specific error code.
    Example: E0104

  - `finality` (string)
    Specifies if the request can be retried for a successful response.
    Example: PERMANENT

