← Back to API Ninjas
Get daily historical exchange rates for a given currency pair
Returns daily historical exchange rates for a given currency pair. Data is available from 1999-01-01 onward. Provide either a single date or a start_date/end_date range (max 366 days).
API Ninjas·$0.001 per call
Example code
// Using @orth/sdk - The simplest way to call APIs
// Install: npm install @orth/sdk
import Orthogonal from "@orth/sdk";
const orthogonal = new Orthogonal({
apiKey: process.env.ORTHOGONAL_API_KEY,
});
const output = await orthogonal.run({
api: "api-ninjas",
path: "/v1/exchangeratehistorical",
query: {
"pair": "example"
}
});
console.log(output);Query parameters
pairrequired
string
Currency pair to query. Must be in the form of currency1_currency2 (e.g. USD_EUR)
date
string
Single date to query (YYYY-MM-DD). Either date or both start_date and end_date must be provided.
start_date
string
Start date of a range query (YYYY-MM-DD). Must be used with end_date.
end_date
string
End date of a range query (YYYY-MM-DD). Date range cannot exceed 366 days.