API ReferenceMid market rates

Get historic rates for one base currency against one or more counter currencies over a period of time.

GET
/v1/historic_rate/period

This endpoint returns a daily historic rate for a single base currency and one or more counter currencies over a period of time.

https://xecdapi.xe.com/v1/historic_rate/period.csv/?from=USD&to=CAD&start_timestamp=2017-09-01&end_timestamp=2017-11-30&per_page=30

Authorization

AuthorizationBearer <token>

API key created on your Xe Currency Data account's API page, sent as a Bearer token in the Authorization header.

In: header

Query Parameters

from?string

OPTIONAL – Currency you want to convert from ISO code. Note if this parameter is omitted, default is USD.

to*string

Comma separated list of to currencies based on ISO 4217 codes. This will limit the data returned to only those currencies you are interested in. Note: Obsolete currencies are replaced by their precursor or successor currency.

amount?number

OPTIONAL – This parameter can be used to specify the amount you want to convert, if an amount is not specified then 1.00 is assumed.

start_timestamp?string

OPTIONAL - ISO 8601 timestamp in the format yyyy-mm-ddThh:mm giving the UTC date and time of the start of the period for which you would like rates returned.

If you’re querying using a daily interval, the time value will be ignored & the endpoint will return rates at your preferred daily lock-in time starting on the date specified in your request. If your account does not have a preferred daily lock-in time then rates will return as of 00:00 UTC. If you’re querying using a faster rate interval than daily rate interval, your endpoint will return rates starting at 00:00 UTC if no time portion is specified.

end_timestamp?string

OPTIONAL – ISO 8601 timestamp in the format yyyy-mm-ddThh:mm giving the UTC date and time of the end of the period for which you would like rates returned. If a time in the future is specified, the current time will be used. If no end_time is specified, the time specified in the “start_timestamp" parameter will also be used for the "end_timestamp". If your query is using a daily rate interval, your endpoint will return rates at your preferred daily lock-in time ending on the date specified in your request. If your account does not have a preferred daily lock-in time then rates will return as of 00:00 UTC. If your query is using a faster rate interval than daily, your endpoint will return daily rates at your specified lock-in time or 00:00 UTC by default, unless you specify a time parameter in your rate request.

interval?string

OPTIONAL – Using one of the interval values below in your call request will return rates for that specific interval.

"daily" - Returns one rate for the days specified in your time period "hourly" - Returns rates for every hour in the time period you specify "15minutes" - Returns rates for each 15 minute interval in the time period you specify, available for 7 days from current date ”minutely” - Returns minutely rates for the time period, available for 7 days from current date

If omitted, "daily" is used. This parameter is only used if both the "start_timestamp" and "end_timestamp" parameters have been specified.

page?number

OPTIONAL – You can specify the page number you want to request. Note: that page numbering is 1-based (the first page being page 1). Omitting this parameter will return the first page.

per_page?number

OPTIONAL – You can specify the number of days per page. The default is 30 days of rates per page with a maximum of 500 days of rates per page.

obsolete?boolean

OPTIONAL – If ‘true’ then endpoint will display rates for currencies that are obsolete. If ‘false’ then obsolete currencies are replaced by their successor currency.

inverse?boolean

OPTIONAL – If ‘true’ then endpoint will display the inverse of the converted value. If ‘false‘ then it will not be displayed.

decimal_places?number

OPTIONAL – This parameter can be used to specify the number of decimal places included in the output. Example 1 USD to EUR = 0.874852 with decimal_places=3, the output returned will be EUR = 0.875

margin?number

OPTIONAL – This parameter can be used to add a margin (-/+) to XE's mid-market rate. Example: add margin=2.05 parameter to the endpoint and the API will return our mid-market rates plus the margin of 2.05 percent.

crypto?boolean

OPTIONAL – If 'true' then this endpoint will return data for the following crypto currencies: ADA, ARB, AVAX, BCH, BNB, BTC, DAI, DOGE, DOT, ETH, EURC, LINK, LTC, LUNA, POL, SOL, TRX, UNI, USDC, USDP, USDT, XLM and XRP.

Note: Historical crypto data varies by currency. Most start from May 2022 onward.

Response Body

application/json

application/json

application/json

application/json

text/plain

curl -X GET "https://example.com/v1/historic_rate/period?to=string"
{  "terms": "https://www.xe.com/legal",  "privacy": "https://www.xe.com/privacy",  "from": "USD",  "amount": 1,  "to": {    "EUR": [      {        "mid": 0.8711750189,        "timestamp": "2026-09-18T03:00:00Z"      },      {        "mid": 0.870650765,        "timestamp": "2026-09-19T03:00:00Z"      }    ],    "GBP": [      {        "mid": 0.7485201486,        "timestamp": "2026-09-18T03:00:00Z"      },      {        "mid": 0.7466271079,        "timestamp": "2026-09-19T03:00:00Z"      }    ]  }}
{  "code": 12,  "message": "Date range error: start date 2026-01-01T00:00:00Z is after end date 2020-01-01T00:00:00Z",  "documentation_url": "https://developers.xe.com/docs/currency-data-api"}
{  "code": 1,  "message": "Bad credentials",  "documentation_url": "https://developers.xe.com/docs/currency-data-api"}
{  "code": 3,  "message": "Monthly rate limit exceeded.",  "documentation_url": "https://developers.xe.com/docs/currency-data-api"}
{  "code": 4,  "message": "Current interval rate limit exceeded.",  "documentation_url": "https://developers.xe.com/docs/currency-data-api"}
"An unexpected error occurred"
Get help