API Reference
/rates Endpoint
Fetch the full exchange-rate snapshot for a date, or rebased to any base currency.
Endpoints
GET https://api.currency-core.com/v1/rates
GET https://api.currency-core.com/v1/rates/:base
/v1/rates returns the full snapshot with USD as the base. /v1/rates/:base
returns the same snapshot re-expressed against any base currency, handy when
your product thinks in EUR, INR, or anything other than USD. Neither endpoint
converts a specific amount; for that, use /v1/convert.
Parameters
| Parameter | In | Description |
|---|---|---|
:base | path | Base currency (3-letter ISO 4217), e.g. USD, EUR. |
date | query | YYYY-MM-DD. Defaults to the latest available date. History goes back to 1949. A date with no snapshot (weekend / holiday / gap) resolves to the most recent earlier one, see Historical dates. |
Rates for a base currency
Every value is units of that currency per 1 unit of the base, the base
itself is always 1.
curl "https://api.currency-core.com/v1/rates/EUR?date=2024-11-01" \
-H "Authorization: Bearer cc_live_your_key"const res = await fetch("https://api.currency-core.com/v1/rates/EUR?date=2024-11-01", {
headers: { Authorization: "Bearer cc_live_your_key" },
});
const { rates } = await res.json();
console.log(rates.USD); // USD per 1 EURimport requests
res = requests.get(
"https://api.currency-core.com/v1/rates/EUR",
params={"date": "2024-11-01"},
headers={"Authorization": "Bearer cc_live_your_key"},
)
print(res.json()["rates"]["USD"])req, _ := http.NewRequest("GET",
"https://api.currency-core.com/v1/rates/EUR?date=2024-11-01", nil)
req.Header.Set("Authorization", "Bearer cc_live_your_key")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
var data struct {
Rates map[string]float64 `json:"rates"`
}
json.NewDecoder(res.Body).Decode(&data)
fmt.Println(data.Rates["USD"])HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.currency-core.com/v1/rates/EUR?date=2024-11-01"))
.header("Authorization", "Bearer cc_live_your_key")
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());<?php
$ch = curl_init("https://api.currency-core.com/v1/rates/EUR?date=2024-11-01");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer cc_live_your_key"]);
echo curl_exec($ch);
curl_close($ch);{
"base": "EUR",
"date": "2024-11-01",
"rates": {
"EUR": 1,
"USD": 1.0861,
"INR": 91.62,
"GBP": 0.835
}
}
Rebasing is exact: units-per-base = (units-per-USD) / (base-units-per-USD).
Historical dates & carry-forward
Rates are never missing for an in-range date. Two fallbacks fill the gaps, and both are reported so you always know what you got:
- Whole date missing (weekend, holiday, or a non-trading day): the response
serves the most recent earlier snapshot.
dateis the date actually used, andrequestedDateechoes what you asked for. It’s present only when the two differ. - One currency missing on an otherwise-present date (e.g. a currency not yet
listed, or temporarily unquoted): its most recent prior rate is carried forward.
Such currencies are listed in
asOf(code → the date the value is from).asOfis present only when at least one rate was carried forward.
{
"date": "2024-11-01",
"requestedDate": "2024-11-03",
"base": "USD",
"rates": { "USD": 1, "EUR": 0.92, "INR": 84.07, "CLP": 947.6 },
"asOf": { "CLP": "2024-10-31" }
}
Here 2024-11-03 (a Sunday) resolved back to Friday 2024-11-01, and CLP on
that date carried its last value from 2024-10-31.
Errors
| Status | Code | When |
|---|---|---|
400 | invalid_input | Base isn’t a 3-letter code. |
400 | unknown_currency | The base currency isn’t in the snapshot. |
404 | rate_not_found | No rate data exists on or before the requested date (i.e. before history begins). |