# Currency Pair Rate

Returns the exchange rate of one currency pair as a single number, also straight into Google Sheets and Excel. The rate is how many units of to one unit of from buys, together with the inverse. Latest by default, for the close of a past date, or for a datetime within your plan's intraday history. With format=text you get nothing but the number, which spreadsheets can read directly.

Plan required for datetime

The endpoint is available in all plans. The datetime parameter needs a plan with intraday updates; on a plan with daily updates, requests with datetime fail with a 403 status code:

{
    "message": "You are not allowed to use the datetime parameter, please upgrade your plan",
    "info": "For more information, see documentation: https://fxapi.com/docs/status-codes#_403"
}

Request Method: GET
Request URL: https://api.fxapi.com/v1/rate

# Request Parameters

Parameter Type Mandatory Description
apikey string ️ Your API Key
from string ️ The currency to convert from (e.g. EUR)
to string ️ The currency to convert to (e.g. USD)
date string The rate at the close of this past day (format: 2021-12-31)
Not together with datetime
datetime string The rate at this moment (ISO8601 Datetime, e.g. 2026-09-30T10:07:30Z), see rates at a moment
Needs a plan with intraday updates
precision integer Round rate and inverse to this many decimals (0 to 10)
By default values carry up to 10 decimals
format string json (default), text (only the rate as plain text, e.g. 1.0887771), csv (from,to,rate,inverse,last_updated_at) or xlsx
Numbers are never written in exponent notation
xlsx gives the same table as an Excel workbook, see Excel downloads (opens new window)

A request costs one request of your quota.

# Sample Request

curl -G https://api.fxapi.com/v1/rate \
    -d from=EUR \
    -d to=USD \
    -H "apikey: YOUR-API-KEY"

# Sample Response

meta.last_updated_at is the moment the rate applies to; rate is the number of units of to for one unit of from, inverse the number of units of from for one unit of to.

{
    "meta": {
        "last_updated_at": "2023-06-23T10:15:59Z"
    },
    "data": {
        "from": "EUR",
        "to": "USD",
        "rate": 1.0887771,
        "inverse": 0.918456
    }
}

# Rates at a moment of the day

With datetime the API answers with the rate of the minute, quarter hour or hour the moment falls in: the finest interval your plan updates at whose history still reaches back to the moment, the same points the range (opens new window) endpoint returns. meta.last_updated_at tells you which point that was.

  • minutes and quarter hours: not more than 7 days back
  • hours: older moments, not more than 3 months back

Moments further back return a 422; use date for those days instead. A moment that is not stored yet gets the newest rate.

curl -G https://api.fxapi.com/v1/rate \
    -d from=EUR \
    -d to=USD \
    -d datetime=2026-09-30T10:07:30Z \
    -H "apikey: YOUR-API-KEY"

On a plan with minute updates:

{
    "meta": {
        "last_updated_at": "2026-09-30T10:07:59Z"
    },
    "data": {
        "from": "EUR",
        "to": "USD",
        "rate": 1.1695906433,
        "inverse": 0.855
    }
}

# Plain Text and CSV

curl -G https://api.fxapi.com/v1/rate \
    -d from=EUR \
    -d to=USD \
    -d format=text \
    -d precision=4 \
    -H "apikey: YOUR-API-KEY"
1.0888

With precision, the text has exactly that many decimals. With format=csv:

from,to,rate,inverse,last_updated_at
EUR,USD,1.0887771,0.918456,2023-06-23T10:15:59Z

# Google Sheets and Excel

Because format=text returns nothing but the number, a spreadsheet cell can load a rate with a single formula. Pass your API key as the apikey query parameter, as spreadsheets cannot send headers. Anyone who can open the sheet can see the key in the formula.

Google Sheets:

=IMPORTDATA("https://api.fxapi.com/v1/rate?from=EUR&to=USD&format=text&apikey=YOUR-API-KEY")

Excel:

=VALUE(WEBSERVICE("https://api.fxapi.com/v1/rate?from=EUR&to=USD&format=text&apikey=YOUR-API-KEY"))

WEBSERVICE returns text, so VALUE turns it into a number. In Excel versions set to a decimal comma, use NUMBERVALUE(WEBSERVICE(...), ".") instead. Add &date=2025-12-31 to the URL for the close of a past day.

Every recalculation of the formula is a request and counts against your quota.