# Import Exchange Rates

Add or update exchange rates for a specified exchange table by importing rates as a .csv file, or in a JSON array of hashes.

Endpoint: POST /foreign_exchange/exchange_tables/{id}/rates
Version: 1.0.0

## Query parameters:

  - `csv_file` (string, required)
    A CSV file with the following headers: Source Currency, Target Currency, Exchange Rate, and Effective Date.

For more details on how to format your CSV file, please see the Knowledge Base.

Alternatively, you can provide exchanges rates via the exchange_rates parameter. If both csv_file and exchange_rates are provided, csv_file will override exchange_rates.

## Path parameters:

  - `id` (integer, required)
    The ID of the Model.

## Request fields (application/json):

  - `exchange_rates` (array)
    An array of hashes represents an entire exchange rate table, while each hash represents a row in the table. Each row (hash) contains four (4) fields that make up a currency conversion, organized by columns in a table. These fields are source currency, target currency, effective date, and exchange rate of each currency conversion. Add hashes to define a new currency exchange, or modify the fields of existing hashes to update those currency conversions.

  - `exchange_rates.source_currency` (string)
    The currency you are converting from.

  - `exchange_rates.target_currency` (string)
    The currency you are converting to.

  - `exchange_rates.effective_date` (string)
    The date the exchange rate takes effect. The date must be in [ISO 8601](https://www.w3.org/TR/NOTE-datetime) format.

  - `exchange_rates.exchange_rate` (string)
    The rate of the exchange from source to target currency. For example, a rate of 1.53 for a USD (source) to AUD (target) conversion would mean 1USD = 1.53AUD.

## Response 200 fields (application/json):

  - `count` (integer)
    Number of exchange tables in the response.

  - `meta` (object)

  - `meta.count` (integer)
    Number of exchange tables in the response.

  - `meta.page_count` (integer)
    Number of pagination pages available.

  - `meta.page_number` (integer)
    Current pagination page.

  - `meta.page_size` (integer)
    Number of elements in a pagination page.

  - `results` (array)

  - `results.key` (string)

  - `results.id` (string)
    The ID of the exchange table.

  - `exchange_rates` (object)

  - `exchange_rates.id` (object)

  - `exchange_rates.id.id` (integer)
    The ID of the exchange rate.

  - `exchange_rates.id.exchange_table_id` (integer)
    The ID of the exchange table.

  - `exchange_rates.id.source_currency` (string)
    The currency you are converting from.

  - `exchange_rates.id.target_currency` (string)
    The currency you are converting to.

  - `exchange_rates.id.effective_date` (string)
    The date the exchange rate takes effect.

  - `exchange_rates.id.rate` (string)
    The rate of the exchange from source to target currency. For example, a rate of 1.53 for a USD (source) to AUD (target) conversion
                  would mean 1USD = 1.53AUD.

  - `exchange_rates.id.source_currency_symbol` (string)
    The symbol for the source currency.

## Response 400 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 401 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 403 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 404 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 422 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 503 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)


