# freecurrencyapi documentation > freecurrencyapi provides free current and historical foreign exchange rates over a simple JSON REST API. Authenticate every request with your API key via the `apikey` query parameter or request header. Base URL: https://api.freecurrencyapi.com OpenAPI specification: https://freecurrencyapi.com/docs/openapi.yaml ## Get an API key - AI coding agents: run curl -s https://freecurrencyapi.com/agents.md and follow it (key, first call, plans). 1. Sign up free at https://app.freecurrencyapi.com/register (1,000 free requests a month). 2. Send the key in the `apikey` header (or `?apikey=`). 3. Store it as FREECURRENCYAPI_KEY. `curl -H "apikey: $FREECURRENCYAPI_KEY" "https://api.freecurrencyapi.com/v1/latest?currencies=EUR,GBP"` MCP: https://api.freecurrencyapi.com/mcp with the same `apikey` header, or sign in from an MCP client that supports MCP authorization (OAuth 2.1): https://api.freecurrencyapi.com/.well-known/oauth-protected-resource/mcp names the authorization server. --- Source: https://freecurrencyapi.com/docs/ # Introduction AI coding agents: run `curl -s https://freecurrencyapi.com/agents.md` and follow it: an API key, the first call and the right plan, step by step. freecurrencyapi provides free current and historical foreign exchange rates over a simple JSON REST API. Get your free API key at [https://app.freecurrencyapi.com/register](https://app.freecurrencyapi.com/register) — you need it for every request. Building with an AI assistant? The full API is available as a machine-readable [OpenAPI 3.1 specification](https://freecurrencyapi.com/docs/openapi.yaml), and the documentation is published as [llms.txt](https://freecurrencyapi.com/docs/llms.txt) / [llms-full.txt](https://freecurrencyapi.com/docs/llms-full.txt). There is also a hosted [MCP server](https://freecurrencyapi.com/docs/mcp) at `https://api.freecurrencyapi.com/mcp` that AI agents can connect to directly. Using an AI coding agent? Paste `Run curl -s https://freecurrencyapi.com/agents.md and follow it to set up freecurrencyapi for me in this project.` into it, or see [Onboard your agent](https://freecurrencyapi.com/agents/). ## Authentication & API key Information freecurrencyapi.com uses API keys to allow access to the API. You can get your API key by [registering for a free account](https://app.freecurrencyapi.com/register). ## 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` 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. ```bash curl "https://api.freecurrencyapi.com/v1/latest?apikey=YOUR-APIKEY" ``` ```javascript var oReq = new XMLHttpRequest(); oReq.addEventListener("load", function () { console.log(this.responseText); }); oReq.open("GET", "https://api.freecurrencyapi.com/v1/latest?apikey=YOUR-APIKEY"); oReq.send(); ``` ```php $url = "https://api.freecurrencyapi.com/v1/latest?apikey=YOUR-APIKEY"; $curl = curl_init($url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $resp = curl_exec($curl); var_dump($resp); ``` ```python import requests url = "https://api.freecurrencyapi.com/v1/latest?apikey=YOUR-APIKEY" resp = requests.get(url) print(resp.status_code) ``` ### HTTP Header You can set a request header with the name `apikey` ```bash curl "https://api.freecurrencyapi.com/v1/latest" \ -H "apikey: YOUR-APIKEY" ``` ```javascript var oReq = new XMLHttpRequest(); oReq.addEventListener("load", function () { console.log(this.responseText); }); oReq.open("GET", "https://api.freecurrencyapi.com/v1/latest"); oReq.setRequestHeader("apikey", "YOUR-APIKEY"); oReq.send(); ``` ```php $url = "https://api.freecurrencyapi.com/v1/latest"; $curl = curl_init($url); $headers = array( "apikey: YOUR-APIKEY", ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $resp = curl_exec($curl); var_dump($resp); ``` ```python import requests from requests.structures import CaseInsensitiveDict url = "https://api.freecurrencyapi.com/v1/latest" headers = CaseInsensitiveDict() headers["apikey"] = "YOUR-APIKEY" resp = requests.get(url, headers=headers) print(resp.status_code) ``` ## Rate limit and quotas You can use a certain amount of requests per month. Once you go over this quota you will be presented with a `429` HTTP status code, and you have to wait a month to do more requests. We enforce a minute rate limit on the free plan: up to 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. 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. ### Response Headers We attach certain headers to tell you your current monthly/minute quota and how much you have remaining in the period. ```HTTP X-RateLimit-Limit-Quota-Minute: 5 X-RateLimit-Limit-Quota-Month: 1000 X-RateLimit-Remaining-Quota-Minute: 3 X-RateLimit-Remaining-Quota-Month: 929 ``` The `*-Quota-Minute` headers are only sent on the free plan; paid plans do not receive them. The minute headers count on the gateway node that answered the request: `X-RateLimit-Limit-Quota-Minute` shows that node's limit (5), and with our two gateway nodes that makes the 10 requests per minute of the free plan. `X-RateLimit-Remaining-Quota-Minute` is what is left on that node. Successful JSON responses from the data endpoints (latest, historical and currencies) also include an `X-Cost` header with the quota cost of the request and an `X-Execution-Time` header with the server-side processing time in milliseconds. Responses from the status endpoint include neither header. ## Official libraries | Language | Code | Repository | |------------------------|------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------| | PHP | [https://github.com/everapihq/freecurrencyapi-php](https://github.com/everapihq/freecurrencyapi-php) | [https://packagist.org/packages/everapi/freecurrencyapi-php](https://packagist.org/packages/everapi/freecurrencyapi-php) | | Python | [https://github.com/everapihq/freecurrencyapi-python](https://github.com/everapihq/freecurrencyapi-python) | [https://pypi.org/project/freecurrencyapi/](https://pypi.org/project/freecurrencyapi/) | | R | [https://github.com/everapihq/freecurrencyapi-r](https://github.com/everapihq/freecurrencyapi-r) | [https://cran.r-project.org/web/packages/freecurrencyapi/index.html](https://cran.r-project.org/web/packages/freecurrencyapi/index.html) | | Ruby | [https://github.com/everapihq/freecurrencyapi-ruby](https://github.com/everapihq/freecurrencyapi-ruby) | [https://rubygems.org/gems/freecurrencyapi-official](https://rubygems.org/gems/freecurrencyapi-official) | | JavaScript ES6 module | [https://github.com/everapihq/freecurrencyapi-js](https://github.com/everapihq/freecurrencyapi-js) | [https://www.npmjs.com/package/@everapi/freecurrencyapi-js](https://www.npmjs.com/package/@everapi/freecurrencyapi-js) | | Rust | [https://github.com/everapihq/freecurrencyapi-rs](https://github.com/everapihq/freecurrencyapi-rs) | [https://crates.io/crates/freecurrencyapi-rs](https://crates.io/crates/freecurrencyapi-rs) | | C# | [https://github.com/everapihq/freecurrencyapi-dotnet](https://github.com/everapihq/freecurrencyapi-dotnet) | [https://www.nuget.org/packages/freecurrencyapi/](https://www.nuget.org/packages/freecurrencyapi/) | --- Source: https://freecurrencyapi.com/docs/currencies # Currencies Endpoint Returns all our supported currencies. The API supports 33 currencies — see the full [currency list](https://freecurrencyapi.com/docs/currency-list). **Request Method:** `GET` **Request URL:** `https://api.freecurrencyapi.com/v1/currencies` ## Request Parameters | Parameter | Type | Mandatory | Description | | ------------ | --------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------- | | `apikey` | _string_ | yes | Your API Key | | `currencies` | _string_ | | A list of comma-separated currency codes which you want to get (EUR,USD,CAD)By default all available currencies will be shown | | `as_html` | _boolean_ | | `1` returns the currency list as an HTML table instead of JSON | ## Example Request ```bash curl "https://api.freecurrencyapi.com/v1/currencies?currencies=EUR,GBP" \ -H "apikey: YOUR-APIKEY" ``` ## Sample Response ```json { "data": { "EUR": { "symbol": "€", "name": "Euro", "symbol_native": "€", "decimal_digits": 2, "rounding": 0, "code": "EUR", "name_plural": "Euros", "type": "fiat" }, "GBP": { "symbol": "£", "name": "British Pound Sterling", "symbol_native": "£", "decimal_digits": 2, "rounding": 0, "code": "GBP", "name_plural": "British pounds sterling", "type": "fiat" } } } ``` Because the example request filters to `currencies=EUR,GBP`, exactly those two entries are returned; omit the `currencies` parameter to receive all 33 supported currencies. ## Response fields | Field | Description | | ---------------- | ------------------------------------------------------------------- | | `code` | The ISO 4217 code you pass as `base_currency` or in `currencies` | | `name` | English name | | `name_plural` | English plural, e.g. for "250 Euros" | | `symbol` | Symbol as used in English, e.g. `$` or `CA$` | | `symbol_native` | Symbol as used in the currency's own country | | `decimal_digits` | Number of decimals to show for amounts in this currency | | `rounding` | Rounding increment for amounts, `0` for no special rounding | | `type` | `fiat` for every currency freecurrencyapi supports | ## HTML table With `as_html=1` the endpoint returns an HTML `` with the columns Code and Name instead of JSON, ready to embed in a page. ## Errors and quota An unknown code in `currencies` returns `422` with the parameter in `errors`. A successful call counts against your monthly quota like the rate endpoints; the `X-Cost` response header shows how many requests it used. --- Source: https://freecurrencyapi.com/docs/currency-list # Currency List freecurrencyapi supports these 33 currencies. Pass any of the codes as `base_currency` or in the comma-separated `currencies` parameter of the [latest](https://freecurrencyapi.com/docs/latest) and [historical](https://freecurrencyapi.com/docs/historical) endpoints, for example `currencies=EUR,GBP,JPY`. An unknown code returns a `422` validation error. The same list is available from the [currencies endpoint](https://freecurrencyapi.com/docs/currencies), which also returns each currency's symbol, plural name and decimal digits, or an HTML table with `as_html=1`. The codes are ISO 4217 codes. The rates of all of them are end-of-day rates, updated once a day. CodeNameEUREuroUSDUS DollarJPYJapanese YenBGNBulgarian LevCZKCzech Republic KorunaDKKDanish KroneGBPBritish Pound SterlingHUFHungarian ForintPLNPolish ZlotyRONRomanian LeuSEKSwedish KronaCHFSwiss FrancISKIcelandic KrónaNOKNorwegian KroneHRKCroatian KunaRUBRussian RubleTRYTurkish LiraAUDAustralian DollarBRLBrazilian RealCADCanadian DollarCNYChinese YuanHKDHong Kong DollarIDRIndonesian RupiahILSIsraeli New SheqelINRIndian RupeeKRWSouth Korean WonMXNMexican PesoMYRMalaysian RinggitNZDNew Zealand DollarPHPPhilippine PesoSGDSingapore DollarTHBThai BahtZARSouth African Rand ## Example ```bash curl "https://api.freecurrencyapi.com/v1/latest?base_currency=EUR¤cies=USD,GBP,CHF" \ -H "apikey: YOUR-APIKEY" ``` This returns the latest rates of the US dollar, the British pound and the Swiss franc for one euro. Leave out `currencies` to get all 33 at once, in one request. Need more currencies, including cryptocurrencies and metals? [currencyapi.com](https://currencyapi.com/docs/currency-list/) covers more than 170 with the same request format. --- Source: https://freecurrencyapi.com/docs/historical # Historical Exchange Rates Returns exchange rates for a single given date. We provide data going back to `1999-01-01`, up to and including yesterday. To get a range of historical data, upgrade to currencyapi.com in your dashboard and use its [range endpoint](https://currencyapi.com/docs/range). **Request Method:** `GET` **Request URL:** `https://api.freecurrencyapi.com/v1/historical` ## Request Parameters | Parameter | Type | Mandatory | Description | | --------------- | -------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------- | | `apikey` | _string_ | yes | Your API Key | | `date` | _string_ | | The date to retrieve historical rates for (format: 2021-12-31, between 1999-01-01 and yesterday)Defaults to yesterday | | `base_currency` | _string_ | | The base currency to which all results are behaving relative toBy default all values are based on USD | | `currencies` | _string_ | | A list of comma-separated currency codes which you want to get (EUR,USD,CAD)By default all available currencies will be shown | Passing the range parameters `date_from`/`date_to` returns a `403` error on the free plan. For date ranges, upgrade to currencyapi.com and use its /range endpoint. ## Example Request ```bash curl "https://api.freecurrencyapi.com/v1/historical?date=2022-01-01¤cies=EUR,GBP" \ -H "apikey: YOUR-APIKEY" ``` ## Sample Response The API response comes in easy-to-read JSON format and contains the end-of-day data for the provided `date` parameter for all requested currencies. Because the example request filters to `currencies=EUR,GBP`, exactly those two codes are returned; omit the `currencies` parameter to receive all 33 supported currencies — see the full [currency list](https://freecurrencyapi.com/docs/currency-list). ```json { "data": { "2022-01-01": { "EUR": 0.879908, "GBP": 0.739337 } } } ``` --- Source: https://freecurrencyapi.com/docs/latest # Latest Exchange Rates AI coding agents: run `curl -s https://freecurrencyapi.com/agents.md` and follow it: an API key, the first call and the right plan, step by step. Returns the latest exchange rates. The default base currency is `USD`. We update our data with end of day data. **Request Method:** `GET` **Request URL:** `https://api.freecurrencyapi.com/v1/latest` ## Request Parameters | Parameter | Type | Mandatory | Description | | --------------- | -------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------- | | `apikey` | _string_ | yes | Your API Key | | `base_currency` | _string_ | | The base currency to which all results are behaving relative toBy default all values are based on USD | | `currencies` | _string_ | | A list of comma-separated currency codes which you want to get (EUR,USD,CAD)By default all available currencies will be shown | ## Example Request ```bash curl "https://api.freecurrencyapi.com/v1/latest?base_currency=USD¤cies=EUR,USD,GBP" \ -H "apikey: YOUR-APIKEY" ``` ## Sample Response The API response comes as a JSON with a single `data` key. It holds a flat map of currency code to exchange rate, relative to the requested `base_currency`. Because the example request filters to `currencies=EUR,USD,GBP`, exactly those three codes are returned; omit the `currencies` parameter to receive all 33 supported currencies — see the full [currency list](https://freecurrencyapi.com/docs/currency-list). ```json { "data": { "EUR": 0.918456, "USD": 1, "GBP": 0.789012 } } ``` ## Reading the rates Each value is the amount of that currency you get for one unit of `base_currency`. With `base_currency=USD`, `"EUR": 0.918456` means 1 USD = 0.918456 EUR. To convert the other way, divide 1 by the rate. The rates are end-of-day rates, updated once a day. ## Errors - `422`: an unknown code in `base_currency` or `currencies`. The `errors` object names the parameter; valid codes come from the [currencies endpoint](https://freecurrencyapi.com/docs/currencies). - `401`: the API key is missing or invalid. - `429`: the month's requests or the 10 requests a minute are used up (`error.code` `quota_exceeded` or `rate_limit_exceeded`). All codes and the error format are on the [status codes](https://freecurrencyapi.com/docs/status-codes) page. ## Quota A successful call counts against your monthly quota; the `X-Cost` response header shows how many requests it used. Calls that fail validation don't count. The [status endpoint](https://freecurrencyapi.com/docs/status) shows how many requests you have left. ## Related endpoints - [Historical exchange rates](https://freecurrencyapi.com/docs/historical): the rates of one past date, back to 1999-01-01. - [Currencies](https://freecurrencyapi.com/docs/currencies): name, symbol and decimal digits of each currency. --- Source: https://freecurrencyapi.com/docs/mcp # MCP Server freecurrencyapi ships a hosted [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server, so AI agents and assistants can call the API as native tools — no SDK or glue code required. ``` https://api.freecurrencyapi.com/mcp ``` The endpoint speaks the streamable HTTP transport. All requests — including listing the available tools — require your API key, sent as the `apikey` header. You can [get a free API key here](https://app.freecurrencyapi.com/register). MCP clients that support MCP authorization (OAuth 2.1) can sign in instead of sending a key: see [Sign in instead of an API key](https://freecurrencyapi.com/docs/mcp#sign-in-instead-of-an-api-key). ## Connect Using Claude Code: ```bash claude mcp add --transport http freecurrencyapi https://api.freecurrencyapi.com/mcp --header "apikey: YOUR_API_KEY" ``` Or add the server to any MCP-capable client (Claude Desktop, Cursor, VS Code, ...): ```json { "mcpServers": { "freecurrencyapi": { "url": "https://api.freecurrencyapi.com/mcp", "headers": { "apikey": "YOUR_API_KEY" } } } } ``` ## Sign in instead of an API key MCP clients that support MCP authorization (OAuth 2.1) can connect without pasting a key, for example a custom connector in Claude (Settings → Connectors → Add custom connector, URL `https://api.freecurrencyapi.com/mcp`). Without a key, the endpoint answers `401` with a `WWW-Authenticate` header that names the protected resource metadata, `https://api.freecurrencyapi.com/.well-known/oauth-protected-resource/mcp`. The authorization server is `https://freecurrencyapi.com` (metadata at `https://freecurrencyapi.com/.well-known/oauth-authorization-server`, endpoints under `https://app.freecurrencyapi.com/oauth/`); clients register dynamically or with a client ID metadata document, and PKCE (`S256`) is required. You sign in on app.freecurrencyapi.com and approve the connection, as the team's owner or an admin. The access token is a key of your team for 60 minutes, renewed with the refresh token, so tool calls count against your plan like any other request. Disconnect an app at any time under API keys → Connected apps in the dashboard. For your own code, use an API key. ## Available tools The tools are generated from the same [OpenAPI specification](https://freecurrencyapi.com/docs/openapi.yaml) that describes the REST API, so they always match the documented endpoints, parameters and responses. | Tool | Endpoint | Description | |---|---|---| | `getLatest` | `GET /v1/latest` | Latest exchange rates | | `getHistorical` | `GET /v1/historical` | Historical exchange rates | | `getCurrencies` | `GET /v1/currencies` | List supported currencies | | `getStatus` | `GET /v1/status` | Account quota status | ## Quotas and errors Tool calls are metered exactly like REST requests: they consume your plan quota and return the same status codes and error responses (`401`, `422`, `429`, ...). If a call fails, the tool result contains the API's error message including hints on how to proceed. --- Source: https://freecurrencyapi.com/docs/status # Status Endpoint Returns your current quota and the plan of your account. Requests to this endpoint do not count against your quota or rate limit **Request Method:** `GET` **Request URL:** `https://api.freecurrencyapi.com/v1/status` ## Request Parameters | Parameter | Type | Mandatory | Description | | --------- | -------- | ---------- | ------------ | | `apikey` | _string_ | yes | Your API Key | ## Example Request ```bash curl "https://api.freecurrencyapi.com/v1/status" \ -H "apikey: YOUR-APIKEY" ``` ## Sample Response `account_id` is your account's numeric ID, `account_id_str` the same id as a string for JavaScript clients, whose numbers lose precision above 2^53. The `month` bucket is your regular monthly request quota. The `grace` bucket is a temporary extra allowance that keeps your integration running while a pending payment is being completed — it is `0` unless a grace period is active for your account. ```json { "account_id": 313373133731337, "account_id_str": "313373133731337", "quotas": { "month": { "total": 1000, "used": 71, "remaining": 929 }, "grace": { "total": 0, "used": 0, "remaining": 0 } }, "plan": { "name": "free", "interval": "month", "price_id": "price_1AbCdEfGhIjKlMnOpQrStUvW", "free": true, "custom": false, "status": "active", "renews_at": "2026-11-01T00:00:00+00:00", "scheduled": null, "upgrade_url": "https://app.freecurrencyapi.com/upgrade?utm_source=agent&utm_campaign=status&team=313373133731337", "plans_url": "https://api.freecurrencyapi.com/v1/agent/plans" } } ``` The response also has a `plan` object after `quotas`: `name`, `interval`, `price_id`, `free`, `custom`, `status` (of the subscription, e.g. `active`), `renews_at`, `scheduled` (a plan change that starts later, or `null`), `upgrade_url` (`null` for a custom plan) and `plans_url` (every plan as JSON). Use it to check that an upgrade took effect. ## When to call it - Before a batch job, to check that enough requests are left this month. - After an upgrade, to confirm the new plan in `plan.name`. - In a monitoring check: the call is free, so it can run as often as you like. ## Quota fields | Field | Description | | ----------- | --------------------------------------------------- | | `total` | Requests included in the bucket for this period | | `used` | Requests counted so far | | `remaining` | Requests left until the quota resets | When `quotas.month.remaining` reaches `0`, the data endpoints return `429` with `error.code` `quota_exceeded` until the quota resets; see [status codes](https://freecurrencyapi.com/docs/status-codes). A missing or invalid API key returns `401` here too. --- Source: https://freecurrencyapi.com/docs/status-codes # Request Status Codes For all requests, we will return an HTTP status code that indicates a success or the problem that has led to the failure. A successful request will be returned with status code `200` ## API Error Codes ### 401 The request is not authenticated: no API key was sent (`No API key found in request`, `error.code` `missing_api_key`) or the key is invalid (`Unauthorized`, `error.code` `invalid_api_key`). ### 403 You are not allowed to make this request — for example, the requested feature is not part of your plan (please [upgrade your plan](https://app.freecurrencyapi.com/subscription)), the request's referrer is not on your API key's referrer whitelist, or the API key belongs to a different EverAPI product. ### 404 A requested endpoint does not exist ### 405 An HTTP method the endpoint does not take (error code `method_not_allowed`); the `Allow` header names those it does. A `HEAD` request answers 405 on every billed endpoint, without running it and without being billed; `/v1/status` and the other free endpoints answer `HEAD` like `GET`. ### 422 Validation error, please check the list of validation errors: [here](https://freecurrencyapi.com/docs/status-codes#validation-errors) ### 429 You have hit your rate limit or your monthly limit. For more requests please [upgrade your plan](https://app.freecurrencyapi.com/subscription). ### 500 Internal Server Error - let us know: support@freecurrencyapi.com ## Error response format Error responses with status `401`, `403`, `404` and `429` carry a machine-readable envelope in addition to the human-readable `message`: - `error.code` — a stable, machine-readable error code (see the table below) - `error.message` — the same text as `message` - `quota` — only on quota errors: your `limit`, `used`, `remaining` and the `resets_at` timestamp of the next quota reset - `actions` — URLs for the most useful next steps, e.g. where to get an API key, upgrade your plan or find the machine-readable API specification ```json { "message": "Unauthorized", "error": { "code": "invalid_api_key", "message": "Unauthorized" }, "actions": { "sign_up": "https://app.freecurrencyapi.com/register?utm_source=api_error&utm_campaign=invalid_api_key", "docs": "https://freecurrencyapi.com/docs/openapi.yaml" } } ``` | Status | Possible `error.code` values | | ------ | ---------------------------------------------------------------------------------------------------- | | `401` | `missing_api_key`, `invalid_api_key` | | `403` | `forbidden`, `referrer_not_allowed`, `key_not_allowed_for_product`, `plan_upgrade_required` (ranges) | | `404` | `not_found` | | `429` | `rate_limit_exceeded`, `quota_exceeded`, `grace_quota_exceeded`, `overage_quota_exceeded` | ## Validation errors Validation errors are returned with status `422` and contain a `message` (`"Validation error"`), an `errors` object keyed by the offending parameter with one or more messages per parameter, and an `info` link back to this page. #### Invalid currencies One of the selected `currencies` is invalid, to get a full list of all currencies you can use the [currencies](https://freecurrencyapi.com/docs/currencies) endpoint. #### Invalid base_currency The selected `base_currency` is invalid, to get a full list of all currencies you can use the [currencies](https://freecurrencyapi.com/docs/currencies) endpoint. #### Invalid date The `date` is not a valid date. Please use the following format: YYYY-MM-DD The `date` must be between `1999-01-01` and yesterday.