### Enable Magento 2 Module and Setup Source: https://currencyapi.net/documentation/extensions After installing the extension via Composer, run these Magento CLI commands to enable the module, upgrade the setup, compile dependencies, and clear the cache. These steps are crucial for the extension to function correctly. ```bash php bin/magento module:enable HouseOfApis_CurrencyApi php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento cache:clean ``` -------------------------------- ### Live Rates API Endpoint Example Source: https://currencyapi.net/documentation/llms Example GET request for retrieving live currency rates. Ensure you replace 'YOUR_API_KEY' with your actual API key. Rates update frequency varies by plan. ```http GET https://currencyapi.net/api/v2/rates?key=YOUR_API_KEY&base=USD ``` -------------------------------- ### Fetch Currency Rates with EUR as Base Source: https://currencyapi.net/documentation/rates This example demonstrates how to change the base currency to EUR. All exchange rates will be relative to EUR, indicating how much of each currency you get for 1 EUR. Requires your API key. ```Python import requests url = "https://currencyapi.net/api/v2/rates" params = { "key": "YOUR_API_KEY", "base": "EUR", "output": "JSON" } response = requests.get(url, params=params) data = response.json() print(data) ``` -------------------------------- ### Install Python SDK Source: https://currencyapi.net/documentation/sdks Install the Python SDK using pip. This command is used for integrating the SDK into your Python projects. ```bash pip install currencyapinet ``` -------------------------------- ### Install Magento 2 Extension via Composer Source: https://currencyapi.net/documentation/extensions Use this Composer command to install the Magento 2 CurrencyApi.net importer extension. Ensure you have Composer installed and configured for your Magento project. ```bash composer require houseofapis/magento2-currencyapi-importer ``` -------------------------------- ### Example Error Response (400) Source: https://currencyapi.net/documentation/error-codes An example of a 400 Bad Request error response, indicating that an API key was not supplied. ```APIDOC #### Error Response 400 HTTP Response 400401405406414416417418419420421422423424500 ```json { "valid": false, "error": { "code": 400, "message": "You did not supply an API key" } } ``` ``` -------------------------------- ### Currency Rates API Response Example Source: https://currencyapi.net/documentation/quickstart This is an example of a successful JSON response from the Currency Rates endpoint, showing exchange rates relative to the base currency. ```json { "valid": true, "updated": 1768586454, "base": "USD", "rates": { "ADA": 2.5907865154, "AED": 3.6725, "AFN": 65.5, "ALL": 83.149975586, "AMD": 379.9899999999, "ANG": 1.7889087657, "AOA": 918.6679999999, "ARS": 1429.127762223, "AUD": 1.4966549074, "AWG": 1.79, "AZN": 1.7, // ... loads more } } ``` -------------------------------- ### OHLC Endpoint Response Example Source: https://currencyapi.net/documentation/ohlc This is an example of the JSON response structure for the OHLC endpoint. It includes the validity of the request, base and quote currencies, date, interval, and an array of OHLC data points, each with a start timestamp and open, high, low, close prices. ```json { "valid": true, "base": "USD", "quote": "EUR", "date": "2026-01-15", "interval": "5m", "ohlc": [ { "start": "2026-01-15T00:00:00.000Z", "open": 0.8586839996, "high": 0.8587480022, "low": 0.8586839996, "close": 0.8587465161 }, { "start": "2026-01-15T00:05:00.000Z", "open": 0.8587476166, "high": 0.8588048873, "low": 0.8587476166, "close": 0.8588048873 }, ... more ohlc ... ] } ``` -------------------------------- ### Currency List Source: https://currencyapi.net/documentation/rates Get the complete list of all supported currencies and their details. ```APIDOC ## GET /api/v2/currencies ### Description Get the complete list of all supported currencies and their details. ### Method GET ### Endpoint /api/v2/currencies ``` -------------------------------- ### Currency List Source: https://currencyapi.net/documentation/ohlc Get the complete list of all supported currencies. ```APIDOC ## GET /api/v2/currencies/list ### Description Get the complete list of all supported currencies. ### Method GET ### Endpoint /api/v2/currencies/list ``` -------------------------------- ### Historical Rates API Response Example (JSON) Source: https://currencyapi.net/documentation/history This is an example of a successful JSON response from the Historical Rates endpoint, showing the base currency, date, and exchange rates for various currencies. ```json { "valid": true, "base": "USD", "date": "2026-01-01", "rates": { "ADA": 2.990430622, "AED": 3.6725, "AFN": 66.10613, "ALL": 82.46228, "AMD": 381.6469, "ANG": 1.789, "AOA": 917, "ARS": 1449.697, "AUD": 1.497454, "AWG": 1.8025, "AZN": 1.7, "// ... loads more" } } ``` -------------------------------- ### Live Rates API Response Example Source: https://currencyapi.net/documentation/llms Example JSON response structure for the Live Rates API endpoint, showing validity, update timestamp, base currency, and a sample of currency rates. ```json "valid": true, "updated": 1768586454, "base": "USD", "rates": { "ADA": 2.5907865154, "AED": 3.6725, "AFN": 65.5, "ALL": 83.149975586, "AMD": 379.9899999999, ..... ``` -------------------------------- ### Currency List Endpoint Response Example Source: https://currencyapi.net/documentation/currencies This is an example of the JSON response structure for the Currency List endpoint. It includes a 'valid' boolean and a 'currencies' object containing currency codes and their names. ```json { "valid": true, "currencies": { "ADA": "Cardano", "AED": "United Arab Emirates Dirham", "AFN": "Afghan Afghani", "ALL": "Albanian Lek", "AMD": "Armenian Dram", "ANG": "Netherlands Antillean Guilder", "AOA": "Angolan Kwanza", "ARS": "Argentine Peso", "AUD": "Australian Dollar", "AWG": "Aruban Florin", "AZN": "Azerbaijani Manat", "// ... loads more" } } ``` -------------------------------- ### Example Timeframe Rates Response (JSON) Source: https://currencyapi.net/documentation/timeframe This is an example of the JSON response structure for the Timeframe Rates endpoint. It includes validity, base currency, date range, and a nested object containing rates keyed by date. ```json { "valid": true, "base": "USD", "start_date": "2026-01-01", "end_date": "2026-01-10", "rates": { "2026-01-01": { "ADA": 2.990430622, "AED": 3.6725, "AFN": 66.10613, "ALL": 82.46228, "AMD": 381.6469, "ANG": 1.789, "AOA": 917, "ARS": 1449.697, "AUD": 1.497454, "AWG": 1.8025, "AZN": 1.7, "// ... loads more" }, "2026-01-10": { "ADA": 2.8149190711, "AED": 3.6729, "AFN": 65.5, "ALL": 82.275, "AMD": 381.2253, "ANG": 1.789, "AOA": 917, "ARS": 1477.20241, "AUD": 1.49365198, "AWG": 1.8012, "AZN": 1.7, "// ... loads more" } } } ``` -------------------------------- ### Convert Currency using Python Source: https://currencyapi.net/documentation/convert Use this snippet to perform currency conversions by specifying the amount, source currency, target currency, and your API key. Ensure you have the 'requests' library installed. ```python import requests url = "https://currencyapi.net/api/v2/convert" params = { "key": "YOUR_API_KEY", "from": "GBP", "to": "USD", "amount": 100, "output": "JSON" } response = requests.get(url, params=params) data = response.json() print(data) ``` -------------------------------- ### Make a GET request to the Currency Rates endpoint (Python) Source: https://currencyapi.net/documentation/quickstart Use this Python snippet to fetch real-time currency exchange rates. Replace 'YOUR_API_KEY' with your actual API key. The default base currency is USD. ```python import requests url = "https://currencyapi.net/api/v2/rates" params = { "key": "YOUR_API_KEY", "base": "USD", "output": "JSON" } response = requests.get(url, params=params) data = response.json() print(data) ``` -------------------------------- ### JSON Error Response Example Source: https://currencyapi.net/documentation/error-codes This is an example of a typical JSON error response from the API. Always check the 'valid' field and handle specific error codes. ```json { "valid": false, "error": { "code": 400, "message": "You did not supply an API key" } } ``` -------------------------------- ### Currency Rates Endpoint Authentication Source: https://currencyapi.net/documentation/authentication This example demonstrates how to authenticate a request to the Currency Rates endpoint by including your API key as a query parameter. The API key is a unique string that identifies your account and determines your access level. ```APIDOC ## GET /api/v2/rates ### Description Retrieves currency exchange rates. ### Method GET ### Endpoint /api/v2/rates ### Parameters #### Query Parameters - **key** (string) - Required - Your unique API key. - **base** (string) - Optional - The base currency for the rates (e.g., USD). - **output** (string) - Optional - The desired output format (e.g., JSON, XML). ### Request Example ```python import requests url = "https://currencyapi.net/api/v2/rates" params = { "key": "YOUR_API_KEY", "base": "USD", "output": "JSON" } response = requests.get(url, params=params) data = response.json() print(data) ``` ### Response #### Success Response (200) - **valid** (boolean) - Indicates if the request was successful. - **updated** (integer) - Timestamp of the last update. - **base** (string) - The base currency used for the rates. - **rates** (object) - An object containing currency codes as keys and their corresponding rates as values. #### Response Example ```json { "valid": true, "updated": 1768586454, "base": "USD", "rates": { "ADA": 2.5907865154, "AED": 3.6725, "AFN": 65.5, "ALL": 83.149975586, "AMD": 379.9899999999, "ANG": 1.7889087657, "AOA": 918.6679999999, "ARS": 1429.127762223, "AUD": 1.4966549074, "AWG": 1.79, "AZN": 1.7 } } ``` ``` -------------------------------- ### Currency Rates Source: https://currencyapi.net/documentation/ohlc Get real-time exchange rates for all currencies. ```APIDOC ## GET /api/v2/currencies ### Description Get real-time exchange rates for all currencies. ### Method GET ### Endpoint /api/v2/currencies ``` -------------------------------- ### Example JSON Response with EUR Base Currency Source: https://currencyapi.net/documentation/rates This JSON response illustrates the output when EUR is set as the base currency. The 'rates' object will show the value of each currency relative to 1 EUR. ```JSON { "valid": true, "updated": 1756747503, "base": "EUR", "rates": { "ADA": 3.0312345678, "AED": 4.2975958758729, "AFN": 81.2917371048247, "ALL": 97.7757380861441, "AMD": 444.806054157267, "ANG": 2.09352963343965, "AOA": 1073.08257048338, "ARS": 1614.88284968004, "AUD": 1.78608932380976, "AWG": 2.10923859099723, "AZN": 1.98935700089613, // ... loads more } } ``` -------------------------------- ### Currency Conversion API Response (JSON) Source: https://currencyapi.net/documentation/convert This is an example of a successful JSON response from the currency conversion endpoint. It includes the conversion details and the timestamp of the last exchange rate update. ```json { "valid": true, "updated": 1756801323, "conversion": { "amount": 100, "from": "GBP", "to": "USD", "result": 134.109999926763 } } ``` -------------------------------- ### Get Currency Rates Source: https://currencyapi.net/documentation/rates Retrieves real-time exchange rates for all supported currencies. You can specify a base currency and output format. ```APIDOC ## Currency Rates GET ` /api/v2/rates ` ### Description Retrieves real-time exchange rates for all supported currencies. Rates are updated frequently and are based on the specified base currency (USD by default). ### Method GET ### Endpoint `/api/v2/rates` ### Parameters #### Query Parameters - **key** (string) - Required - Your API key for authentication. - **base** (string) - Optional - The base currency for exchange rates. Defaults to `USD`. - **output** (string) - Optional - Response output format. Use `json` (default) or `xml`. Defaults to `json`. ### Request Example ```python import requests url = "https://currencyapi.net/api/v2/rates" params = { "key": "YOUR_API_KEY", "base": "USD", "output": "JSON" } response = requests.get(url, params=params) data = response.json() print(data) ``` ### Response #### Success Response (200) - **valid** (boolean) - Indicates whether the request was successful. - **updated** (integer) - The timestamp when the rates were last updated (Unix timestamp). - **base** (string) - The base currency used for all exchange rates. - **rates** (object) - Object containing all exchange rates, where the key is the currency code and the value is the exchange rate. #### Response Example ```json { "valid": true, "updated": 1768586454, "base": "USD", "rates": { "ADA": 2.5907865154, "AED": 3.6725, "AFN": 65.5, "ALL": 83.149975586, "AMD": 379.9899999999, "ANG": 1.7889087657, "AOA": 918.6679999999, "ARS": 1429.127762223, "AUD": 1.4966549074, "AWG": 1.79, "AZN": 1.7 } } ``` ``` -------------------------------- ### Get Latest Exchange Rates Source: https://currencyapi.net/documentation This endpoint retrieves the latest currency exchange rates. You can specify a base currency to get rates relative to it. The response includes valid status, last update timestamp, base currency, and a map of rates for various currencies. ```APIDOC ## GET /api/v2/rates ### Description Retrieves the latest currency exchange rates. ### Method GET ### Endpoint /api/v2/rates ### Parameters #### Query Parameters - **base** (string) - Optional - The currency code to use as the base for the exchange rates (e.g., USD, EUR). ### Request Example ``` GET /api/v2/rates?base=USD ``` ### Response #### Success Response (200) - **valid** (boolean) - Indicates if the request was successful. - **updated** (integer) - Timestamp of the last data update. - **base** (string) - The base currency used for the rates. - **rates** (object) - A map of currency codes to their exchange rates relative to the base currency. #### Response Example ```json { "valid": true, "updated": 1768586454, "base": "USD", "rates": { "ADA": 2.5907865154, "AED": 3.6725, "AFN": 65.5, "ALL": 83.149975586, "AMD": 379.9899999999, "ANG": 1.7889087657, "AOA": 918.6679999999, "ARS": 1429.127762223, "AUD": 1.4966549074, "AWG": 1.79, "AZN": 1.7 } } ``` ``` -------------------------------- ### Historical Rates Source: https://currencyapi.net/documentation/rates Get historical exchange rates for analysis and trend tracking. ```APIDOC ## GET /api/v2/timeframe ### Description Get historical exchange rates for analysis and trend tracking. ### Method GET ### Endpoint /api/v2/timeframe ``` -------------------------------- ### Instantiate Python SDK Client Source: https://currencyapi.net/documentation/sdks Initialize the Python SDK client with your API key. Replace 'YOUR_API_KEY' with your actual API key. ```python from currencyapinet.currency import Currency currency = Currency('YOUR_API_KEY') ``` -------------------------------- ### Fetch Currency List using Python Source: https://currencyapi.net/documentation/currencies Use this snippet to retrieve a list of all supported currencies from the API. Ensure you replace 'YOUR_API_KEY' with your actual API key. The response is returned in JSON format. ```python import requests url = "https://currencyapi.net/api/v2/currencies" params = { "key": "YOUR_API_KEY", "output": "JSON" } response = requests.get(url, params=params) data = response.json() print(data) ``` -------------------------------- ### Fetch Timeframe Rates using Python Source: https://currencyapi.net/documentation/timeframe Use this Python snippet to make a request to the Timeframe Rates endpoint. Ensure you replace 'YOUR_API_KEY' with your actual API key. The parameters allow specifying the date range, base currency, and output format. ```python import requests url = "https://currencyapi.net/api/v2/timeframe" params = { "key": "YOUR_API_KEY", "start_date": "2026-01-01", "end_date": "2026-01-10", "base": "USD", "output": "JSON" } response = requests.get(url, params=params) data = response.json() print(data) ``` -------------------------------- ### Fetch OHLC Data using Python Source: https://currencyapi.net/documentation/ohlc Use this Python snippet to fetch OHLC data for a specific currency pair and date. Ensure you replace 'YOUR_API_KEY' with your actual API key. The parameters allow customization of base and quote currencies, date, interval, and output format. ```python import requests url = "https://currencyapi.net/api/v2/ohlc" params = { "key": "YOUR_API_KEY", "quote": "EUR", "date": "2026-01-15", "base": "USD", "interval": "5m", "output": "JSON" } response = requests.get(url, params=params) data = response.json() ``` -------------------------------- ### Change Base Currency Source: https://currencyapi.net/documentation/rates Demonstrates how to change the base currency for exchange rates. By default, rates are relative to USD, but you can specify any supported currency. ```APIDOC ## Base Currency ### Description By default, all exchange rates are calculated relative to the US Dollar (USD). You can change the base currency by passing the `base` parameter with any supported currency code. ### Method GET ### Endpoint `/api/v2/rates` ### Parameters #### Query Parameters - **key** (string) - Required - Your API key for authentication. - **base** (string) - Optional - The base currency for exchange rates. Example: `EUR`. - **output** (string) - Optional - Response output format. Use `json` (default) or `xml`. Defaults to `json`. ### Request Example ```python import requests url = "https://currencyapi.net/api/v2/rates" params = { "key": "YOUR_API_KEY", "base": "EUR", "output": "JSON" } response = requests.get(url, params=params) data = response.json() print(data) ``` ### Response #### Success Response (200) - **valid** (boolean) - Indicates whether the request was successful. - **updated** (integer) - The timestamp when the rates were last updated (Unix timestamp). - **base** (string) - The base currency used for all exchange rates (e.g., `EUR`). - **rates** (object) - Object containing all exchange rates relative to the specified base currency. #### Response Example ```json { "valid": true, "updated": 1756747503, "base": "EUR", "rates": { "ADA": 3.0312345678, "AED": 4.2975958758729, "AFN": 81.2917371048247, "ALL": 97.7757380861441, "AMD": 444.806054157267, "ANG": 2.09352963343965, "AOA": 1073.08257048338, "ARS": 1614.88284968004, "AUD": 1.78608932380976, "AWG": 2.10923859099723, "AZN": 1.98935700089613 } } ``` ``` -------------------------------- ### Fetch Historical Rates using Python Source: https://currencyapi.net/documentation/history Use this snippet to retrieve historical exchange rates for a specific date and base currency. Ensure your API key is valid and parameters are correctly formatted. ```python import requests url = "https://currencyapi.net/api/v2/history" params = { "key": "YOUR_API_KEY", "date": "2026-01-01", "base": "USD", "output": "JSON" } response = requests.get(url, params=params) data = response.json() print(data) ``` -------------------------------- ### Currency List Endpoint Source: https://currencyapi.net/documentation/currencies Retrieves a comprehensive list of all supported currencies, cryptocurrencies, and precious metals. This is useful for populating currency selectors or validating currency codes. ```APIDOC ## GET /api/v2/currencies ### Description Retrieves a complete list of all supported currencies, cryptocurrencies, and precious metals available through the API. This endpoint is useful for building currency selection interfaces or validating currency codes before making conversion requests. ### Method GET ### Endpoint /api/v2/currencies ### Parameters #### Query Parameters - **key** (string) - Required - Your API key - **output** (string) - Optional - Response output format. Use `json` (default) or `xml`. ### Response #### Success Response (200) - **valid** (boolean) - Indicates whether the request was successful - **currencies** (object) - Object containing currency codes as keys and currency names as values ### Request Example ```python import requests url = "https://currencyapi.net/api/v2/currencies" params = { "key": "YOUR_API_KEY", "output": "JSON" } response = requests.get(url, params=params) data = response.json() print(data) ``` ### Response Example ```json { "valid": true, "currencies": { "ADA": "Cardano", "AED": "United Arab Emirates Dirham", "AFN": "Afghan Afghani", "ALL": "Albanian Lek", "AMD": "Armenian Dram", "ANG": "Netherlands Antillean Guilder", "AOA": "Angolan Kwanza", "ARS": "Argentine Peso", "AUD": "Australian Dollar", "AWG": "Aruban Florin", "AZN": "Azerbaijani Manat" } } ``` ``` -------------------------------- ### Currency Conversion Source: https://currencyapi.net/documentation/convert Converts a specified amount between any two supported currencies using real-time exchange rates. Requires an API key for authentication. ```APIDOC ## GET /api/v2/convert ### Description Converts a specified amount between any two supported currencies using real-time exchange rates. This endpoint is suitable for e-commerce, financial calculators, and payment processing systems. ### Method GET ### Endpoint `/api/v2/convert` ### Parameters #### Query Parameters - **key** (string) - Required - Your API key for authentication. - **amount** (number) - Required - The amount to convert. - **from** (string) - Required - The source currency code (e.g., USD, EUR, GBP). - **to** (string) - Required - The target currency code (e.g., USD, EUR, GBP). - **output** (string) - Optional - Response output format. Use `json` (default) or `xml`. ### Response #### Success Response (200) - **valid** (boolean) - Indicates whether the request was successful. - **updated** (integer) - The timestamp when the exchange rate was last updated (Unix timestamp). - **conversion** (object) - Object containing the conversion details: - **amount** (number) - The original amount that was converted. - **from** (string) - The source currency code used for the conversion. - **to** (string) - The target currency code used for the conversion. - **result** (number) - The converted amount in the target currency. ### Request Example ```json { "example": "request body" } ``` ### Response Example ```json { "valid": true, "updated": 1756801323, "conversion": { "amount": 100, "from": "GBP", "to": "USD", "result": 134.109999926763 } } ``` ``` -------------------------------- ### Error Codes Reference Source: https://currencyapi.net/documentation/error-codes A detailed reference of all possible error codes returned by the CurrencyApi.net API, including their numeric code and a description of the error. ```APIDOC #### All Error Codes ` 400 ` ` number ` You did not supply an API key ` 401 ` ` number ` Your API key is not valid ` 405 ` ` number ` You have hit your monthly subscription allowance ` 406 ` ` number ` You've requested a base currency that doesn't exist ` 414 ` ` number ` One or more of the currencies is not a currency we support or has been entered invalid ` 416 ` ` number ` Your subscription plan does not allow you to use this endpoint ` 417 ` ` number ` There is no historical data for the date supplied ` 418 ` ` number ` One or more of the dates you supplied were not in the correct format (eg 2026-01-01) ` 419 ` ` number ` We allow a maximum of 365 days. Please change this and try again ` 420 ` ` number ` You have requested either today's date or a date in the future. For timeframe and history endpoints, we store the data at 23:59 GTM of the current day ` 421 ` ` number ` There is no OHLC data available for the date supplied ` 422 ` ` number ` There is no OHLC data available for the requested currency on this date ` 423 ` ` number ` The interval parameter is invalid. Allowed values: 5m, 15m, 30m, 1h, 4h, 12h, 1d ` 424 ` ` number ` OHLC data is only available for the last 30 days. ` 500 ` ` number ` There seems to be a technical fault our end ``` -------------------------------- ### Authentication Error Response Source: https://currencyapi.net/documentation/authentication This section details the error response received when authentication fails, typically due to a missing or invalid API key. It includes the HTTP status code and a JSON object describing the error. ```APIDOC #### Error Response 400 HTTP Response ```json { "valid": false, "error": { "code": 400, "message": "You did not supply an API key" } } ``` ``` -------------------------------- ### OHLC Endpoint Source: https://currencyapi.net/documentation/ohlc Retrieves OHLC (Open, High, Low, Close) price data for a specified currency pair on a given date and time interval. This endpoint is suitable for technical analysis and charting applications. ```APIDOC ## GET /api/v2/ohlc ### Description Retrieves OHLC (Open, High, Low, Close) price data for a currency pair on a specific date with various time intervals. This endpoint is designed for technical analysis and charting applications. ### Method GET ### Endpoint `/api/v2/ohlc` ### Parameters #### Query Parameters - **key** (string) - Required - Your API key for authentication. - **quote** (string) - Required - Target currency code (e.g., EUR, GBP, BTC). This is the quote currency in the pair. - **date** (string) - Required - Date in YYYY-MM-DD format (e.g., 2026-01-15). Must be in the past (not today or future) and within the last 30 days. Dates older than 30 days will return error 424. - **base** (string) - Optional - Base currency code (e.g., USD, EUR). Defaults to USD. - **interval** (string) - Optional - Time interval for OHLC. Allowed values: 5m, 15m, 30m, 1h, 4h, 12h, 1d. Defaults to `1d`. - **output** (string) - Optional - Response output format. Use `json` (default) or `xml`. Defaults to `json`. ### Response #### Success Response (200) - **valid** (boolean) - Indicates whether the request was successful. - **base** (string) - Base currency code used for the pair. - **quote** (string) - Target currency code (the quote parameter). - **date** (string) - Date for which candle data is returned (YYYY-MM-DD format). - **interval** (string) - Time interval used for the OHLC data. - **ohlc** (array) - Array of OHLC objects for the requested date and interval. - **start** (string) - ISO 8601 timestamp for the start of the candle period. - **open** (number) - Opening price for the period. - **high** (number) - Highest price during the period. - **low** (number) - Lowest price during the period. - **close** (number) - Closing price for the period. ### Request Example ```python import requests url = "https://currencyapi.net/api/v2/ohlc" params = { "key": "YOUR_API_KEY", "quote": "EUR", "date": "2026-01-15", "base": "USD", "interval": "5m", "output": "JSON" } response = requests.get(url, params=params) data = response.json() ``` ### Response Example ```json { "valid": true, "base": "USD", "quote": "EUR", "date": "2026-01-15", "interval": "5m", "ohlc": [ { "start": "2026-01-15T00:00:00.000Z", "open": 0.8586839996, "high": 0.8587480022, "low": 0.8586839996, "close": 0.8587465161 }, { "start": "2026-01-15T00:05:00.000Z", "open": 0.8587476166, "high": 0.8588048873, "low": 0.8587476166, "close": 0.8588048873 }, ... more ohlc ... ] } ``` ``` -------------------------------- ### Historical Rates Source: https://currencyapi.net/documentation/history Retrieve historical exchange rates for a specific date. This endpoint is available on Essential, StartUp, and Professional plans. ```APIDOC ## Historical Rates ### Description Provides access to past exchange rates for any supported currency pair. Essential for financial analysis, trend tracking, backtesting trading strategies, and building historical charts and reports. ### Method GET ### Endpoint `/api/v2/history` ### Parameters #### Query Parameters - **key** (string) - Required - Your API key for authentication. - **date** (string) - Required - The date for which you want historical rates (YYYY-MM-DD format). - **base** (string) - Optional - The base currency for exchange rates. All rates will be relative to this currency. Default: `USD`. - **output** (string) - Optional - Response output format. Use `json` (default) or `xml`. Default: `json`. ### Response Properties #### Success Response (200) - **valid** (boolean) - Indicates whether the request was successful. - **updated** (integer) - The timestamp when the rates were last updated (Unix timestamp). - **base** (string) - The base currency used for all exchange rates. - **date** (string) - The date for which the historical rates were retrieved. - **rates** (object) - Object containing historical exchange rates, where the key is the currency code and the value is the exchange rate. If the currency did not exist on the date requested, the value will be NULL. ### Request Example ```python import requests url = "https://currencyapi.net/api/v2/history" params = { "key": "YOUR_API_KEY", "date": "2026-01-01", "base": "USD", "output": "JSON" } response = requests.get(url, params=params) data = response.json() print(data) ``` ### Response Example ```json { "valid": true, "base": "USD", "date": "2026-01-01", "rates": { "ADA": 2.990430622, "AED": 3.6725, "AFN": 66.10613, "ALL": 82.46228, "AMD": 381.6469, "ANG": 1.789, "AOA": 917, "ARS": 1449.697, "AUD": 1.497454, "AWG": 1.8025, "AZN": 1.7 } } ``` ``` -------------------------------- ### Timeframe Rates Source: https://currencyapi.net/documentation/timeframe Retrieves historical exchange rates for a specified date range. Ideal for reporting, charting, or analyzing currency movements over time. ```APIDOC ## GET /api/v2/timeframe ### Description Returns historical exchange rates across a specific date range. This is ideal for reporting, charting, or analyzing currency movements over time. ### Method GET ### Endpoint `/api/v2/timeframe` ### Parameters #### Query Parameters - **key** (string) - Required - Your API key for authentication - **start_date** (string) - Required - Start of the date range (YYYY-MM-DD). Max 1 year between start and end date. - **end_date** (string) - Required - End of the date range (YYYY-MM-DD). Max 1 year between start and end date. - **base** (string) - Optional - Base currency for the returned rates. Default: `USD` - **output** (string) - Optional - Response output format. Use `json` (default) or `xml`. Default: `json` ### Response #### Success Response (200) - **valid** (boolean) - Indicates whether the request was successful - **base** (string) - Base currency used for the timeframe - **start_date** (string) - Start of the date range returned - **end_date** (string) - End of the date range returned - **rates** (object) - Object keyed by date with each value being an object of currency codes to rates ### Request Example ```python import requests url = "https://currencyapi.net/api/v2/timeframe" params = { "key": "YOUR_API_KEY", "start_date": "2026-01-01", "end_date": "2026-01-10", "base": "USD", "output": "JSON" } response = requests.get(url, params=params) data = response.json() print(data) ``` ### Response Example ```json { "valid": true, "base": "USD", "start_date": "2026-01-01", "end_date": "2026-01-10", "rates": { "2026-01-01": { "ADA": 2.990430622, "AED": 3.6725, "AFN": 66.10613, "ALL": 82.46228, "AMD": 381.6469, "ANG": 1.789, "AOA": 917, "ARS": 1449.697, "AUD": 1.497454, "AWG": 1.8025, "AZN": 1.7 }, "2026-01-10": { "ADA": 2.8149190711, "AED": 3.6729, "AFN": 65.5, "ALL": 82.275, "AMD": 381.2253, "ANG": 1.789, "AOA": 917, "ARS": 1477.20241, "AUD": 1.49365198, "AWG": 1.8012, "AZN": 1.7 } } } ``` ``` -------------------------------- ### Error Response Format Source: https://currencyapi.net/documentation/error-codes All error responses from the CurrencyApi.net API follow a consistent JSON and XML format, including an error code, message, and HTTP status code. ```APIDOC ## Error Response Properties `valid` `boolean` Always false for error responses `error` `object` Object containing error details `code` `number` The specific error code (400-500) `message` `string` Human-readable error message ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.