# 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

  1. Register (opens new window) for a free account and copy your API key from the dashboard.

  2. Request the latest exchange rates:

    curl "https://api.fxapi.com/v1/latest?apikey=YOUR-APIKEY&currencies=EUR,CAD"
    
  3. 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

Language Code Repository
Go https://github.com/everapihq/fxapi-go (opens new window) https://pkg.go.dev/github.com/everapihq/fxapi-go (opens new window)
C# https://www.nuget.org/packages/fxapi (opens new window)
Python https://github.com/everapihq/fxapi-python (opens new window) https://pypi.org/project/fxapicom/ (opens new window)
Ruby https://github.com/everapihq/fxapi-ruby (opens new window) https://rubygems.org/gems/fxapi (opens new window)
Rust https://github.com/everapihq/fxapi-rs (opens new window) https://crates.io/crates/fxapi-rs (opens new window)
PHP https://github.com/everapihq/fxapi-php (opens new window) https://packagist.org/packages/everapi/fxapi-php (opens new window)
JavaScript ES6 module https://github.com/everapihq/fxapi-js (opens new window) https://www.npmjs.com/package/@everapi/fxapi-js (opens new window)

# 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.