### Convert Currency - HTTP Example Source: https://docs.openexchangerates.org/reference/convert This snippet demonstrates how to perform a currency conversion using the Open Exchange Rates API via an HTTP GET request. It requires your application ID. ```http https://openexchangerates.org/api/convert/19999.95/GBP/EUR?app_id=YOUR_APP_ID ``` -------------------------------- ### API Request with Query Parameters Source: https://docs.openexchangerates.org/index Illustrates how to include query parameters such as App ID, base currency, and JSONP callback in an API request URL. This example shows a GET request for the latest rates. ```http https://openexchangerates.org/api/latest.json ?app_id=YOUR_APP_ID &base=GBP &callback=someCallbackFunction ``` -------------------------------- ### Fetch Time Series Data (JavaScript - jQuery) Source: https://docs.openexchangerates.org/reference/ohlc-json This example shows how to retrieve time series exchange rate data using JavaScript with the jQuery library. It constructs query parameters including an application ID, start time, period, base currency, and target symbols, then sends a GET request to the API. ```javascript var query_vars = { app_id: 'YOUR_APP_ID', start_time: '2017-07-01T14:30:00Z', period: '30m', base: 'USD', symbols: 'GBP,EUR,HKD', prettyprint: false } $.get('https://openexchangerates.org/api/time-series.json', query_vars, function(data) { console.log(data); }); ``` -------------------------------- ### Fetch OHLC Data (HTTP) Source: https://docs.openexchangerates.org/reference/ohlc-json This snippet demonstrates how to fetch Open, High, Low, Close (OHLC) data for currency exchange rates using an HTTP GET request. It requires an application ID, start time, period, base currency, and target symbols. The `prettyprint` parameter controls the output format. ```http https://openexchangerates.org/api/ohlc.json ?app_id=YOUR_APP_ID &start_time=2017-07-17T11:00:00Z &period=30m &base=USD &symbols=GBP,EUR,HKD &prettyprint=true ``` -------------------------------- ### Combining Parameters Example (HTTP) Source: https://docs.openexchangerates.org/reference/alternative-currencies An example illustrating how to combine various parameters like base currency, alternative rates, and specific symbols in a single API request. ```APIDOC ## Combining Parameters Example This example shows how to use the `latest.json` endpoint with multiple parameters to fetch specific alternative and black-market rates. ### Method GET ### Endpoint https://openexchangerates.org/api/latest.json ### Parameters #### Query Parameters - **app_id** (string) - Required - Your unique application ID. - **base** (string) - Optional - The base currency (e.g., 'LTC'). - **show_alternative** (boolean) - Optional - Set to 1 to include alternative rates. - **symbols** (string) - Optional - Comma-separated list of currency codes (e.g., 'ETH,VEF,BTC,NEM'). - **prettyprint** (integer) - Optional - Set to 0 to disable pretty-printing. ### Request Example ```http https://openexchangerates.org/api/latest.json ?app_id=YOUR_APP_ID &base=LTC &show_alternative=1 &symbols=ETH,VEF,VEF_DIPRO,VEF_DICOM,VEF_BLKMKT,BTC,NEM &prettyprint=0 ``` ``` -------------------------------- ### Get List of Available Alternative Currencies (HTTP) Source: https://docs.openexchangerates.org/docs/alternative-currencies This HTTP request example demonstrates how to retrieve a list of all available alternative currencies, including unofficial and digital ones. It involves calling the 'currencies.json' endpoint with the 'show_alternative=1' query parameter. ```HTTP https://openexchangerates.org/api/currencies.json ?show_alternative=1 ``` -------------------------------- ### Get API Usage Information (JavaScript) Source: https://docs.openexchangerates.org/reference/usage-json This example demonstrates how to fetch your API usage statistics from Open Exchange Rates using jQuery in JavaScript. It sends a GET request to the usage endpoint, requiring your 'app_id' as a parameter. The response, containing usage details, is then logged to the console. ```javascript $.get('https://openexchangerates.org/api/usage.json', {app_id: 'YOUR_APP_ID'}, function(data) { console.log(data); }); ``` -------------------------------- ### Example JSON Response for Latest Rates Source: https://docs.openexchangerates.org/reference/api-introduction This is an example of the JSON response received from the 'latest.json' API endpoint. It includes a disclaimer, license link, a UNIX timestamp, the base currency code, and a 'rates' object containing currency symbols and their corresponding values relative to the base. ```json { "disclaimer": "https://openexchangerates.org/terms/", "license": "https://openexchangerates.org/license/", "timestamp": 1449877801, "base": "USD", "rates": { "AED": 3.672538, "AFN": 66.809999, "ALL": 125.716501, "AMD": 484.902502, "ANG": 1.788575, "AOA": 135.295998, "ARS": 9.750101, "AUD": 1.390866, "/* ... */" } } ``` -------------------------------- ### GET /api/latest.json Source: https://docs.openexchangerates.org/reference Fetches the latest foreign exchange rates. ```APIDOC ## GET /api/latest.json ### Description Fetches the latest foreign exchange rates. You can specify a base currency using the `base` query parameter. ### Method GET ### Endpoint `/api/latest.json` ### Parameters #### Query Parameters - **app_id** (string) - Required - Your unique App ID. - **base** (string) - Optional - The base currency (e.g., 'USD', 'EUR'). Defaults to 'USD'. - **symbols** (string) - Optional - A comma-separated list of currency symbols to include in the response. - **callback** (string) - Optional - A JSONP callback function name. ### Request Example ```json { "example": "https://openexchangerates.org/api/latest.json?app_id=YOUR_APP_ID&base=EUR&symbols=USD,GBP" } ``` ### Response #### Success Response (200) - **base** (string) - The base currency. - **date** (string) - The date of the rates. - **rates** (object) - An object containing currency codes as keys and their corresponding rates as values. #### Response Example ```json { "base": "EUR", "date": "2023-10-27", "rates": { "USD": 1.069, "GBP": 0.8695, "JPY": 161.23 } } ``` ``` -------------------------------- ### Response Example with Alternative Rates Source: https://docs.openexchangerates.org/reference/alternative-currencies This is an example of the JSON response format when requesting alternative rates. The 'rates' object includes standard ISO currency codes as well as custom symbols for alternative rates like VEF_BLKMKT, VEF_DICOM, and VEF_DIPRO. The base currency defaults to USD. ```json { disclaimer: "https://openexchangerates.org/terms/", license: "https://openexchangerates.org/license/", "timestamp": 1500652863, "base": "USD", "rates": { "AED": 3.673018, /* ... */ "VEF_BLKMKT": 8570.78, "VEF_DICOM": 2700, "VEF_DIPRO": 10, /* ... */ } } ``` -------------------------------- ### GET /api/currencies.json Source: https://docs.openexchangerates.org/reference Retrieves a list of available currency codes and their names. ```APIDOC ## GET /api/currencies.json ### Description Retrieves a list of all supported currency codes and their corresponding human-readable names. ### Method GET ### Endpoint `/api/currencies.json` ### Parameters #### Query Parameters - **app_id** (string) - Required - Your unique App ID. - **callback** (string) - Optional - A JSONP callback function name. ### Request Example ```json { "example": "https://openexchangerates.org/api/currencies.json?app_id=YOUR_APP_ID" } ``` ### Response #### Success Response (200) - **(object)** - An object where keys are currency codes and values are currency names. #### Response Example ```json { "USD": "United States Dollar", "EUR": "Euro", "GBP": "British Pound Sterling", "JPY": "Japanese Yen" } ``` ``` -------------------------------- ### Convert Currency - JavaScript (jQuery) Example Source: https://docs.openexchangerates.org/reference/convert This snippet shows how to use jQuery's $.get method to convert currency with the Open Exchange Rates API. It takes the amount, source currency, target currency, and your application ID as parameters. ```javascript var from = "GBP", to = "EUR", value = "19999.95"; $.get('https://openexchangerates.org/api/convert/' + value + '/' + from + '/' + to, {app_id: 'YOUR_APP_ID'}, function(data) { console.log(data); }); ``` -------------------------------- ### API Introduction Source: https://docs.openexchangerates.org/reference Provides an overview of the Open Exchange Rates API, its data sources, and general usage. ```APIDOC ## API Introduction Open Exchange Rates provides a simple, lightweight and portable JSON API with live and historical foreign exchange (forex) rates, via a simple and easy-to-integrate API, in JSON format. Data are tracked and blended algorithmically from multiple reliable sources, ensuring fair and unbiased consistency. Exchange rates published through the Open Exchange Rates API are collected from multiple reliable providers, blended together and served up in JSON format for everybody to use. There are no complex queries, confusing authentication methods or long-term contracts. End-of-day rates are available historically for all days going back to 1st January, 1999. ``` -------------------------------- ### API Introduction Source: https://docs.openexchangerates.org/index Provides an overview of the Open Exchange Rates API, its capabilities, and how to connect. ```APIDOC ## API Introduction ### Description Open Exchange Rates provides a simple, lightweight and portable JSON API with live and historical foreign exchange (forex) rates. Data are tracked and blended algorithmically from multiple reliable sources. ### Connection Types The API can be accessed by any language or software that can make HTTP requests. Data is served via HTTPS in JSON format. The API does not support websockets, webhooks, or other keep-alive connections; data must be requested explicitly. ### URL Format The API base path is `https://openexchangerates.org/api/`. API routes/endpoints are appended to this base path. Query parameters (such as App ID, base currency, or callback function) are appended as GET request parameters. **Example URL with query parameters:** ``` https://openexchangerates.org/api/latest.json?app_id=YOUR_APP_ID&base=GBP&callback=someCallbackFunction ``` ### Response Format Valid requests receive a JSON-formatted response. Invalid requests receive an error message. ``` -------------------------------- ### GET /time-series.json Source: https://docs.openexchangerates.org/reference/time-series-json Fetches historical exchange rates for a given time period. The start and end dates are inclusive. The maximum query period is one month. Use the `symbols` parameter to optimize response size. ```APIDOC ## GET /time-series.json ### Description Retrieves historical exchange rates for a specified time period. ### Method GET ### Endpoint /time-series.json ### Parameters #### Query Parameters - **start_date** (string) - Required - The first day of the time series (YYYY-MM-DD). - **end_date** (string) - Required - The final day of the time series (YYYY-MM-DD), inclusive. - **base** (string) - Required - The 3-letter currency code to which all exchange rates are relative. - **symbols** (string) - Optional - A comma-separated list of currency codes to include in the response. If not specified, all available currencies are returned. ### Request Example ```json { "start_date": "2023-01-01", "end_date": "2023-01-31", "base": "USD", "symbols": "EUR,GBP,JPY" } ``` ### Response #### Success Response (200) - **base** (string) - The 3-letter currency code of the base currency. - **rates** (object) - An object where keys are dates (YYYY-MM-DD) and values are objects containing exchange rates for that date relative to the base currency. #### Response Example ```json { "base": "USD", "rates": { "2023-01-01": { "EUR": 0.92, "GBP": 0.81, "JPY": 130.50 }, "2023-01-02": { "EUR": 0.921, "GBP": 0.812, "JPY": 130.75 } // ... more dates } } ``` ## Errors Please refer to the [API Error Messages](https://docs.openexchangerates.org/docs/errors) documentation for a comprehensive list of possible errors. ``` -------------------------------- ### API Base URL and Endpoints Source: https://docs.openexchangerates.org/index Demonstrates the base URL for the Open Exchange Rates API and common endpoint examples. These routes are appended to the base path to fetch specific data like latest rates or historical data. ```http https://openexchangerates.org/api/ latest.json currencies.json historical/2013-02-16.json ``` -------------------------------- ### GET /time-series.json Source: https://docs.openexchangerates.org/reference/time-series-json Retrieves historical exchange rates for a specified time period. This endpoint is available for Enterprise and Unlimited plan clients. It allows fetching daily exchange rates between a start and end date, with options to specify base currency, target symbols, and include alternative currencies. ```APIDOC ## GET /time-series.json ### Description Get historical exchange rates for a given time period, where available, using the time series / bulk download API endpoint. This endpoint is available for clients on the Enterprise and Unlimited plans. ### Method GET ### Endpoint https://openexchangerates.org/api/time-series.json ### Parameters #### Query Parameters - **app_id** (string) - Required - Your unique App ID - **start** (string) - Required - The time series start date in YYYY-MM-DD format - **end** (string) - Required - The time series end date in YYYY-MM-DD format - **symbols** (string) - Recommended - Limit results to specific currencies (comma-separated list of 3-letter codes) - **base** (string) - Optional - Change base currency (3-letter code, default: USD) - **show_alternative** (boolean) - Optional - Extend returned values with alternative, black market and digital currency rates (default: false) - **prettyprint** (boolean) - Optional - Human-readable response for debugging (response size will be much larger) (default: false) ### Request Example ```json { "example": "GET https://openexchangerates.org/api/time-series.json?app_id=YOUR_APP_ID&start=2013-01-01&end=2013-01-31&symbols=EUR,HKD&base=AUD" } ``` ### Response #### Success Response (200) - **disclaimer** (string) - Link to terms of use. - **license** (string) - Link to license information. - **start_date** (string) - The start date of the returned data. - **end_date** (string) - The end date of the returned data. - **base** (string) - The base currency for the exchange rates. - **rates** (object) - An object where keys are dates and values are objects containing currency exchange rates for that date. #### Response Example ```json { "example": "{\n \"disclaimer\": \"https://openexchangerates.org/terms/\",\n \"license\": \"https://openexchangerates.org/license/\",\n \"start_date\": \"2013-01-01\",\n \"end_date\": \"2013-01-31\",\n \"base\": \"AUD\",\n \"rates\": {\n \"2013-01-01\": {\n \"BTC\": 0.0778595876,\n \"EUR\": 0.785518,\n \"HKD\": 8.04136\n },\n \"2013-01-02\": {\n \"BTC\": 0.0789400739,\n \"EUR\": 0.795034,\n \"HKD\": 8.138096\n },\n \"2013-01-03\": {\n \"BTC\": 0.0785299961,\n \"EUR\": 0.80092,\n \"HKD\": 8.116954\n },\n /* ... */\n }\n}" } ``` #### Error Response (400) - **error** (boolean) - Indicates if an error occurred. - **status** (integer) - The HTTP status code. - **message** (string) - An error code or message. - **description** (string) - A detailed description of the error. #### Error Response Examples ```json { "example": "{\n \"error\": true,\n \"status\": 400,\n \"message\": \"not_available\",\n \"description\": \"Historical rates for one or more of your requested dates are not available - please try a different date-range, or contact support@openexchangerates.org.\"\n}" } ``` ```json { "example": "{\n \"error\": true,\n \"status\": 400,\n \"message\": \"invalid_date_range\",\n \"description\": \"Invalid date range: `start` and `end` dates must be valid days, in the format 'YYYY-MM-DD'.\"\n}" } ``` ``` -------------------------------- ### Connecting To The API Source: https://docs.openexchangerates.org/reference Details on how to connect to the API, including URL format, request methods, and data formats. ```APIDOC ## Connecting To The API We serve our data in JSON format via a simple URL-based interface over HTTPS, which enables you to use the rates in whichever way you require. **Connection Types** Any language or software that can make HTTP requests or fetch web addresses can access our API (for example, you can visit any of the API routes in your browser to verify they’re working as expected). For your integration, you can use whichever library you require. This will vary depending on your development environment. There are guides and a wide range of open source integrations available, also covered in our documentation. URLs (routes) are requested once over HTTPS, and deliver all their data in one go, just like a normal web request. We do not currently support websockets, webhooks or any other keep-alive or push-notification style connections – in other words, when you want fresh data, you simply request it from our server. We're considering these methods for a future version of our API, so please email us if interested. **URL Format** The API base path is `https://openexchangerates.org/api/`. API routes/endpoints are then appended to this base path, like so: HTTP ``` https://openexchangerates.org/api/ latest.json currencies.json historical/2013-02-16.json ``` Query parameters (such as your App ID, requested base currency, or JSONP callback) are appended as GET request parameters, for example: HTTP ``` https://openexchangerates.org/api/latest.json ?app_id=YOUR_APP_ID &base=GBP &callback=someCallbackFunction ``` If your request is valid and permitted, you will receive a JSON-formatted response to work with. If something is wrong with the request, you will receive an error message. ``` -------------------------------- ### Currencies Endpoint Source: https://docs.openexchangerates.org/index Retrieves a list of all supported currency codes. ```APIDOC ## GET /api/currencies.json ### Description Fetches a list of all supported currency codes and their full names. ### Method GET ### Endpoint `/api/currencies.json` ### Query Parameters - **app_id** (string) - Required - Your unique App ID. - **callback** (string) - Optional - A JavaScript callback function name for JSONP requests. ### Request Example ```json GET https://openexchangerates.org/api/currencies.json?app_id=YOUR_APP_ID ``` ### Response #### Success Response (200) - An object where keys are currency codes (e.g., 'USD') and values are the full currency names (e.g., 'United States Dollar'). #### Response Example ```json { "AED": "United Arab Emirates Dirham", "AFN": "Afghan Afghani", "ALL": "Albanian Lek" } ``` ``` -------------------------------- ### Get Specific Currencies Source: https://docs.openexchangerates.org/reference/get-specific-currencies Retrieve exchange rates for a specified list of currencies. This is useful for minimizing response size and improving performance. ```APIDOC ## GET /api/latest.json ### Description Fetches the latest exchange rates for a specified subset of currencies. ### Method GET ### Endpoint `https://openexchangerates.org/api/latest.json` ### Parameters #### Query Parameters - **app_id** (string) - Required - Your unique application ID. - **symbols** (string) - Optional - A comma-separated list of 3-letter ISO currency codes (e.g., `GBP,EUR,AED,CAD`). Alias: `currencies`. - **base** (string) - Optional - The base currency against which to compare other currencies. Defaults to USD. - **callback** (string) - Optional - A JSONP callback function name. ### Request Example ```http https://openexchangerates.org/api/latest.json?app_id=[[app:app_id]]&symbols=GBP,EUR,AED,CAD ``` ### Response #### Success Response (200) - **disclaimer** (string) - URL to the API's terms of use. - **license** (string) - URL to the API's license. - **timestamp** (integer) - The time at which the rates were generated. - **base** (string) - The base currency for the exchange rates. - **rates** (object) - An object containing currency exchange rates relative to the base currency. Only the requested currencies will be present. #### Response Example ```json { "disclaimer": "https://openexchangerates.org/terms/", "license": "https://openexchangerates.org/license/", "timestamp": 1424127600, "base": "USD", "rates": { "AED": 3.67295, "CAD": 0.99075, "EUR": 0.793903, "GBP": 0.62885 } } ``` ``` -------------------------------- ### Request Bid-Ask Rates using jQuery Source: https://docs.openexchangerates.org/reference/bid-ask-prices Provides a jQuery example for making an API request with the `show_bid_ask` parameter. The response will contain an object with `bid`, `ask`, and `mid` prices for each currency, if available. ```javascript $.get('https://openexchangerates.org/api/latest.json', {app_id: 'YOUR_APP_ID', show_alternative: 1}, function(data) { console.log(data); }); ``` -------------------------------- ### GET /currencies.json Source: https://docs.openexchangerates.org/reference/currencies-json Get a JSON list of all currency symbols available from the Open Exchange Rates API, along with their full names. This list mirrors the currencies available in the latest rates. ```APIDOC ## GET /currencies.json ### Description Retrieves a JSON object containing all available currency symbols and their full names. ### Method GET ### Endpoint /api/currencies.json ### Query Parameters - **show_alternative** (boolean) - Optional - If set to `1` or `true`, includes unofficial, black market, and alternative digital currencies. - **show_inactive** (boolean) - Optional - If set to `1` or `true`, includes historical/inactive currencies. - **prettyprint** (boolean) - Optional - If set to `true`, formats the JSON response for readability. ### Request Example ```http GET https://openexchangerates.org/api/currencies.json?show_alternative=1&prettyprint=true ``` ### Response #### Success Response (200) - **(object)** - A JSON object where keys are currency symbols (e.g., "USD") and values are their full names (e.g., "United States Dollar"). #### Response Example ```json { "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", "BAM": "Bosnia-Herzegovina Convertible Mark", "BBD": "Barbadian Dollar", "BDT": "Bangladeshi Taka", "BGN": "Bulgarian Lev", "BHD": "Bahraini Dinar", "BIF": "Burundian Franc", "BMD": "Bermudan Dollar", "BND": "Brunei Dollar", "BOB": "Bolivian Boliviano", "BRL": "Brazilian Real", "BSD": "Bahamian Dollar", "BTC": "Bitcoin", "BTN": "Bhutanese Ngultrum", "BWP": "Botswanan Pula", "BYN": "Belarusian Ruble", "BYR": "Belarusian Ruble", "BZD": "Belize Dollar", "CAD": "Canadian Dollar", "CDF": "Congolese Franc", "CHF": "Swiss Franc", "CLF": "Chilean Unit of Account (UF)", "CLP": "Chilean Peso", "CNY": "Chinese Yuan", "COP": "Colombian Peso", "CRC": "Costa Rican Colón", "CUC": "Cuban Convertible Peso", "CUP": "Cuban Peso", "CVE": "Cape Verdean Escudo", "CZK": "Czech Republic Koruna", "DJF": "Djiboutian Franc", "DKK": "Danish Krone", "DOP": "Dominican Peso", "DZD": "Algerian Dinar", "EGP": "Egyptian Pound", "ERN": "Eritrean Nakfa", "ETB": "Ethiopian Birr", "EUR": "Euro", "FJD": "Fijian Dollar", "FKP": "Falkland Islands Pound", "GBP": "British Pound Sterling", "GEL": "Georgian Lari", "GGP": "Guernsey Pound", "GHS": "Ghanaian Cedi", "GIP": "Gibraltar Pound", "GMD": "Gambian Dalasi", "GNF": "Guinean Franc", "GTQ": "Guatemalan Quetzal", "GYD": "Guyanaese Dollar", "HKD": "Hong Kong Dollar", "HNL": "Honduran Lempira", "HRK": "Croatian Kuna", "HTG": "Haitian Gourde", "HUF": "Hungarian Forint", "IDR": "Indonesian Rupiah", "ILS": "Israeli New Sheqel", "IMP": "Manx pound", "INR": "Indian Rupee", "IQD": "Iraqi Dinar", "IRR": "Iranian Rial", "ISK": "Icelandic Króna", "JMD": "Jamaican Dollar", "JOD": "Jordanian Dinar", "JPY": "Japanese Yen", "KES": "Kenyan Shilling", "KGS": "Kyrgystani Som", "KHR": "Cambodian Riel", "KMF": "Comorian Franc", "KPW": "North Korean Won", "KRW": "South Korean Won", "KWD": "Kuwaiti Dinar", "KYD": "Cayman Islands Dollar", "KZT": "Kazakhstani Tenge", "LAK": "Laotian Kip", "LBP": "Lebanese Pound", "LKR": "Sri Lankan Rupee", "LRD": "Liberian Dollar", "LSL": "Lesotho Loti", "LTL": "Lithuanian Litas", "LVL": "Latvian Lats", "LYD": "Libyan Dinar", "MAD": "Moroccan Dirham", "MDL": "Moldovan Leu", "MGA": "Malagasy Ariary", "MKD": "Macedonian Denar", "MMK": "Myanma Kyat", "MNT": "Mongolian Tugrik", "MOP": "Macanese Pataca", "MRO": "Mauritanian Ouguiya", "MRU": "Mauritanian Ouguiya", "MUR": "Mauritian Rupee", "MVR": "Maldivian Rufiyaa", "MWK": "Malawian Kwacha", "MXN": "Mexican Peso", "MYR": "Malaysian Ringgit", "MZN": "Mozambican Metical", "NAD": "Namibian Dollar", "NGN": "Nigerian Naira", "NIO": "Nicaraguan Córdoba", "NOK": "Norwegian Krone", "NPR": "Nepalese Rupee", "NZD": "New Zealand Dollar", "OMR": "Omani Rial", "PAB": "Panamanian Balboa", "PEN": "Peruvian Nuevo Sol", "PGK": "Papua New Guinean Kina", "PHP": "Philippine Peso", "PKR": "Pakistani Rupee", "PLN": "Polish Zloty", "PRB": "The Baht", "PYG": "Paraguayan Guarani", "QAR": "Qatari Rial", "RON": "Romanian Leu", "RSD": "Serbian Dinar", "RUB": "Russian Ruble", "RWF": "Rwandan Franc", "SAR": "Saudi Riyal", "SBD": "Solomon Islands Dollar", "SCR": "Seychellois Rupee", "SDG": "Sudanese Pound", "SEK": "Swedish Krona", "SGD": "Singapore Dollar", "SHP": "Saint Helena Pound", "SLL": "Sierra Leonean Leone", "SOS": "Somali Shilling", "SRD": "Surinamese Dollar", "STD": "São Tomé and Príncipe Dobra", "SVC": "Salvadoran Colón", "SYP": "Syrian Pound", "SZL": "Swazi Lilangeni", "THB": "Thai Baht", "TJS": "Tajikistani Somoni", "TMT": "Turkmenistani Manat", "TND": "Tunisian Dinar", "TOP": "Tongan Paʻanga", "TRY": "Turkish Lira", "TTD": "Trinidad and Tobago Dollar", "TWD": "New Taiwan Dollar", "TZS": "Tanzanian Shilling", "UAH": "Ukrainian Hryvnia", "UGX": "Ugandan Shilling", "USD": "United States Dollar", "UYU": "Uruguayan Peso", "UZS": "Uzbekistan Som", "VEF": "Venezuelan Bolívar", "VND": "Vietnamese Dong", "VUV": "Vanuatu Vatu", "WST": "Samoan Tala", "XAF": "CFA Franc BEAC", "XAG": "Silver (troy ounce)", "XAU": "Gold (troy ounce)", "XCD": "East Caribbean Dollar", "XDR": "Special Drawing Rights", "XOF": "CFA Franc BCEAO", "XPF": "CFP Franc", "YER": "Yemeni Rial", "ZAR": "South African Rand", "ZMK": "Zambian Kwacha (pre-2013)", "ZMW": "Malawian Kwacha", "ZWL": "Zimbabwean Dollar" } ``` ### Note Requests to this endpoint do not count towards your account usage limit, and App ID authentication is optional. ``` -------------------------------- ### Latest Rates Endpoint Source: https://docs.openexchangerates.org/index Retrieves the latest foreign exchange rates. ```APIDOC ## GET /api/latest.json ### Description Fetches the latest foreign exchange rates relative to a specified base currency. ### Method GET ### Endpoint `/api/latest.json` ### Query Parameters - **app_id** (string) - Required - Your unique App ID. - **base** (string) - Optional - The base currency (e.g., 'USD', 'EUR'). Defaults to 'USD'. - **symbols** (string) - Optional - A comma-separated list of currency symbols to limit the response to (e.g., 'EUR,GBP'). - **callback** (string) - Optional - A JavaScript callback function name for JSONP requests. ### Request Example ```json GET https://openexchangerates.org/api/latest.json?app_id=YOUR_APP_ID&base=EUR&symbols=USD,GBP ``` ### Response #### Success Response (200) - **base** (string) - The base currency. - **date** (string) - The date of the rates. - **rates** (object) - An object containing currency codes as keys and their corresponding rates as values. #### Response Example ```json { "base": "EUR", "date": "2023-10-27", "rates": { "USD": 1.0709, "GBP": 0.8722 } } ``` ``` -------------------------------- ### Currency Conversion Endpoint Definition (OpenAPI) Source: https://docs.openexchangerates.org/reference/convert Defines the `/convert` endpoint for currency conversion. It requires an `app_id`, conversion `value`, source currency (`from`), and target currency (`to`). It supports an optional `prettyprint` parameter for human-readable output. The response includes conversion details and the exchange rate. ```json { "openapi": "3.1.0", "info": { "title": "api-settings", "version": "0.7" }, "servers": [ { "url": "https://openexchangerates.org/api" } ], "components": { "securitySchemes": { "sec0": { "type": "apiKey", "name": "app_id", "in": "query", "x-default": "" } } }, "security": [ { "sec0": [] } ], "paths": { "/convert/{value}/{from}/{to}": { "get": { "summary": "/convert", "description": "Convert any money value from one currency to another at the latest API rates using the /convert API endpoint.\n\nThis feature works differently to other endpoints in our API, using a REST-based approach and an alternate response format.\n\nCurrency conversion requests are currently available for clients on the Unlimited plan.", "operationId": "convert", "parameters": [ { "name": "app_id", "in": "query", "description": "Your unique App ID (required)", "schema": { "type": "string", "default": "Required" } }, { "name": "value", "in": "path", "description": "The value to be converted", "schema": { "type": "integer", "format": "int32", "default": null }, "required": true }, { "name": "from", "in": "path", "description": "The base ('from') currency (3-letter code)", "schema": { "type": "string", "default": "Required" }, "required": true }, { "name": "to", "in": "path", "description": "The target ('to') currency (3-letter code)", "schema": { "type": "string", "default": "Required" }, "required": true }, { "name": "prettyprint", "in": "query", "description": "Human-readable response for debugging", "schema": { "type": "boolean", "default": false } } ], "responses": { "200": { "description": "200", "content": { "application/json": { "examples": { "Result": { "value": "{\n \"disclaimer\": \"https://openexchangerates.org/terms/\",\n \"license\": \"https://openexchangerates.org/license/\",\n \"request\": {\n \"query\": \"/convert/19999.95/GBP/EUR\",\n \"amount\": 19999.95,\n \"from\": \"GBP\",\n \"to\": \"EUR\"\n },\n \"meta\": {\n \"timestamp\": 1449885661,\n \"rate\": 1.383702\n },\n \"response\": 27673.975864\n}" } }, "schema": { "type": "object", "properties": { "disclaimer": { "type": "string", "example": "https://openexchangerates.org/terms/" }, "license": { "type": "string", "example": "https://openexchangerates.org/license/" }, "request": { "type": "object", "properties": { "query": { "type": "string", "example": "/convert/19999.95/GBP/EUR" }, "amount": { "type": "number", "example": 19999.95, "default": 0 }, "from": { "type": "string", "example": "GBP" }, "to": { "type": "string", "example": "EUR" } } }, "meta": { "type": "object", "properties": { "timestamp": { "type": "integer", "example": 1449885661, "default": 0 }, "rate": { "type": "number", "example": 1.383702, "default": 0 } } }, "response": { "type": "number", "example": 27673.975864, "default": 0 } } } } } } } } } } } ``` -------------------------------- ### GET /api/historical/{date}.json Source: https://docs.openexchangerates.org/reference Fetches historical foreign exchange rates for a specific date. ```APIDOC ## GET /api/historical/{date}.json ### Description Fetches historical foreign exchange rates for a specific date. End-of-day rates are available historically for all days going back to 1st January, 1999. ### Method GET ### Endpoint `/api/historical/{date}.json` ### Parameters #### Path Parameters - **date** (string) - Required - The date for which to retrieve rates, in 'YYYY-MM-DD' format. #### Query Parameters - **app_id** (string) - Required - Your unique App ID. - **base** (string) - Optional - The base currency (e.g., 'USD', 'EUR'). Defaults to 'USD'. - **symbols** (string) - Optional - A comma-separated list of currency symbols to include in the response. - **callback** (string) - Optional - A JSONP callback function name. ### Request Example ```json { "example": "https://openexchangerates.org/api/historical/2013-02-16.json?app_id=YOUR_APP_ID&base=GBP" } ``` ### Response #### Success Response (200) - **base** (string) - The base currency. - **date** (string) - The requested date. - **historical_date** (string) - The date for which the rates are provided. - **rates** (object) - An object containing currency codes as keys and their corresponding rates as values for the specified date. #### Response Example ```json { "base": "GBP", "date": "2013-02-16", "historical_date": "2013-02-16", "rates": { "USD": 1.532, "EUR": 1.175, "JPY": 144.38 } } ``` ``` -------------------------------- ### Supported Currencies List Source: https://docs.openexchangerates.org/reference/supported-currencies Fetches a JSON list of all currencies currently supported by the Open Exchange Rates API. ```APIDOC ## GET /currencies.json ### Description Retrieves a JSON formatted list of all currencies that are currently supported by the Open Exchange Rates API. This list is based on the latest updated data. ### Method GET ### Endpoint /currencies.json ### Parameters None ### Request Example None ### Response #### Success Response (200) - **currency_code** (string) - The ISO 4217 currency code (e.g., "USD", "EUR"). - **currency_name** (string) - The full name of the currency (e.g., "United States Dollar", "Euro"). #### Response Example ```json { "AED": { "currency_name": "United Arab Emirates Dirham", "currency_symbol": "د.إ", "currency_minor_unit": 2 }, "AFN": { "currency_name": "Afghan Afghani", "currency_symbol": "؋", "currency_minor_unit": 2 } } ``` ``` -------------------------------- ### Get API Usage Information (HTTP) Source: https://docs.openexchangerates.org/reference/usage-json This snippet shows how to request your current API usage status from Open Exchange Rates using an HTTP GET request. Replace 'YOUR_APP_ID' with your actual application ID. This endpoint provides details on requests made, quotas, and remaining allowances. ```http https://openexchangerates.org/api/usage.json?app_id=YOUR_APP_ID ``` -------------------------------- ### Get Latest Exchange Rates (JavaScript) Source: https://docs.openexchangerates.org/reference/latest-json This JavaScript snippet uses jQuery's $.get method to retrieve the latest exchange rates. It sends a GET request to the API endpoint, including your App ID. The response is a JSON object containing currency conversion rates, which can then be processed in your application. ```javascript $.get('https://openexchangerates.org/api/latest.json', {app_id: 'YOUR_APP_ID'}, function(data) { console.log(data); }); ``` -------------------------------- ### Request Bid-Ask Rates via HTTP Source: https://docs.openexchangerates.org/reference/bid-ask-prices Demonstrates how to append the `show_bid_ask` query parameter to an API request to retrieve bid, ask, and mid prices. This replaces the standard midpoint rate with detailed bid/ask information where available. ```http https://openexchangerates.org/api/latest.json ?app_id=YOUR_APP_ID &show_bid_ask=1 ```