# Latest Exchange Rates
AI coding agents: run curl -s https://fxapi.com/agents.md and follow it: an API key, the first call and the right plan, step by step.
Returns the latest exchange rates. The default base currency is USD.
Data update intervals
Depending on your subscription plan you will receive new data in different time intervals. While our dataset in the free plan is updated daily our bigger plans offer up to minute update intervals!
Request Method: GET
Request URL: https://api.fxapi.com/v1/latest
# Request Parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
apikey | string | ️ | Your API Key |
base_currency | string | The base currency to which all results are behaving relative to By default all values are based on USD | |
currencies | string | A list of comma-separated currency codes which you want to get (EUR,USD,CAD) The array form currencies[]=EUR¤cies[]=USD is also acceptedBy default all available currencies will be shown | |
type | string | Filter the returned currencies by type Possible Values: fiat, metal, cryptoBy default currencies of all types are returned | |
shape | string | default or compactWith compact every rate is a plain value ("EUR": 0.918456) instead of a code/value object | |
precision | integer | Round every value to this many decimals (0 to 10)By default values carry up to 10 decimals | |
inverse | boolean | true adds inverse to every rate: the value of one unit of the currency in the base currency (1 / value)Not together with shape=compact | |
include | string | change adds change and change_pct to every rate: the difference to the close of the previous day, which meta.change_since names (null when that close has no rate for the currency)Not together with shape=compact | |
format | string | json (default), csv or xlsx. The CSV has one row per currency: datetime,base_currency,currency,value, plus inverse and change,change_pct when you request themxlsx gives the same table as an Excel workbook, see Excel downloads (opens new window) |
Without these options the response keeps its default structure. A request costs one request of your quota, with or without them.
# Sample Response
The API response comes as a JSON and consists of a meta and a data key.
The meta holds useful information like the last_updated_at datetime to let you know when this dataset was last updated,
and the base_currency of the values.
The data key holds the actual currency information.
{
"meta": {
"last_updated_at": "2022-01-01T23:59:59Z",
"base_currency": "USD"
},
"data": {
"AED": {
"code": "AED",
"value": 3.67306
},
"AFN": {
"code": "AFN",
"value": 91.80254
},
"ALL": {
"code": "ALL",
"value": 108.22904
},
"AMD": {
"code": "AMD",
"value": 480.41659
},
"...": "150+ more currencies"
}
}
# Compact values, inverse rates and the daily change
With shape=compact every rate is a plain value:
curl -G https://api.fxapi.com/v1/latest \
-d currencies=EUR,GBP \
-d shape=compact \
-H "apikey: YOUR-API-KEY"
{
"meta": {
"last_updated_at": "2023-06-23T10:15:59Z",
"base_currency": "USD"
},
"data": {
"EUR": 0.918456,
"GBP": 0.786123
}
}
inverse=true and include=change add fields to every rate, here rounded to 4 decimals:
curl -G https://api.fxapi.com/v1/latest \
-d currencies=EUR,GBP \
-d inverse=true \
-d include=change \
-d precision=4 \
-H "apikey: YOUR-API-KEY"
{
"meta": {
"last_updated_at": "2023-06-23T10:15:59Z",
"base_currency": "USD",
"change_since": "2023-06-22T23:59:59Z"
},
"data": {
"EUR": {
"code": "EUR",
"value": 0.9185,
"inverse": 1.0888,
"change": 0.0012,
"change_pct": 0.1308
},
"GBP": {
"code": "GBP",
"value": 0.7861,
"inverse": 1.2721,
"change": -0.002,
"change_pct": -0.2538
}
}
}
change is value minus the rate at change_since, rounded like value; change_pct is that change in percent,
rounded to 4 decimals, as /fluctuation (opens new window) computes it.
With format=csv (here with inverse=true&precision=4):
datetime,base_currency,currency,value,inverse
2023-06-23T10:15:59Z,USD,EUR,0.9185,1.0888
2023-06-23T10:15:59Z,USD,GBP,0.7861,1.2721