# Authentication & API key Information
Building with an AI assistant? The full API is available as a machine-readable OpenAPI 3.1 specification (opens new window), and the documentation is published as llms.txt (opens new window) / llms-full.txt (opens new window). There is also a hosted MCP server (opens new window) at https://api.fxapi.com/mcp that AI agents can connect to directly.
fxapi uses API keys to allow access to the API. You can register a new API key at our developer portal (opens new window).
Multiple API keys
While our free plan only allows one API key at a time, our paid plans offer multiple API keys.
By using separate keys for different use cases you can track individual usage and make key rotations affect only certain
parts of your application.
# Your First Request
Register (opens new window) for a free account and copy your API key from the dashboard.
Request the latest exchange rates:
curl "https://api.fxapi.com/v1/latest?apikey=YOUR-APIKEY¤cies=EUR,CAD"You will receive a JSON response like this:
{ "meta": { "last_updated_at": "2022-01-01T23:59:59Z" }, "data": { "CAD": { "code": "CAD", "value": 1.26545 }, "EUR": { "code": "EUR", "value": 0.87945 } } }
From here you can explore the other endpoints: latest (opens new window), historical (opens new window), range (opens new window), convert (opens new window), currencies (opens new window) and status (opens new window).
# Official Libraries
# Authentication methods
To authorize, you can use the following ways:
# GET query parameter
You can pass your API key along with every request by adding it as a query parameter apikey
WARNING
This method could expose your API key in access logs and such. Sending the API key via a header parameter as specified below circumvents this problem.
# HTTP Header
You can set a request header with the name apikey
# Rate limit and quotas
You can use a certain amount of requests per month. This is defined by your plan.
Once you go over this quota you will be presented with a 429 HTTP status code and you either need to upgrade your plan
or wait until the end of the month.
On the free plan we additionally enforce a rate limit of 10 requests per minute. If you exceed this you will also be
presented with a 429 HTTP status code.
You then have to wait until the end of the minute to do more requests. Paid plans are not minute rate limited.
Not every request counts
Only successful calls count against your quota. Any error on our side or any validation error (e.g. wrong parameter) will NOT count against your quota or rate limit.
If you receive a 429, back off and retry after the period has reset: at the start of the next minute for the minute
rate limit, or at the start of the next month (or after an upgrade) for the monthly quota.
# Response Headers
We attach certain headers to tell you your current monthly quota, how much you have remaining in the period and what the request cost you.
X-RateLimit-Limit-Quota-Month: 300
X-RateLimit-Remaining-Quota-Month: 199
X-Cost: 1
X-Execution-Time: 6.51
| Header | Description |
|---|---|
X-RateLimit-Limit-Quota-Month | Your monthly request quota |
X-RateLimit-Remaining-Quota-Month | Remaining requests in your monthly quota |
X-Cost | Number of requests this call counted against your quota (0 for sandbox keys (opens new window)) |
X-Execution-Time | Server-side processing time in milliseconds |
On free plan responses you will additionally receive X-RateLimit-Limit-Quota-Minute and
X-RateLimit-Remaining-Quota-Minute headers for the minute rate limit. These headers are not sent on paid plans.