# fxapi documentation > fxapi provides current and historical foreign exchange rates for fiat, metal and crypto currencies 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.fxapi.com OpenAPI specification: https://fxapi.com/docs/openapi.yaml ## Get an API key - AI coding agents: run curl -s https://fxapi.com/agents.md and follow it (key, first call, plans). 1. Sign up free at https://app.fxapi.com/register (300 free requests a month). 2. Send the key in the `apikey` header (or `?apikey=`). 3. Store it as FXAPI_KEY. `curl -H "apikey: $FXAPI_KEY" "https://api.fxapi.com/v1/latest?currencies=EUR,GBP"` MCP: https://api.fxapi.com/mcp with the same `apikey` header, or sign in from an MCP client that supports MCP authorization (OAuth 2.1): https://api.fxapi.com/.well-known/oauth-protected-resource/mcp names the authorization server. --- Source: https://fxapi.com/docs/ # Authentication & API key Information AI coding agents: run `curl -s https://fxapi.com/agents.md` and follow it: an API key, the first call and the right plan, step by step. Building with an AI assistant? The full API is available as a machine-readable [OpenAPI 3.1 specification](https://fxapi.com/docs/openapi.yaml), and the documentation is published as [llms.txt](https://fxapi.com/docs/llms.txt) / [llms-full.txt](https://fxapi.com/docs/llms-full.txt). There is also a hosted [MCP server](https://fxapi.com/docs/mcp) at `https://api.fxapi.com/mcp` that AI agents can connect to directly. Using an AI coding agent? Paste `Run curl -s https://fxapi.com/agents.md and follow it to set up fxapi for me in this project.` into it, or see [Onboard your agent](https://fxapi.com/agents/). fxapi uses API keys to allow access to the API. You can register a new API key at our [developer portal](https://app.fxapi.com/register). The Free and Basic plans include one API key; the Professional and Enterprise plans include 2 and 5. More keys on request. 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](https://app.fxapi.com/register) for a free account and copy your API key from the dashboard. 2. Request the latest exchange rates: ```bash curl "https://api.fxapi.com/v1/latest?apikey=YOUR-APIKEY¤cies=EUR,CAD" ``` 3. You will receive a JSON response like this: ```json { "meta": { "last_updated_at": "2022-01-01T23:59:59Z", "base_currency": "USD" }, "data": { "CAD": { "code": "CAD", "value": 1.26545 }, "EUR": { "code": "EUR", "value": 0.87945 } } } ``` From here you can explore the other endpoints: [latest](https://fxapi.com/docs/latest), [historical](https://fxapi.com/docs/historical), [range](https://fxapi.com/docs/range), [ohlc](https://fxapi.com/docs/ohlc), [convert](https://fxapi.com/docs/convert), [rate](https://fxapi.com/docs/rate), [matrix](https://fxapi.com/docs/matrix), [fluctuation](https://fxapi.com/docs/fluctuation), [average](https://fxapi.com/docs/average), [currencies](https://fxapi.com/docs/currencies) and [status](https://fxapi.com/docs/status). ## Official Libraries | Language | Code | Repository | |-----------------------|----------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------| | C# | — | [https://www.nuget.org/packages/fxapi](https://www.nuget.org/packages/fxapi) | | Python | [https://github.com/everapihq/fxapi-python](https://github.com/everapihq/fxapi-python) | [https://pypi.org/project/fxapicom/](https://pypi.org/project/fxapicom/) | | Ruby | [https://github.com/everapihq/fxapi-ruby](https://github.com/everapihq/fxapi-ruby) | [https://rubygems.org/gems/fxapi](https://rubygems.org/gems/fxapi) | | Rust | [https://github.com/everapihq/fxapi-rs](https://github.com/everapihq/fxapi-rs) | [https://crates.io/crates/fxapi-rs](https://crates.io/crates/fxapi-rs) | | PHP | [https://github.com/everapihq/fxapi-php](https://github.com/everapihq/fxapi-php) | [https://packagist.org/packages/everapi/fxapi-php](https://packagist.org/packages/everapi/fxapi-php) | | JavaScript ES6 module | [https://github.com/everapihq/fxapi-js](https://github.com/everapihq/fxapi-js) | [https://www.npmjs.com/package/@everapi/fxapi-js](https://www.npmjs.com/package/@everapi/fxapi-js) | ## 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.fxapi.com/v1/latest?apikey=YOUR-APIKEY" ``` ```javascript var oReq = new XMLHttpRequest(); oReq.addEventListener("load", function () { console.log(this.responseText); }); oReq.open("GET", "https://api.fxapi.com/v1/latest?apikey=YOUR-APIKEY"); oReq.send(); ``` ```php $url = "https://api.fxapi.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.fxapi.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.fxapi.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.fxapi.com/v1/latest"); oReq.setRequestHeader("apikey", "YOUR-APIKEY"); oReq.send(); ``` ```php $url = "https://api.fxapi.com/v1/latest"; $curl = curl_init($url); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $headers = array( "apikey: YOUR-APIKEY", ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); $resp = curl_exec($curl); var_dump($resp); ```` ```python import requests from requests.structures import CaseInsensitiveDict url = "https://api.fxapi.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. 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 a paid plan you can avoid the `429` with optional overage: turn it on with a monthly spending cap on the Billing page of the dashboard. Requests past the quota are then billed at your plan's overage price ([pricing](https://fxapi.com/pricing/)) until the cap is reached. Overage is off until you turn it on, and the free plan has none. 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. 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. 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. ```HTTP 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](https://fxapi.com/docs/testing)) | | `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. 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. --- Source: https://fxapi.com/docs/average # Average Exchange Rates Returns the average, lowest and highest daily rate of every requested currency per month, quarter or year. Accounting standards such as IFRS (IAS 21) and US GAAP (ASC 830) allow translating income and expenses at the average rate of a period, and this endpoint returns exactly that figure. **Request Method:** `GET` **Request URL:** `https://api.fxapi.com/v1/average` ## Request Parameters | Parameter | Type | Mandatory | Description | | --------------- | -------- | ---------- | ----------- | | `apikey` | _string_ | yes | Your API Key | | `date_from` | _string_ | yes | First day, format `YYYY-MM-DD`, 1999-01-01 or later | | `date_to` | _string_ | yes | Last day, format `YYYY-MM-DD`, yesterday at the latest, at most 1830 days after `date_from` | | `period` | _string_ | | `month` (default), `quarter`, `year`, or `total` for one average over the whole span | | `base_currency` | _string_ | | The base currency all rates are expressed inDefault: `USD` | | `currencies` | _string_ | | A list of comma-separated currency codes (EUR,GBP,JPY)By default all currencies are returned | | `type` | _string_ | | Filter by type: `fiat`, `metal`, `crypto` | | `format` | _string_ | | `json` (default), `csv` (`period,date_from,date_to,days,source,base_currency,currency,average,min,max`) or `xlsx``xlsx` gives the same table as an Excel workbook, see [Excel downloads](https://fxapi.com/docs/range#excel-downloads) | Every daily rate is first expressed against `base_currency` and only then averaged, so the average EUR rate in GBP is the mean of the daily EUR/GBP rates. The first and last period are cut to your span; each period's `date_from`, `date_to` and `days` tell you exactly which days went into it. A request costs one request of your quota. ## Sample Request ```bash curl -G https://api.fxapi.com/v1/average \ -d date_from=2026-01-01 \ -d date_to=2026-02-28 \ -d period=month \ -d base_currency=EUR \ -d currencies=USD,GBP \ -H "apikey: YOUR-API-KEY" ``` ## Sample Response ```json { "meta": { "source": "market", "base_currency": "EUR", "period": "month", "date_from": "2026-01-01", "date_to": "2026-02-28" }, "data": [ { "period": "2026-01", "date_from": "2026-01-01", "date_to": "2026-01-31", "days": 31, "currencies": { "GBP": {"code": "GBP", "value": 0.8312, "min": 0.8254, "max": 0.8377}, "USD": {"code": "USD", "value": 1.0405, "min": 1.0298, "max": 1.0521} } }, { "period": "2026-02", "date_from": "2026-02-01", "date_to": "2026-02-28", "days": 28, "currencies": { "GBP": {"code": "GBP", "value": 0.8287, "min": 0.8231, "max": 0.834}, "USD": {"code": "USD", "value": 1.0461, "min": 1.0372, "max": 1.0553} } } ] } ``` --- Source: https://fxapi.com/docs/convert # Convert Exchange Rates Returns calculated values for today or any given date for all currencies. The convert endpoint is not part of every plan. If your plan does not include it, requests fail with a `403` status code: ```json { "message": "You are not allowed to use the convert endpoint, please upgrade your plan", "info": "For more information, see documentation: https://fxapi.com/docs/status-codes#_403" } ``` To use this endpoint please [upgrade your plan](https://app.fxapi.com/subscription). The `datetime` parameter needs a plan with intraday updates; on a plan with daily updates, requests with `datetime` fail with a `403` status code: "You are not allowed to use the datetime parameter, please upgrade your plan". **Request Method:** `GET` **Request URL:** `https://api.fxapi.com/v1/convert` ## Request Parameters | Parameter | Type | Mandatory | Description | | --------------- | -------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------- | | `apikey` | _string_ | yes | Your API Key | | `value` | _number_ | yes | The value you want to convertMust be greater than 0 and at most 10^18Or send `values` instead, see [several amounts](https://fxapi.com/docs/convert#several-amounts-in-one-request) | | `values` | _string_ | | Instead of `value`: up to 100 comma-separated values (9.99,24.50,100), each greater than 0 and at most 10^18Not together with `value`, see [several amounts](https://fxapi.com/docs/convert#several-amounts-in-one-request) | | `date` | _string_ | | Date to retrieve historical rates from (format: 2021-12-31)Must be at least one day in the past and not before 1999-01-01Omit for the latest rates | | `datetime` | _string_ | | Convert at this moment (ISO8601 Datetime, e.g. `2026-09-30T10:07:30Z`), see [conversions at a moment](https://fxapi.com/docs/convert#conversions-at-a-moment-of-the-day)Needs a plan with intraday updates; not together with `date` | | `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)The array form `currencies[]=EUR¤cies[]=USD` is also acceptedBy default all available currencies will be shown | | `type` | _string_ | | Filter the returned currencies by typePossible Values: `fiat`, `metal`, `crypto`By default currencies of all types are returned | | `round_step` | _number_ | | Adds `rounded`: every converted value rounded to a multiple of this step (e.g. `0.05`, `1`, `10`)Not together with `price_ending`, see [shop prices](https://fxapi.com/docs/convert#shop-prices-rounding-and-formatting) | | `price_ending` | _number_ | | Adds `rounded`: every converted value rounded to a price with this ending (`0` up to below `1`, e.g. `0.99`), see [shop prices](https://fxapi.com/docs/convert#shop-prices-rounding-and-formatting) | | `round_mode` | _string_ | | How `round_step` and `price_ending` round: `nearest` (default), `up` or `down` | | `locale` | _string_ | | Adds `formatted`: every converted value as text in this locale (e.g. `de_AT`, `en-US`), see [shop prices](https://fxapi.com/docs/convert#shop-prices-rounding-and-formatting) | | `shape` | _string_ | | `default` or `compact`With `compact` every converted value is a plain number (`"EUR": 11.021472`) instead of a `code`/`value` objectNot together with `round_step`, `price_ending` or `locale` | | `precision` | _integer_ | | Round every converted value to this many decimals (`0` to `10`), e.g. `2` for amounts of money | | `format` | _string_ | | `json` (default), `csv` or `xlsx`. The CSV has one row per currency: `datetime,base_currency,currency,value`With `values` an `amount` column follows `base_currency`; rounding and `locale` add the columns `rounded` and `formatted``xlsx` gives the same table as an Excel workbook, see [Excel downloads](https://fxapi.com/docs/range#excel-downloads) | ## Sample Response The API response comes in easy-to-read JSON format and contains the converted values for all requested currencies. `meta` holds `last_updated_at`, the `base_currency`, the `value` you sent and, when you sent one, the `date`. ```json { "meta": { "last_updated_at": "2022-01-01T23:59:59Z", "base_currency": "USD", "value": 1 }, "data": { "AED": { "code": "AED", "value": 3.67306 }, "AFN": { "code": "AFN", "value": 91.80254 }, "ALL": { "code": "ALL", "value": 108.22904 }, "AMD": { "code": "AMD", "value": 480.41659 }, "...": "150+ more currencies" } } ``` With `shape=compact` and `precision=2` you get plain amounts, rounded to cents: ```bash curl -G https://api.fxapi.com/v1/convert \ -d value=12 \ -d currencies=EUR,GBP \ -d shape=compact \ -d precision=2 \ -H "apikey: YOUR-API-KEY" ``` ```json { "meta": { "last_updated_at": "2023-06-23T10:15:59Z", "base_currency": "USD", "value": 12 }, "data": { "EUR": 11.02, "GBP": 9.43 } } ``` ## Several amounts in one request Send `values` instead of `value` to convert up to 100 amounts at once, for example every price of a product list. `data` is then a list with one entry per amount, in the order you sent them: the `value` and its converted `currencies`. `meta.values` replaces `meta.value`. The request costs one request of your quota, however many amounts it holds; `values[]=9.99&values[]=24.50` is accepted as well. ```bash curl -G https://api.fxapi.com/v1/convert \ -d values=10,2.5 \ -d currencies=EUR \ -d shape=compact \ -H "apikey: YOUR-API-KEY" ``` ```json { "meta": { "last_updated_at": "2026-09-29T23:59:59Z", "base_currency": "USD", "values": [10, 2.5] }, "data": [ { "value": 10, "currencies": { "EUR": 9 } }, { "value": 2.5, "currencies": { "EUR": 2.25 } } ] } ``` With `format=csv` every row carries its amount after `base_currency`: ```text datetime,base_currency,amount,currency,value 2026-09-29T23:59:59Z,USD,10,EUR,9 2026-09-29T23:59:59Z,USD,2.5,EUR,2.25 ``` ## Conversions at a moment of the day With `datetime` the value is converted at the rate of the minute, quarter hour or hour the moment falls in, exactly as the [rate](https://fxapi.com/docs/rate#rates-at-a-moment-of-the-day) endpoint finds it: minutes and quarter hours for the last 7 days, hours for the last 3 months, at the finest interval your plan updates at. `meta.last_updated_at` tells you which point was used. Moments further back return a `422`; use `date` for those days instead. ```bash curl -G https://api.fxapi.com/v1/convert \ -d value=100 \ -d currencies=EUR \ -d datetime=2026-09-30T10:07:30Z \ -H "apikey: YOUR-API-KEY" ``` On a plan with minute updates: ```json { "meta": { "last_updated_at": "2026-09-30T10:07:59Z", "base_currency": "USD", "value": 100 }, "data": { "EUR": { "code": "EUR", "value": 95 } } } ``` ## Shop prices: rounding and formatting Converted prices rarely look like prices. Two options turn them into amounts you can show in a shop, while `value` always stays the exact conversion: - `round_step` adds `rounded`, the value rounded to a multiple of the step: `0.05` for 5-cent steps, `1` for whole amounts, `10` for tens. Must be greater than 0 and at most 10^18. - `price_ending` adds `rounded`, the value rounded to a price with this ending: `0.99` turns 10.97 into 10.99, `0.95` gives 4.95, 9.95, ... Must be at least 0 and below 1. Not together with `round_step`. - `round_mode`: `nearest` (default) picks the closest candidate, `up` never goes below the exact value, `down` never above it. - `locale` adds `formatted`, the amount as text in an ICU locale such as `de_AT`, `en-US` or `fr_CH`, with the currency's symbol and its own decimal places (at most 8). With rounding, the rounded price is formatted; a whole-number `round_step` shows no decimals. An unknown locale returns a `422`. Rounding and `locale` work with the default shape and with CSV, which then gets the columns `rounded` and `formatted` (in that order), but not with `shape=compact` (`422`). The text in `formatted` uses the spaces the locale prescribes, e.g. a non-breaking space between symbol and amount for `de_AT`. ```bash curl -G https://api.fxapi.com/v1/convert \ -d value=1371.11 \ -d currencies=EUR \ -d price_ending=0.99 \ -d locale=de_AT \ -H "apikey: YOUR-API-KEY" ``` ```json { "meta": { "last_updated_at": "2026-09-29T23:59:59Z", "base_currency": "USD", "value": 1371.11 }, "data": { "EUR": { "code": "EUR", "value": 1233.999, "rounded": 1233.99, "formatted": "€ 1.233,99" } } } ``` The same with `locale=en-US` and `format=csv`: ```text datetime,base_currency,currency,value,rounded,formatted 2026-09-29T23:59:59Z,USD,EUR,1233.999,1233.99,"€1,233.99" ``` --- Source: https://fxapi.com/docs/currencies # Currencies Endpoint Returns all our supported currencies Besides fiat currencies we also support precious metals (e.g. `XAU`, `XAG`, `XPT`, `XPD`) and popular crypto currencies (e.g. `BTC`, `ETH`). Every currency has a `type` of `fiat`, `metal` or `crypto`, and the latest, historical, range, convert, fluctuation and average endpoints accept a `type` parameter to filter the results accordingly. **Request Method:** `GET` **Request URL:** `https://api.fxapi.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)The array form `currencies[]=EUR¤cies[]=USD` is also acceptedBy default all available currencies will be shown | | `type` | _string_ | | Filter the returned currencies by typePossible Values: `fiat`, `metal`, `crypto`By default currencies of all types are returned | | `as_html` | _boolean_ | | `1` returns an HTML table of currency codes and names instead of a JSON payloadDefault: `0` | ## Sample Response Each currency entry contains its `type` (`fiat`, `metal` or `crypto`) and the ISO 3166-1 alpha-2 codes of the `countries` using it. ```json { "data": { "AED": { "symbol": "AED", "name": "United Arab Emirates Dirham", "symbol_native": "د.إ", "decimal_digits": 2, "rounding": 0, "code": "AED", "name_plural": "UAE dirhams", "type": "fiat", "countries": ["AE"] }, "BTC": { "symbol": "₿", "name": "Bitcoin", "symbol_native": "₿", "decimal_digits": 8, "rounding": 0, "code": "BTC", "name_plural": "Bitcoins", "type": "crypto", "countries": [] }, "...": {} } } ``` --- Source: https://fxapi.com/docs/currency-list # Currency List CodeNameAEDUAE DirhamAFNAfghan AfghaniALLAlbanian LekAMDArmenian DramANGNetherlands Antillean GuilderAOAAngolan KwanzaARSArgentine PesoAUDAustralian DollarAWGAruban FlorinAZNAzerbaijani ManatBAMBosnia and Herzegovina Convertible MarkBBDBarbados DollarBDTBangladeshi TakaBGNBulgarian LevBHDBahraini DinarBIFBurundian FrancBMDBermudian DollarBNDBrunei DollarBOBBolivian BolivianoBRLBrazilian RealBSDBahamian DollarBTNBhutanese NgultrumBWPBotswana PulaBYNBelarusian RubleBYRBelarusian RubleBZDBelize DollarCADCanadian DollarCDFCongolese FrancCHFSwiss FrancCLFUnidad de FomentoCLPChilean PesoCNYChinese YuanCOPColombian PesoCRCCosta Rican ColónCUCCuban Convertible PesoCUPCuban PesoCVECabo Verde EscudoCZKCzech KorunaDJFDjiboutian FrancDKKDanish KroneDOPDominican PesoDZDAlgerian DinarEGPEgyptian PoundERNEritrean NakfaETBEthiopian BirrEUREuroFJDFijian DollarFKPFalkland Islands PoundGBPPound SterlingGELGeorgian LariGGPGuernsey PoundGHSGhanaian CediGIPGibraltar PoundGMDGambian DalasiGNFGuinean FrancGTQGuatemalan QuetzalGYDGuyana DollarHKDHong Kong DollarHNLHonduran LempiraHRKCroatian KunaHTGHaitian GourdeHUFHungarian ForintIDRIndonesian RupiahILSNew Israeli SheqelIMPManx PoundINRIndian RupeeIQDIraqi DinarIRRIranian RialISKIcelandic KrónaJEPJersey PoundJMDJamaican DollarJODJordanian DinarJPYJapanese YenKESKenyan ShillingKGSKyrgyzstani SomKHRCambodian RielKMFComorian FrancKPWNorth Korean WonKRWSouth Korean WonKWDKuwaiti DinarKYDCayman Islands DollarKZTKazakhstani TengeLAKLao KipLBPLebanese PoundLKRSri Lankan RupeeLRDLiberian DollarLSLLesotho LotiLTLLithuanian LitasLVLLatvian LatsLYDLibyan DinarMADMoroccan DirhamMDLMoldovan LeuMGAMalagasy AriaryMKDMacedonian DenarMMKMyanmar KyatMNTMongolian TugrikMOPMacanese PatacaMROMauritanian Ouguiya (until 2017)MURMauritian RupeeMVRMaldivian RufiyaaMWKMalawian KwachaMXNMexican PesoMYRMalaysian RinggitMZNMozambican MeticalNADNamibian DollarNGNNigerian NairaNIONicaraguan CórdobaNOKNorwegian KroneNPRNepalese RupeeNZDNew Zealand DollarOMROmani RialPABPanamanian BalboaPENPeruvian SolPGKPapua New Guinean KinaPHPPhilippine PesoPKRPakistani RupeePLNPolish ZlotyPYGParaguayan GuaraniQARQatari RialRONRomanian LeuRSDSerbian DinarRUBRussian RubleRWFRwandan FrancSARSaudi RiyalSBDSolomon Islands DollarSCRSeychellois RupeeSDGSudanese PoundSEKSwedish KronaSGDSingapore DollarSHPSaint Helena PoundSLLSierra Leonean Leone (until 2024)SOSSomali ShillingSRDSurinamese DollarSTDSão Tomé and Príncipe Dobra (until 2017)SVCSalvadoran ColónSYPSyrian PoundSZLSwazi LilangeniTHBThai BahtTJSTajikistani SomoniTMTTurkmenistan New ManatTNDTunisian DinarTOPTongan PaʻangaTRYTurkish LiraTTDTrinidad and Tobago DollarTWDNew Taiwan DollarTZSTanzanian ShillingUAHUkrainian HryvniaUGXUgandan ShillingUSDUS DollarUYUUruguayan PesoUZSUzbekistan SumVEFVenezuelan Bolívar FuerteVNDVietnamese DongVUVVanuatu VatuWSTSamoan TalaXAFCFA Franc BEACXAGSilver OunceXAUGold OunceXCDEast Caribbean DollarXDRSpecial Drawing RightsXOFCFA Franc BCEAOXPFCFP FrancYERYemeni RialZARSouth African RandZMKZambian Kwacha (until 2012)ZMWZambian KwachaZWLZimbabwean dollarXPTPlatinum OunceXPDPalladium OunceBTCBitcoinETHEthereumBNBBinanceXRPRippleSOLSolanaDOTPolkadotAVAXAvalancheMATICMatic TokenLTCLitecoinADACardanoUSDTTetherUSDCUSD CoinDAIDaiARBArbitrumOPOptimismTRXTronVESVenezuelan Bolívar SoberanoSTNSão Tomé and Príncipe DobraMRUMauritanian OuguiyaZWGZimbabwe GoldSLESierra Leonean LeoneXCGCaribbean Guilder --- Source: https://fxapi.com/docs/examples/ # Examples We always strive to provide the best developer experience possible. To do so, we are continuously creating and improving tutorials which serve as a sample implementation of our API. If you have suggestions or requests for further implementation examples, [please let us know]! [please let us know]: mailto:support@fxapi.com --- Source: https://fxapi.com/docs/examples/currency-converter-javascript # Building a Currency Converter in JavaScript ## Introduction In this article, we build a currency converter in JavaScript, with the help of our [JavaScript package], which handles the requests to the API itself. Furthermore, we will use [vite] as build tool and [tailwind] for easy styling. ![Currency Converter](https://app.fxapi.com/img/docs/currency-converter.png) :arrow_up: Preview of the final outcome of this tutorial ## Prerequisites - An API Key for [fxapi.com] ## Scaffold your vite project Navigate to your workspace on your machine where you want to create your currency converter project and initialize a new vite project: ``` npm create vite@latest ``` ``` yarn create vite ``` Then follow the prompts in your console. Make sure to select `vanilla` for your project setup! Afterward, switch to the newly created project folder. ## Install the fxapi package As mentioned above, we will use our [JavaScript package]: ``` npm install --save @everapi/fxapi-js ``` ``` yarn add @everapi/fxapi-js ``` ## Install & configure tailwind.css (optional) We want to use Tailwind CSS v3, so add it to your project together with `postcss` and `autoprefixer` for a clean and stable build process: ``` npm install -D tailwindcss@3 postcss autoprefixer ``` ``` yarn add -D tailwindcss@3 postcss autoprefixer ``` Afterward, initialize tailwind, which will create a `tailwind.config.js` in your project's root directory: ``` npx tailwindcss init ``` Open the newly created `tailwind.config.js` and modify the content attribute to match the vite setup. Vite projects are ES modules (`"type": "module"` in `package.json`), so the config files use `export default`: ```js{2} export default { content: ["./index.html", "./*.js", "./src/**/*.js"], theme: { extend: {}, }, plugins: [], } ``` Also, add the Tailwind directives to the `style.css` that `main.js` imports: ```CSS @tailwind base; @tailwind components; @tailwind utilities; ``` As a last step, we need to tell `postcss` to include both tailwind and `autoprefixer`. Otherwise, the tailwind classes won't end up in our final css. To do so, create a file named `postcss.config.js` in your project root directory next to your tailwind config and add the following lines: ```js{3,4} export default { plugins: { tailwindcss: {}, autoprefixer: {}, }, } ``` ## Start vite in dev mode Now that our preparations are done, we can start up vite: ``` npm run dev ``` ``` yarn dev ``` Vite will print the local dev server URL in your console. Open `http://localhost:5173/` in your browser. You should now see the default Vite start page. ## Prepare your HTML The next step is to adapt the default landing page. Open the `index.html` and build a form for currency conversion. We will need: - A wrapper `` for our inputs - An `` for the base currency - An `` for the target currencies - A submit `` - A container `` where we display our dynamic currency data ```html
``` Keep the `src` of the `` tag as Vite generated it (`/main.js` or `/src/main.js`, depending on the Vite version). Note that all CSS classes are tailwind specific, so if you want to use another CSS framework or style it yourself, feel free to remove them completely. We will use the `id` attributes in our JavaScript. ## Handle form submission in JavaScript Now that our HTML structure is prepared, we can add the JavaScript functionality to call the fxapi. To do so, we need to open the `main.js`. As this file is not empty, feel free to remove any code but keep the style import in the first line. ```js import fxapi from '@everapi/fxapi-js'; ``` Now that we imported the Class, we also need to initialize a new instance using your API Key. Note that we cannot name the instance `fxapi` as this identifier is already taken by the import: ```js const client = new fxapi('YOUR_API_KEY_GOES_HERE'); ``` Next, we store our HTML elements to constants so we can access them easily at a later point: ```js const latestRatesForm = document.getElementById('latest_rates_form'); const baseCurrencyInput = document.getElementById('base_currency_input'); const currenciesInput = document.getElementById('currencies'); const latestRatesDisplay = document.getElementById('latest_rates_display'); ``` All that is left to do is to append a listener for the form submission, which will make a request to the API using the `latest` endpoint: ```js latestRatesForm.addEventListener('submit', (e) => { e.preventDefault(); client.latest({ base_currency: baseCurrencyInput.value.trim(), currencies: currenciesInput.value.replaceAll(' ', '') }).then(response => { let currencies = Object.keys(response.data); let resultHTML = ''; for (let currency of currencies) { resultHTML += `
${currency}: ${response.data[currency].value}
`; } latestRatesDisplay.innerHTML = resultHTML; }); }); ``` That's it! You have successfully built a currency converter in JavaScript. When you now press the submit button, a request to the `latest` endpoint will be triggered. If you have specified any target currencies, only those will be rendered. Otherwise, all supported currencies will be displayed. [vite]: https://vitejs.dev/guide/ [tailwind]: https://tailwindcss.com/ [fxapi.com]: https://fxapi.com [JavaScript package]: https://www.npmjs.com/package/@everapi/fxapi-js --- Source: https://fxapi.com/docs/examples/currency-converter-vuejs # Building a Currency Converter in Vue.js ## Introduction In this article, we build a currency converter in [Vue.js], with the help of our [JavaScript package] which handles the requests to the API itself. Furthermore, we will use [vite] as build tool and [tailwind] for easy styling. ![Currency Converter](https://app.fxapi.com/img/docs/currency-converter-vuejs.png) :arrow_up: Preview of the final outcome of this tutorial ## Prerequisites - An API Key for [fxapi.com] ## Scaffold your vite project Navigate to your workspace on your machine where you want to create your currency converter project and initialize a new vite project: ``` npm create vite@latest ``` ``` yarn create vite ``` Then follow the prompts in your console. Make sure to select `vue` for your project setup! Afterward, switch to the newly created project folder. ## Install the fxapi package As mentioned above, we will use our [JavaScript package]: ``` npm install --save @everapi/fxapi-js ``` ``` yarn add @everapi/fxapi-js ``` ## Install & configure tailwind.css (optional) We want to use Tailwind CSS v3, so add it to your project together with `postcss` and `autoprefixer` for a clean and stable build process: ``` npm install -D tailwindcss@3 postcss autoprefixer ``` ``` yarn add -D tailwindcss@3 postcss autoprefixer ``` Afterward, initialize tailwind, which will create a `tailwind.config.js` in your project's root directory: ``` npx tailwindcss init ``` Open the newly created `tailwind.config.js` and modify the content attribute to match the vite setup. Vite projects are ES modules (`"type": "module"` in `package.json`), so the config files use `export default`: ```js{2} export default { content: ["./index.html", "./src/**/*.{html,js,vue}"], theme: { extend: {}, }, plugins: [], } ``` For loading the tailwind styles, create a `css` folder in your `src` directory. In this `css` folder, create a `style.css` file with the following lines: ```CSS @tailwind base; @tailwind components; @tailwind utilities; ``` Now you can include your styles in your `main.js` (ideally under the existing imports): ```js import './css/style.css' ``` As a last step, we need to tell `postcss` to include both tailwind and `autoprefixer`. Otherwise, the tailwind classes won't end up in our final css. To do so, create a file named `postcss.config.js` in your project root directory next to your tailwind config and add the following lines: ```js{3,4} export default { plugins: { tailwindcss: {}, autoprefixer: {}, }, } ``` ## Start vite in dev mode Now that our preparations are done, we can start up vite: ``` npm run dev ``` ``` yarn dev ``` Vite will print the local dev server URL in your console. Open `http://localhost:5173/` in your browser. You should now see the default Vite start page. ## Create a CurrencyConverter Single-File-Component (SFC) Go to `src/components` and create a Vue file named `CurrencyConverter.vue`. We will use the `Options API` of Vue.js. ### Script This component will hold the parameters which will be sent to the API in `params`, the results we get back in `results` and of course an instance of our JavaScript helper class `fxapi` which needs to be initialized with your API Key (replace `YOUR-API-KEY`). The only method we will need for this basic example is a `submit` function, which will handle the API call to the `latest` endpoint via our [JavaScript package]. ```vue ``` ### Template The `` consists of two main parts: - A `` that wraps the inputs and triggers the `submit` - A container where we loop over the received currencies stored in `results` ```vue ``` All CSS classes used here are Tailwind specific and can be freely adapted or removed. ## Using the CurrencyConverter Component To use our freshly created component, go to the `App.vue` and replace the `HelloWorld.vue` import with our `CurrencyConverter.vue` file: ```js import CurrencyConverter from './components/CurrencyConverter.vue'; ``` In the `` block, put our component to good use: ```vue ``` And that's it! You have successfully built a currency converter in Vue.js. [vite]: https://vitejs.dev/guide/ [tailwind]: https://tailwindcss.com/ [fxapi.com]: https://fxapi.com [JavaScript package]: https://www.npmjs.com/package/@everapi/fxapi-js [Vue.js]: https://vuejs.org --- Source: https://fxapi.com/docs/fluctuation # Fluctuation Returns, for every requested currency, its rate at the end of `date_from` and of `date_to` (UTC) and how much it changed in between, in absolute terms and in percent, together with the high, low and average of the daily closes in the span. One request replaces two historical lookups and the arithmetic. **Request Method:** `GET` **Request URL:** `https://api.fxapi.com/v1/fluctuation` ## Request Parameters | Parameter | Type | Mandatory | Description | | --------------- | -------- | ---------- | ----------- | | `apikey` | _string_ | yes | Your API Key | | `date_from` | _string_ | yes | First day, format `YYYY-MM-DD`, 1999-01-01 or later | | `date_to` | _string_ | yes | Last day, format `YYYY-MM-DD`, on or after `date_from` and yesterday at the latest | | `base_currency` | _string_ | | The base currency all rates are expressed inDefault: `USD` | | `currencies` | _string_ | | A list of comma-separated currency codes (EUR,GBP,JPY)By default all currencies are returned | | `type` | _string_ | | Filter by type: `fiat`, `metal`, `crypto` | | `format` | _string_ | | `json` (default), `csv` (`date_from,date_to,base_currency,currency,start_rate,end_rate,change,change_pct`) or `xlsx``xlsx` gives the same table as an Excel workbook, see [Excel downloads](https://fxapi.com/docs/range#excel-downloads) | A request costs one request of your quota. If no rates are stored for one of the two days, the endpoint returns a `404`. ## Sample Request ```bash curl -G https://api.fxapi.com/v1/fluctuation \ -d date_from=2026-01-01 \ -d date_to=2026-06-30 \ -d currencies=EUR,GBP \ -H "apikey: YOUR-API-KEY" ``` ## Sample Response `change` is `end_rate - start_rate`; `change_pct` is the change in percent of `start_rate`, rounded to 4 decimals. `high`, `low` and `average` are the highest, lowest and average daily close from `date_from` to `date_to` (the average as [`/average`](https://fxapi.com/docs/average) computes it for the whole span). They are `null` when the two days are more than 1830 days apart or no rates are stored in the span, and they are part of the JSON response only: the CSV keeps its columns. ```json { "meta": { "base_currency": "USD", "date_from": "2026-01-01", "date_to": "2026-06-30" }, "data": { "EUR": { "code": "EUR", "start_rate": 0.9654, "end_rate": 0.8771, "change": -0.0883, "change_pct": -9.1465, "high": 0.9712, "low": 0.8695, "average": 0.9183 }, "GBP": { "code": "GBP", "start_rate": 0.7988, "end_rate": 0.7302, "change": -0.0686, "change_pct": -8.5879, "high": 0.8051, "low": 0.7244, "average": 0.7653 } } } ``` --- Source: https://fxapi.com/docs/historical # Historical Exchange Rates Returns exchange rates for a specific date. Generally, we provide data going back to 1999. **Request Method:** `GET` **Request URL:** `https://api.fxapi.com/v1/historical` ## Request Parameters | Parameter | Type | Mandatory | Description | | --------------- | -------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------- | | `apikey` | _string_ | yes | Your API Key | | `date` | _string_ | yes | Date to retrieve historical rates from (format: 2021-12-31)Must be at least one day in the past and not before 1999-01-01, otherwise the request fails with a `422` validation errorNot required when you send `dates` | | `dates` | _string_ | | Instead of `date`: up to 31 dates, comma-separated (2022-01-31,2022-02-28) or as `dates[]=2022-01-31&dates[]=2022-02-28`Not together with `date`, see [several dates](https://fxapi.com/docs/historical#several-dates-in-one-request) | | `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)The array form `currencies[]=EUR¤cies[]=USD` is also acceptedBy default all available currencies will be shown | | `type` | _string_ | | Filter the returned currencies by typePossible Values: `fiat`, `metal`, `crypto`By default currencies of all types are returned | | `shape` | _string_ | | `default` or `compact`With `compact` every rate is a plain value (`"EUR": 0.918456`) instead of a `code`/`value` object | | `precision` | _integer_ | | Round every value to this many decimals (`0` to `10`)By default values carry up to 10 decimals (10 significant digits below 0.1) | | `inverse` | _boolean_ | | `true` adds `inverse` to every rate: the value of one unit of the currency in the base currency (1 / `value`)Not together with `shape=compact` | | `format` | _string_ | | `json` (default), `csv` or `xlsx`. The CSV has one row per currency (and date): `datetime,base_currency,currency,value`, plus `inverse` with `inverse=true``xlsx` gives the same table as an Excel workbook, see [Excel downloads](https://fxapi.com/docs/range#excel-downloads) | These options work as on the [latest](https://fxapi.com/docs/latest#compact-values-inverse-rates-and-the-daily-change) endpoint (without `include=change`). ## 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 currencies. `meta` holds `last_updated_at`, the `base_currency` of the values and the requested `date`. ```json { "meta": { "last_updated_at": "2022-01-01T23:59:59Z", "base_currency": "USD", "date": "2022-01-01" }, "data": { "AED": { "code": "AED", "value": 3.67306 }, "AFN": { "code": "AFN", "value": 91.80254 }, "ALL": { "code": "ALL", "value": 108.22904 }, "AMD": { "code": "AMD", "value": 480.41659 }, "...": "150+ more currencies" } } ``` ## Several dates in one request With `dates` instead of `date` you get up to 31 days in one response. `data` is then keyed by date, oldest first, and each date is answered once. `meta` holds the `base_currency` and the `dates` answered. Every date costs one request of your quota, as it would on its own; the `X-Cost` response header tells you how many were counted (here `2`). ```bash curl -G https://api.fxapi.com/v1/historical \ -d dates=2022-01-31,2022-02-28 \ -d currencies=EUR,GBP \ -d shape=compact \ -H "apikey: YOUR-API-KEY" ``` ```json { "meta": { "base_currency": "USD", "dates": ["2022-01-31", "2022-02-28"] }, "data": { "2022-01-31": { "EUR": 0.890103, "GBP": 0.743712 }, "2022-02-28": { "EUR": 0.891437, "GBP": 0.745601 } } } ``` With `format=csv` the dates follow each other in one table: ```text datetime,base_currency,currency,value 2022-01-31T23:59:59Z,USD,EUR,0.890103 2022-01-31T23:59:59Z,USD,GBP,0.743712 2022-02-28T23:59:59Z,USD,EUR,0.891437 2022-02-28T23:59:59Z,USD,GBP,0.745601 ``` --- Source: https://fxapi.com/docs/latest # Latest Exchange Rates AI coding agents: run `curl -s https://fxapi.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`. Depending on your subscription plan you will receive new data in different time intervals. While our dataset in the free plan is updated daily our bigger plans offer up to minute update intervals! **Request Method:** `GET` **Request URL:** `https://api.fxapi.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)The array form `currencies[]=EUR¤cies[]=USD` is also acceptedBy default all available currencies will be shown | | `type` | _string_ | | Filter the returned currencies by typePossible Values: `fiat`, `metal`, `crypto`By default currencies of all types are returned | | `shape` | _string_ | | `default` or `compact`With `compact` every rate is a plain value (`"EUR": 0.918456`) instead of a `code`/`value` object | | `precision` | _integer_ | | Round every value to this many decimals (`0` to `10`)By default values carry up to 10 decimals (10 significant digits below 0.1) | | `inverse` | _boolean_ | | `true` adds `inverse` to every rate: the value of one unit of the currency in the base currency (1 / `value`)Not together with `shape=compact` | | `include` | _string_ | | `change` adds `change` and `change_pct` to every rate: the difference to the close of the previous day, which `meta.change_since` names (`null` when that close has no rate for the currency)Not together with `shape=compact` | | `format` | _string_ | | `json` (default), `csv` or `xlsx`. The CSV has one row per currency: `datetime,base_currency,currency,value`, plus `inverse` and `change,change_pct` when you request them`xlsx` gives the same table as an Excel workbook, see [Excel downloads](https://fxapi.com/docs/range#excel-downloads) | Without these options the response keeps its default structure. A request costs one request of your quota, with or without them. ## Sample Response The API response comes as a JSON and consists of a `meta` and a `data` key. The `meta` holds useful information like the `last_updated_at` datetime to let you know when this dataset was last updated, and the `base_currency` of the values. The `data` key holds the actual currency information. ```json { "meta": { "last_updated_at": "2022-01-01T23:59:59Z", "base_currency": "USD" }, "data": { "AED": { "code": "AED", "value": 3.67306 }, "AFN": { "code": "AFN", "value": 91.80254 }, "ALL": { "code": "ALL", "value": 108.22904 }, "AMD": { "code": "AMD", "value": 480.41659 }, "...": "150+ more currencies" } } ``` ## Compact values, inverse rates and the daily change With `shape=compact` every rate is a plain value: ```bash curl -G https://api.fxapi.com/v1/latest \ -d currencies=EUR,GBP \ -d shape=compact \ -H "apikey: YOUR-API-KEY" ``` ```json { "meta": { "last_updated_at": "2023-06-23T10:15:59Z", "base_currency": "USD" }, "data": { "EUR": 0.918456, "GBP": 0.786123 } } ``` `inverse=true` and `include=change` add fields to every rate, here rounded to 4 decimals: ```bash curl -G https://api.fxapi.com/v1/latest \ -d currencies=EUR,GBP \ -d inverse=true \ -d include=change \ -d precision=4 \ -H "apikey: YOUR-API-KEY" ``` ```json { "meta": { "last_updated_at": "2023-06-23T10:15:59Z", "base_currency": "USD", "change_since": "2023-06-22T23:59:59Z" }, "data": { "EUR": { "code": "EUR", "value": 0.9185, "inverse": 1.0888, "change": 0.0012, "change_pct": 0.1308 }, "GBP": { "code": "GBP", "value": 0.7861, "inverse": 1.2721, "change": -0.002, "change_pct": -0.2538 } } } ``` `change` is `value` minus the rate at `change_since`, rounded like `value`; `change_pct` is that change in percent, rounded to 4 decimals, as [`/fluctuation`](https://fxapi.com/docs/fluctuation) computes it. With `format=csv` (here with `inverse=true&precision=4`): ```text datetime,base_currency,currency,value,inverse 2023-06-23T10:15:59Z,USD,EUR,0.9185,1.0888 2023-06-23T10:15:59Z,USD,GBP,0.7861,1.2721 ``` --- Source: https://fxapi.com/docs/matrix # Cross Rates Matrix Returns every cross rate between 2 to 25 currencies in one request, as JSON or as a ready-made CSV table. `data.EUR.USD` is the price of 1 EUR in USD. Instead of requesting the latest rates once per base currency, one request returns the full table. Latest by default, or for the close of a past `date`. Available in all plans. **Request Method:** `GET` **Request URL:** `https://api.fxapi.com/v1/matrix` ## Request Parameters | Parameter | Type | Mandatory | Description | | ------------ | --------- | ---------- | ----------- | | `apikey` | _string_ | yes | Your API Key | | `currencies` | _string_ | yes | 2 to 25 comma-separated currency codes (USD,EUR,GBP)The array form `currencies[]=USD¤cies[]=EUR` is also acceptedRows and columns keep this order | | `date` | _string_ | | The rates at the close of this past day (format: 2021-12-31) | | `precision` | _integer_ | | Round every rate to this many decimals (`0` to `10`)By default values carry up to 10 decimals (10 significant digits below 0.1) | | `format` | _string_ | | `json` (default), `csv` or `xlsx`. The CSV is the table itself: a header `base_currency,USD,EUR,GBP` and one row per base currency`xlsx` gives the same table as an Excel workbook, see [Excel downloads](https://fxapi.com/docs/range#excel-downloads) | A request costs one request of your quota, however many currencies it holds. Fewer than 2 or more than 25 currencies return a `422`. ## Sample Request ```bash curl -G https://api.fxapi.com/v1/matrix \ -d currencies=USD,EUR,GBP \ -H "apikey: YOUR-API-KEY" ``` ## Sample Response `meta.currencies` lists the rows and columns in order. `data.BASE.QUOTE` is the price of one unit of `BASE` in `QUOTE`: `1` where both are the same currency, `null` where a currency has no rate. ```json { "meta": { "last_updated_at": "2023-06-23T10:15:59Z", "currencies": ["USD", "EUR", "GBP"] }, "data": { "USD": { "USD": 1, "EUR": 0.918456, "GBP": 0.786123 }, "EUR": { "USD": 1.0887771, "EUR": 1, "GBP": 0.8559168 }, "GBP": { "USD": 1.2720671, "EUR": 1.1683413, "GBP": 1 } } } ``` ## CSV Table ```bash curl -G https://api.fxapi.com/v1/matrix \ -d currencies=USD,EUR,GBP \ -d format=csv \ -H "apikey: YOUR-API-KEY" ``` ```text base_currency,USD,EUR,GBP USD,1,0.918456,0.786123 EUR,1.0887771,1,0.8559168 GBP,1.2720671,1.1683413,1 ``` --- Source: https://fxapi.com/docs/mcp # MCP Server fxapi 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.fxapi.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.fxapi.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://fxapi.com/docs/mcp#sign-in-instead-of-an-api-key). ## Connect Using Claude Code: ```bash claude mcp add --transport http fxapi https://api.fxapi.com/mcp --header "apikey: YOUR_API_KEY" ``` Or add the server to any MCP-capable client (Claude Desktop, Cursor, VS Code, ...): ```json { "mcpServers": { "fxapi": { "url": "https://api.fxapi.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.fxapi.com/mcp`). Without a key, the endpoint answers `401` with a `WWW-Authenticate` header that names the protected resource metadata, `https://api.fxapi.com/.well-known/oauth-protected-resource/mcp`. The authorization server is `https://fxapi.com` (metadata at `https://fxapi.com/.well-known/oauth-authorization-server`, endpoints under `https://app.fxapi.com/oauth/`); clients register dynamically or with a client ID metadata document, and PKCE (`S256`) is required. You sign in on app.fxapi.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://fxapi.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 | | `getConvert` | `GET /v1/convert` | Convert a value between currencies | | `getRate` | `GET /v1/rate` | Exchange rate of one currency pair | | `getMatrix` | `GET /v1/matrix` | Cross rates between several currencies | | `getRange` | `GET /v1/range` | Historical exchange rates for a time range | | `getOhlc` | `GET /v1/ohlc` | Hourly or daily OHLC candles | | `getFluctuation` | `GET /v1/fluctuation` | How rates changed between two dates | | `getAverage` | `GET /v1/average` | Average, low and high rates per month, quarter or year | | `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://fxapi.com/docs/ohlc # OHLC Candles Returns hourly or daily candles (open, high, low, close) of up to 10 currencies, as JSON, CSV or Excel. A candle tells you more than a single rate: where a currency started and ended an hour or a day, and how far it moved in between. Typical uses are candlestick charts, volatility checks and backtests. Like the [range](https://fxapi.com/docs/range) endpoint, the OHLC endpoint needs a plan that includes the range endpoint. Hourly candles also need a plan with quarter-hourly updates or finer, daily candles a plan with hourly updates or finer. Otherwise requests fail with a `403` status code: ```json { "message": "You are not allowed to use the interval: hour, please upgrade your plan", "info": "For more information, see documentation: https://fxapi.com/docs/status-codes#_403" } ``` To lift these limits please [upgrade your plan](https://app.fxapi.com/subscription). **Request Method:** `GET` **Request URL:** `https://api.fxapi.com/v1/ohlc` ## Request Parameters | Parameter | Type | Mandatory | Description | | ---------------- | --------- | ---------- | ----------- | | `apikey` | _string_ | yes | Your API Key | | `currencies` | _string_ | yes | 1 to 10 comma-separated currency codes (EUR,GBP)The array form `currencies[]=EUR¤cies[]=GBP` is also accepted | | `datetime_start` | _string_ | yes | The start of the range (format: 2026-09-29T00:00:00Z / ISO8601 Datetime, or a date)The first candle is the one this moment falls in | | `datetime_end` | _string_ | yes | The end of the range (format: 2026-09-30T23:59:59Z / ISO8601 Datetime, or a date), on or after `datetime_start`The last candle is the one this moment falls in | | `interval` | _string_ | | `day` (default) or `hour`, the length of each candle. For valid time ranges see below | | `base_currency` | _string_ | | The base currency to which all results are behaving relative toBy default all values are based on USD | | `shape` | _string_ | | `default` or `compact`With `compact` every candle is a plain array `[datetime, open, high, low, close]` | | `precision` | _integer_ | | Round every value to this many decimals (`0` to `10`)By default values carry up to 10 decimals (10 significant digits below 0.1) | | `format` | _string_ | | `json` (default), `csv` or `xlsx`. The CSV has one row per candle: `datetime,base_currency,currency,open,high,low,close``xlsx` gives the same table as an Excel workbook, see [Excel downloads](https://fxapi.com/docs/range#excel-downloads) | ### Valid time ranges - `hour`: built from the minute rates. `datetime_start` not more than 7 days back, not more than 7 days between start and end. Needs a plan with quarter-hourly updates or finer. - `day`: built from the hourly rates. `datetime_start` not more than 3 months back, not more than 92 days between start and end. Needs a plan with hourly updates or finer. Ranges outside these limits return a `422`. For daily rates further back, use the [range](https://fxapi.com/docs/range) endpoint. A request costs one request of your quota, however many currencies and candles it holds. More than 10 currencies return a `422`. ## Sample Request ```bash curl -G https://api.fxapi.com/v1/ohlc \ -d currencies=EUR \ -d interval=hour \ -d datetime_start=2026-09-30T10:00:00Z \ -d datetime_end=2026-09-30T11:59:59Z \ -H "apikey: YOUR-API-KEY" ``` ## Sample Response `data` holds the candles of each currency, oldest first. `datetime` is the start of the hour or day; `meta.datetime_start` and `meta.datetime_end` are the starts of the first and the last candle (the current one when `datetime_end` lies in the future). ```json { "meta": { "base_currency": "USD", "interval": "hour", "datetime_start": "2026-09-30T10:00:00Z", "datetime_end": "2026-09-30T11:00:00Z" }, "data": { "EUR": [ { "datetime": "2026-09-30T10:00:00Z", "open": 0.91, "high": 0.95, "low": 0.9, "close": 0.92 }, { "datetime": "2026-09-30T11:00:00Z", "open": 0.92, "high": 0.925, "low": 0.9165, "close": 0.9188 } ] } } ``` ## How the candles are built - **Close.** Each candle closes on the rate stored at the end of its hour or day, the same rate the [range](https://fxapi.com/docs/range) endpoint returns for that hour or day. - **Open.** Each candle opens on the close of the candle before it, as FX candles do. The first candle opens on the close before `datetime_start`; after a gap in the data, a candle opens on its own close. - **High and low.** The extremes of the minute rates (hourly candles) or hourly rates (daily candles) in between. High and low always include the open and the close, so a candle whose open is below every finer rate has the open as its low. - **Missing candles.** Candles whose close is not stored yet, such as the hour or day still running, are left out. ## Compact and CSV With `shape=compact` every candle is `[datetime, open, high, low, close]`: ```json { "meta": { "base_currency": "USD", "interval": "hour", "datetime_start": "2026-09-30T10:00:00Z", "datetime_end": "2026-09-30T11:00:00Z" }, "data": { "EUR": [ ["2026-09-30T10:00:00Z", 0.91, 0.95, 0.9, 0.92], ["2026-09-30T11:00:00Z", 0.92, 0.925, 0.9165, 0.9188] ] } } ``` With `format=csv`: ```text datetime,base_currency,currency,open,high,low,close 2026-09-30T10:00:00Z,USD,EUR,0.91,0.95,0.9,0.92 2026-09-30T11:00:00Z,USD,EUR,0.92,0.925,0.9165,0.9188 ``` --- Source: https://fxapi.com/docs/range # Range Historical Exchange Rates Returns a range of exchange rates. Generally, we provide data going back to 1999. Depending on your subscription plan you can request different accuracies: `day`, `hour`, `quarter_hour`, `minute`. The coarse accuracies `week` and `month` are available on every plan with the range endpoint. The range endpoint is not part of every plan. Depending on your plan you may also receive a `403` status code when - your plan does not include the range endpoint at all, - you request an `accuracy` that is above your plan (e.g. `You are not allowed to use the accuracy: minute`), or - your plan limits range requests to a single currency and you request more than one (`You are not allowed to request more than one currency`). ```json { "message": "You are not allowed to use the range endpoint, please upgrade your plan", "info": "For more information, see documentation: https://fxapi.com/docs/status-codes#_403" } ``` To lift these limits please [upgrade your plan](https://app.fxapi.com/subscription). **Request Method:** `GET` **Request URL:** `https://api.fxapi.com/v1/range` ## Request Parameters | Parameter | Type | Mandatory | Description | | ---------------- | -------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | `apikey` | _string_ | yes | Your API Key | | `datetime_start` | _string_ | yes | Datetime for the start of your requested range (format: 2021-12-31T23:59:59Z / ISO8601 Datetime) | | `datetime_end` | _string_ | yes | Datetime for the end of your requested range (format: 2021-12-31T23:59:59Z / ISO8601 Datetime) | | `accuracy` | _string_ | | The accuracy you want to receive. Possible Values: `day`, `hour`, `quarter_hour`, `minute`, `week`, `month`Default: `day` For valid time ranges see below | | `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)The array form `currencies[]=EUR¤cies[]=USD` is also acceptedBy default all available currencies will be shown | | `type` | _string_ | | Filter the returned currencies by typePossible Values: `fiat`, `metal`, `crypto`By default currencies of all types are returned | | `orient` | _string_ | | `datetime` (default): one point per datetime`currency`: one series per currency, keyed by currency code, see [series per currency](https://fxapi.com/docs/range#series-per-currency) | | `shape` | _string_ | | `default` or `compact`With `compact` every rate is a plain value (`"EUR": 0.918456`) instead of a `code`/`value` object; with `orient=currency` every point is `[datetime, value]` | | `precision` | _integer_ | | Round every value to this many decimals (`0` to `10`)By default values carry up to 10 decimals (10 significant digits below 0.1) | | `format` | _string_ | | `json` (default), `csv` or `xlsx`. The CSV has one row per point in time and currency: `datetime,base_currency,currency,value``xlsx` gives the same table as an Excel workbook, see [Excel downloads](https://fxapi.com/docs/range#excel-downloads) | ## Valid Accuracy Time Ranges #### `day` - not more than 366 days between start and end (you can go back as far as 1999) #### `hour` - not more than 7 days between start and end - not more than 3 months back #### `quarter_hour` - not more than 24 hours between start and end - not more than 7 days back #### `minute` - not more than 6 hours between start and end - not more than 7 days back #### `week` - the daily rate at the end of each week (Sunday) - not more than 1830 days between start and end #### `month` - the daily rate at the end of each month - any span, back to 1999 With `week` and `month` the last point is `datetime_end` itself when it falls inside a period, so the newest rate is never dropped. For the *average* of each month instead of its last rate, use [`/average`](https://fxapi.com/docs/average). ## Sample Response The API response comes with an easy-to-read JSON format and contains currency pairs for all supported world currencies. The `datetime` in each object holds the datetime when the entry was last updated. Daily accuracy would result in end-of-day values and accuracy of an hour would result in end-of-hour values, and so on. ```bash curl -G https://api.fxapi.com/v1/range \ -d datetime_start=2025-01-01T00:00:00Z \ -d datetime_end=2025-12-31T23:59:59Z \ -d accuracy=month \ -d currencies=EUR \ -d format=csv \ -H "apikey: YOUR-API-KEY" ``` ```text datetime,base_currency,currency,value 2025-01-31T23:59:59Z,USD,EUR,0.9632 2025-02-28T23:59:59Z,USD,EUR,0.9614 ... 2025-12-31T23:59:59Z,USD,EUR,0.8513 ``` The default JSON response (here for `datetime_start=2022-01-01T00:00:00Z&datetime_end=2022-01-03T23:59:59Z`) looks like this. The `meta` key holds: | Attribute | Description | | ---------------- | --------------------------------------------------------------------------- | | `base_currency` | The base currency of the values | | `accuracy` | The accuracy of the points (`day` when none was requested) | | `datetime_start` | The requested start of the range as an ISO 8601 datetime | | `datetime_end` | The requested end of the range as an ISO 8601 datetime | ```json { "meta": { "base_currency": "USD", "accuracy": "day", "datetime_start": "2022-01-01T00:00:00Z", "datetime_end": "2022-01-03T23:59:59Z" }, "data": [ { "datetime": "2022-01-01T23:59:59Z", "currencies": { "AED": { "code": "AED", "value": 3.67306 }, "AFN": { "code": "AFN", "value": 91.80254 }, "ALL": { "code": "ALL", "value": 108.22904 }, "AMD": { "code": "AMD", "value": 480.41659 }, "...": "150+ more currencies" } }, { "datetime": "2022-01-02T23:59:59Z", "currencies": { "AED": { "code": "AED", "value": 3.67306 }, "AFN": { "code": "AFN", "value": 91.80254 }, "ALL": { "code": "ALL", "value": 108.22904 }, "AMD": { "code": "AMD", "value": 480.41659 }, "...": "150+ more currencies" } }, { "datetime": "2022-01-03T23:59:59Z", "currencies": { "AED": { "code": "AED", "value": 3.67306 }, "AFN": { "code": "AFN", "value": 91.80254 }, "ALL": { "code": "ALL", "value": 108.22904 }, "AMD": { "code": "AMD", "value": 480.41659 }, "...": "150+ more currencies" } } ] } ``` ## Excel downloads Every endpoint that offers `format=csv` also offers `format=xlsx`: the same table as an Excel workbook, ready to open in Excel, Numbers or LibreOffice without an import step. The workbook has one sheet with the CSV's header as a bold, frozen first row, and the rates are stored as numbers, not text, so you can sort, sum and chart them right away. It comes as a download (`Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`) named after the endpoint, e.g. `range.xlsx` or `latest.xlsx`, and costs the same as the CSV. ```bash curl -G https://api.fxapi.com/v1/range \ -d datetime_start=2025-01-01T00:00:00Z \ -d datetime_end=2025-12-31T23:59:59Z \ -d accuracy=month \ -d currencies=EUR \ -d format=xlsx \ -H "apikey: YOUR-API-KEY" \ -o range.xlsx ``` ## Series per currency Charts and spreadsheets usually want one series per currency. With `orient=currency`, `data` holds one list per currency, oldest point first: ```bash curl -G https://api.fxapi.com/v1/range \ -d datetime_start=2022-01-01T00:00:00Z \ -d datetime_end=2022-01-02T23:59:59Z \ -d currencies=EUR,GBP \ -d orient=currency \ -H "apikey: YOUR-API-KEY" ``` ```json { "meta": { "base_currency": "USD", "accuracy": "day", "datetime_start": "2022-01-01T00:00:00Z", "datetime_end": "2022-01-02T23:59:59Z" }, "data": { "EUR": [ {"datetime": "2022-01-01T23:59:59Z", "value": 0.879395}, {"datetime": "2022-01-02T23:59:59Z", "value": 0.880112} ], "GBP": [ {"datetime": "2022-01-01T23:59:59Z", "value": 0.739371}, {"datetime": "2022-01-02T23:59:59Z", "value": 0.739812} ] } } ``` Add `shape=compact` and every point becomes a `[datetime, value]` pair; with `precision=4`: ```json { "meta": { "base_currency": "USD", "accuracy": "day", "datetime_start": "2022-01-01T00:00:00Z", "datetime_end": "2022-01-02T23:59:59Z" }, "data": { "EUR": [ ["2022-01-01T23:59:59Z", 0.8794], ["2022-01-02T23:59:59Z", 0.8801] ], "GBP": [ ["2022-01-01T23:59:59Z", 0.7394], ["2022-01-02T23:59:59Z", 0.7398] ] } } ``` --- Source: https://fxapi.com/docs/rate # 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. 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: ```json { "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_ | yes | Your API Key | | `from` | _string_ | yes | The currency to convert from (e.g. `EUR`) | | `to` | _string_ | yes | 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](https://fxapi.com/docs/rate#rates-at-a-moment-of-the-day)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 (10 significant digits below 0.1) | | `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](https://fxapi.com/docs/range#excel-downloads) | A request costs one request of your quota. ## Sample Request ```bash 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`. ```json { "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](https://fxapi.com/docs/range) 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. ```bash 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: ```json { "meta": { "last_updated_at": "2026-09-30T10:07:59Z" }, "data": { "from": "EUR", "to": "USD", "rate": 1.1695906433, "inverse": 0.855 } } ``` ## Plain Text and CSV ```bash 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" ``` ```text 1.0888 ``` With `precision`, the text has exactly that many decimals. With `format=csv`: ```text 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: ```text =IMPORTDATA("https://api.fxapi.com/v1/rate?from=EUR&to=USD&format=text&apikey=YOUR-API-KEY") ``` Excel: ```text =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. --- Source: https://fxapi.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.fxapi.com/v1/status` ## Request Parameters | Parameter | Type | Mandatory | Description | | --------- | -------- | ---------- | ------------ | | `apikey` | _string_ | yes | Your API Key | ## Sample Response The response contains your `account_id` (and in `account_id_str` the same id as a string for JavaScript clients, whose numbers lose precision above 2^53) and one bucket per quota type: `month` for your regular monthly quota and `grace` for grace requests. ```json { "account_id": 313373133731337, "account_id_str": "313373133731337", "quotas": { "month": { "total": 300, "used": 71, "remaining": 229 }, "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.fxapi.com/upgrade?utm_source=agent&utm_campaign=status&team=313373133731337", "plans_url": "https://api.fxapi.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. If a subscription payment fails we do not block your API access right away. Instead your account temporarily receives a limited amount of grace requests. While the grace quota is active, successful requests count against the `grace` bucket instead of the `month` bucket, and responses carry `X-RateLimit-Limit-Grace-Month` / `X-RateLimit-Remaining-Grace-Month` headers. Once the payment is completed your regular quota applies again. For accounts in good standing the `grace` bucket is all zeroes. --- Source: https://fxapi.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` Error responses contain a JSON body with a human-readable `message` and, for `403`, `404` (no-data) and `422` errors returned by the API endpoints, an `info` field linking to the relevant documentation. Validation errors (`422`) additionally contain an `errors` object that maps each parameter name to an array of validation messages. `401`, `403`, `404` and `429` responses also carry a machine-readable `error` object with a stable `code` (e.g. `invalid_api_key`, `plan_upgrade_required` when your plan does not include an endpoint or parameter, `not_found` when there is no data, `quota_exceeded`) and `message`, plus an `actions` object with next-step URLs. ## 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 use this endpoint, please [upgrade your plan](https://app.fxapi.com/subscription). This happens when your plan does not include the [convert](https://fxapi.com/docs/convert) or [range](https://fxapi.com/docs/range) endpoint (which [ohlc](https://fxapi.com/docs/ohlc) needs as well), when you request a range `accuracy` or an ohlc `interval` above your plan, when you send `datetime` to [rate](https://fxapi.com/docs/rate) or [convert](https://fxapi.com/docs/convert) on a plan with daily updates, or when your plan limits range requests to a single currency and you request more than one. ### 404 A requested endpoint does not exist. The rates endpoints also return a `404` when there is no data for your requested timeframe and accuracy: "We sadly do not have any data in this timeframe for the selected accuracy." ### 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://fxapi.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.fxapi.com/subscription). If you prefer to wait instead, retry after the period has reset: at the start of the next minute for the rate limit, or at the start of the next month for the monthly quota. ### 500 Internal Server Error - let us know: support@fxapi.com ## Validation errors #### Invalid currencies One of the selected `currencies` is invalid, to get a full list of all currencies you can use the `currencies` endpoint. #### Invalid base_currency The selected `base_currency` is invalid, to get a full list of all currencies you can use the `currencies` endpoint. #### Invalid date The `date` is not a valid date. Please use the following format: YYYY-MM-DD #### Wrong format: value The `value` must be a number. #### Chronological order issue: datetime_start The `datetime_start` must be a date before or equal to datetime_end #### Invalid datetime_start The `datetime_start` is not a valid date. Datetime for the start of your requested range (format: 2021-12-31T23:59:59Z / ISO8601 Datetime) #### Chronological order issue: datetime_end The `datetime_end` must be a date after or equal to datetime_start #### Invalid datetime_end The `datetime_end` is not a valid date. Datetime for the end of your requested range (format: 2021-12-31T23:59:59Z / ISO8601 Datetime) #### Invalid accuracy The selected `accuracy` is invalid. Possible Values: day, hour, quarter_hour, minute, week, month Default: day #### Invalid date_from / date_to Used by [fluctuation](https://fxapi.com/docs/fluctuation) and [average](https://fxapi.com/docs/average): both must be days in `YYYY-MM-DD` format between 1999-01-01 and yesterday, with `date_from` on or before `date_to`. For average they must not be more than 1830 days apart. #### Invalid period The selected `period` is invalid. Possible Values: month, quarter, year, total Default: month #### Invalid type The selected `type` is invalid. Possible Values: fiat, metal, crypto --- Source: https://fxapi.com/docs/testing # Testing ***Available in the Professional and Enterprise plans*** This page includes all needed information to make sure your test environment works before deploying to production. ### Sandbox API Keys An API request sent with a sandbox api key is automatically identified as a request in sandbox mode. All requests with sandbox keys will respond with dummy data. Requests done with sandbox keys do not count against your quota ### Response All requests made with a sandbox key will respond with random values for each currency. All other functionality is the same (e.g. filtering, converting) The `/currencies` endpoint will respond with only three currencies.