Formicka / exchangerate.host

Exchange rates API is a simple and lightweight free service for current and historical foreign exchange rates & crypto exchange rates.
https://exchangerate.host
353 stars 33 forks source link

Feature: OpenApi support #117

Open sommmen opened 2 years ago

sommmen commented 2 years ago

Hiya,

I'd love support for OpenApi3 so i can easily write a client for c#.

https://swagger.io/

I'm a .NET dev and for ASP.NET the most common web tech theres tooling to auto generate openapi3 documents. Clients for various languages can then be created from that document and consuming apis is now both fun and easy.

Perhaps we could a) write and maintain an openApi document or b) auto enerate it - but im unsure if thats possible since i don't know the current toolchain.

arzzen commented 2 years ago

Hi @sommmen it will be very nice from you, if you can create openapi doc, I appreciate it

sommmen commented 2 years ago

Hi @sommmen it will be very nice from you, if you can create openapi doc, I appreciate it

Hiya - i'm currently in need of the /timeseries api so i will be writing an api doc for that. Was hoping you could just generate the open api document from the server code but here's a sample doc that i worked on:

Large yaml openapi3 doc ``` yaml openapi: 3.0.1 info: title: exchangerate.host description: https://exchangerate.host/ api doc by sommmen version: '1.0' termsOfService: https://exchangerate.host/ contact: url: https://exchangerate.host/ servers: - url: https://api.exchangerate.host paths: /{date}: get: description: Historical rates are available for most currencies all the way back to the year of 1999. You can query the API for historical rates by appending a date (format YYYY-MM-DD) to the base URL. parameters: - name: date in: path required: true schema: type: string format: date example: 2021-03-03 - name: amount in: query schema: type: string example: '123' - name: places in: query schema: type: string example: '5' - name: format in: query allowEmptyValue: true schema: type: string - name: callback in: query allowEmptyValue: true schema: type: string - name: source in: query allowEmptyValue: true schema: type: string - name: symbols in: query schema: type: string example: USD,GBP,EUR - name: base in: query schema: type: string example: EUR responses: '200': description: Auto generated using Swagger Inspector content: application/json; charset=utf-8: schema: type: string examples: {} servers: - url: https://api.exchangerate.host summary: Historical rates. servers: - url: https://api.exchangerate.host /symbols: get: description: |+ API comes with a constantly updated endpoint returning all available currencies. To access this list, make a request to the API's symbols endpoint. parameters: - name: format in: query allowEmptyValue: true schema: type: string - name: callback in: query allowEmptyValue: true schema: type: string responses: '200': description: Auto generated using Swagger Inspector servers: - url: https://api.exchangerate.host summary: All available currencies. servers: - url: https://api.exchangerate.host /vat_rates: get: description: Our accurate EU VAT information API simplifies in and around the European Union. Request a single by country code or entire set EU VAT rates. parameters: - name: format in: query allowEmptyValue: true schema: type: string - name: callback in: query allowEmptyValue: true schema: type: string - name: symbols in: query schema: type: string example: EUR,CGBP responses: '200': description: Auto generated using Swagger Inspector content: application/json; charset=utf-8: schema: type: string examples: {} servers: - url: https://api.exchangerate.host summary: Request a single by country code or entire set EU VAT rates. servers: - url: https://api.exchangerate.host /fluctuation: get: description: Using the fluctuation endpoint you will be able to retrieve information about how currencies fluctuate on a day-to-day basis. To use this feature, simply append a start_date and end_date and choose which currencies (symbols) you would like to query the API for. Please note that the maximum allowed timeframe is 366 days. parameters: - name: end_date in: query schema: type: string example: '2020-01-04' - name: amount in: query schema: type: string example: '10' - name: places in: query allowEmptyValue: true schema: type: string - name: format in: query allowEmptyValue: true schema: type: string - name: callback in: query allowEmptyValue: true schema: type: string - name: source in: query allowEmptyValue: true schema: type: string - name: symbols in: query schema: type: string example: GBP,CEUR,CUSD - name: start_date in: query schema: type: string example: '2020-01-01' - name: base in: query schema: type: string example: EUR responses: '200': description: Auto generated using Swagger Inspector content: application/json; charset=utf-8: schema: type: string examples: {} servers: - url: https://api.exchangerate.host summary: How currencies fluctuate on a day-to-day basis. servers: - url: https://api.exchangerate.host /convert: get: description: Currency conversion endpoint, can be used to convert any amount from one currency to another. In order to convert currencies, please use the API's convert endpoint, append the from and to parameters and set them to your preferred base and target currency codes. parameters: - name: date in: query schema: type: string example: '2022-03-10' - name: amount in: query schema: type: string example: '10' - name: places in: query schema: type: string example: '3' - name: format in: query allowEmptyValue: true schema: type: string - name: callback in: query allowEmptyValue: true schema: type: string - name: from in: query schema: type: string example: GBP - name: to in: query schema: type: string example: EURASD - name: source in: query allowEmptyValue: true schema: type: string - name: symbols in: query schema: type: string example: GBP,CEUR,CCZK - name: base in: query schema: type: string example: EUR responses: '200': description: Auto generated using Swagger Inspector content: application/json; charset=utf-8: schema: type: string examples: {} servers: - url: https://api.exchangerate.host summary: Convert any amount from one currency to another. servers: - url: https://api.exchangerate.host /latest: get: description: Get the latest foreign exchange reference rates. Latest endpoint will return exchange rate data updated on daily basis. parameters: - name: amount in: query schema: type: string example: '1200' - name: places in: query schema: type: string example: '2' - name: format in: query allowEmptyValue: true schema: type: string - name: callback in: query allowEmptyValue: true schema: type: string - name: source in: query allowEmptyValue: true schema: type: string - name: symbols in: query schema: type: string example: USD,CEUR,CCZK,CGBP - name: base in: query schema: type: string example: USD responses: '200': description: Auto generated using Swagger Inspector content: application/json; charset=utf-8: schema: type: string examples: {} servers: - url: https://api.exchangerate.host summary: Exchange rate data updated on daily basis servers: - url: https://api.exchangerate.host /timeseries: get: description: 'Timeseries endpoint are for daily historical rates between two dates of your choice, with a maximum time frame of 366 days.' parameters: - name: start_date description: The start date of your preferred timeframe. required: true in: query schema: type: string format: date-time example: '2020-01-01' - name: end_date description: The end date of your preferred timeframe. required: true in: query schema: type: string format: date-time example: '2020-12-31' - name: amount description: The amount to be converted. in: query allowEmptyValue: true required: false schema: type: number example: 1200 - name: places description: Round numbers to decimal place in: query allowEmptyValue: true required: false schema: type: integer example: 2 - name: format description: If response success, then you can format output to XML, CSV or TSV. in: query allowEmptyValue: true required: false schema: type: string examples: xml: value: 'xml' summary: XML format csv: value: 'csv' summary: CSV format tsv: value: 'tsv' summary: TSV format - name: callback description: API comes with support for JSONP Callbacks. This feature enables you to specify a function name, pass it into the API's callback GET parameter and cause the API to return your requested API response wrapped inside that function. in: query allowEmptyValue: true required: false schema: type: string - name: source description: You can switch source data between (default) forex, bank view or crypto currencies. in: query allowEmptyValue: true required: false schema: type: string examples: ecb: value: 'ecb' summary: example of European Central Bank source crypto: value: 'crypto' summary: example of Crypto currencies source - name: symbols description: Enter a list of comma-separated currency codes to limit output currencies. in: query allowEmptyValue: true required: false schema: type: string example: 'USD,EUR,GBP' - name: base description: 'Changing base currency. Enter the three-letter currency code of your preferred base currency.' in: query allowEmptyValue: true schema: type: string example: 'EUR' responses: '200': description: Succesful json response content: application/json; charset=utf-8: schema: $ref: '#/components/schemas/TimeSeriesResponse' example: motd: msg: If you or your company use this project or like what we doing, please consider backing us so we can continue maintaining and evolving this project. url: https://exchangerate.host/#/donate success: true timeseries: true base: EUR start_date: '2020-01-01' end_date: '2020-01-02' rates: '2020-01-01': USD: 1346.52 GBP: 1015.44 '2020-01-02': USD: 1346.52 GBP: 1015.92 servers: - url: https://api.exchangerate.host summary: Daily historical rates between two dates of your choice. servers: - url: https://api.exchangerate.host externalDocs: description: https://exchangerate.host/ url: https://exchangerate.host/ components: schemas: TimeSeriesResponse: type: object properties: motd: type: object properties: msg: type: string example: If you or your company use this project or like what we doing please consider backing us so we can continue maintaining and evolving this project. url: type: string example: https://exchangerate.host/#/donate success: type: boolean example: true timeseries: type: boolean example: true base: type: string example: 'EUR' start_date: type: string format: date-time example: '2020-01-01' end_date: type: string format: date-time example: '2020-01-02' rates: type: object additionalProperties: $ref: '#/components/schemas/TimeSeriesRateResponse' TimeSeriesRateResponse: type: object additionalProperties: type: number description: 'Rate value' example: '1015.92' ```

https://app.swaggerhub.com/apis/sommmen/exchangerate.host/1.0

I used Swagger inspector of smartbear to get the initial api document off. Then using swaggerhub I added the samples and some descriptions by hand.

I then used https://roger13.github.io/SwagDefGen/ to take the json response objects and make them into a yaml schema. I had to hand tailor them because dictionary (maps) were converted to objects (and not dictionaries) for the rates.

Open api docs are here: https://swagger.io/docs/specification/paths-and-operations/

Anyways from then on the api generation part seems to work for a c# client (using NSwag):

image

Anyways i'm working on customer project right now so my focus will be purely on the timeseries api but if i have time i may expand on the rest of the endpoints.

EDIT: still working on the doc - now added most params and endpoints, now need to work on adding the responses. EDIT2: not a lot of free time unfortunately. tbc in the future.

sommmen commented 11 months ago

It seems the api for exchangerate.host was changed. The 'old' api is now known as the 'fixer' api from ApiLayer it seems. Therefore i updated the document to now point to apilayer and it seems to work fine as is now.

Large yaml openapi3 doc ``` yaml # NOTE 02102023 It seems that as of July 2023 exchangerate.host was changed or taken over by api layer. # The 'old' api seems to be the same as api layers 'fixer' api we use now. See: https://apilayer.com/marketplace/fixer-api --- openapi: 3.0.1 info: title: exchangerate.host description: https://exchangerate.host/ api doc by sommmen termsOfService: https://exchangerate.host/ contact: url: https://exchangerate.host/ version: "1.0" externalDocs: description: https://exchangerate.host/ url: https://exchangerate.host/ servers: - url: https://api.apilayer.com/fixer security: - ApiKeyAuth: [] # Apply the API key globally to all operations paths: /{date}: get: summary: Historical rates. description: Historical rates are available for most currencies all the way back to the year of 1999. You can query the API for historical rates by appending a date (format YYYY-MM-DD) to the base URL. parameters: - name: date in: path required: true style: simple explode: false schema: type: string format: date example: 2022-03-03 - name: base in: query description: Changing base currency. Enter the three-letter currency code of your preferred base currency. required: false allowEmptyValue: true style: form explode: true schema: type: string example: EUR - name: symbols in: query description: Enter a list of comma-separated currency codes to limit output currencies. required: false allowEmptyValue: true style: form explode: true schema: type: string example: USD,EUR,GBP - name: amount in: query description: The amount to be converted. required: false allowEmptyValue: true style: form explode: true schema: type: number example: 1200 - name: callback in: query description: API comes with support for JSONP Callbacks. This feature enables you to specify a function name, pass it into the API's callback GET parameter and cause the API to return your requested API response wrapped inside that function. required: false allowEmptyValue: true style: form explode: true schema: type: string - name: places in: query description: Round numbers to decimal place required: false allowEmptyValue: true style: form explode: true schema: type: integer example: 2 - name: format in: query description: If response success, then you can format output to XML, CSV or TSV. required: false allowEmptyValue: true style: form explode: true schema: type: string examples: xml: summary: XML format value: xml csv: summary: CSV format value: csv tsv: summary: TSV format value: tsv - name: source in: query description: You can switch source data between (default) forex, bank view or crypto currencies. required: false allowEmptyValue: true style: form explode: true schema: type: string examples: ecb: summary: example of European Central Bank source value: ecb crypto: summary: example of Crypto currencies source value: crypto responses: "200": description: OK headers: X-RateLimit-Limit: description: Request limit per hour. style: simple explode: false schema: type: integer X-RateLimit-Remaining: description: The number of requests left for the time window. style: simple explode: false schema: type: integer content: application/json; charset=utf-8: schema: $ref: '#/components/schemas/HistoricalRatesResponse' example: motd: msg: If you or your company use this project or like what we doing, please consider backing us so we can continue maintaining and evolving this project. url: http://exchangerate.host/#/donate success: true historical: true base: EUR date: 2022-03-03 rates: EUR: 1200 GBP: 994.61 USD: 1327.5 servers: - url: https://api.apilayer.com/fixer servers: - url: https://api.apilayer.com/fixer /symbols: get: summary: All available currencies. description: API comes with a constantly updated endpoint returning all available currencies. To access this list, make a request to the API's symbols endpoint. parameters: - name: callback in: query description: API comes with support for JSONP Callbacks. This feature enables you to specify a function name, pass it into the API's callback GET parameter and cause the API to return your requested API response wrapped inside that function. required: false allowEmptyValue: true style: form explode: true schema: type: string - name: format in: query description: If response success, then you can format output to XML, CSV or TSV. required: false allowEmptyValue: true style: form explode: true schema: type: string examples: xml: summary: XML format value: xml csv: summary: CSV format value: csv tsv: summary: TSV format value: tsv responses: "200": description: OK headers: X-RateLimit-Limit: description: Request limit per hour. style: simple explode: false schema: type: integer X-RateLimit-Remaining: description: The number of requests left for the time window. style: simple explode: false schema: type: integer servers: - url: https://api.apilayer.com/fixer servers: - url: https://api.apilayer.com/fixer /vat_rates: get: summary: Request a single by country code or entire set EU VAT rates. description: Our accurate EU VAT information API simplifies in and around the European Union. Request a single by country code or entire set EU VAT rates. parameters: - name: symbols in: query description: Enter a list of comma-separated currency codes to limit output currencies. required: false allowEmptyValue: true style: form explode: true schema: type: string example: USD,EUR,GBP - name: callback in: query description: API comes with support for JSONP Callbacks. This feature enables you to specify a function name, pass it into the API's callback GET parameter and cause the API to return your requested API response wrapped inside that function. required: false allowEmptyValue: true style: form explode: true schema: type: string - name: format in: query description: If response success, then you can format output to XML, CSV or TSV. required: false allowEmptyValue: true style: form explode: true schema: type: string examples: xml: summary: XML format value: xml csv: summary: CSV format value: csv tsv: summary: TSV format value: tsv responses: "200": description: OK headers: X-RateLimit-Limit: description: Request limit per hour. style: simple explode: false schema: type: integer X-RateLimit-Remaining: description: The number of requests left for the time window. style: simple explode: false schema: type: integer content: text/plain: schema: type: string example: TODO add response json schena! servers: - url: https://api.apilayer.com/fixer servers: - url: https://api.apilayer.com/fixer /fluctuation: get: summary: How currencies fluctuate on a day-to-day basis. description: Using the fluctuation endpoint you will be able to retrieve information about how currencies fluctuate on a day-to-day basis. To use this feature, simply append a start_date and end_date and choose which currencies (symbols) you would like to query the API for. Please note that the maximum allowed timeframe is 366 days. parameters: - name: end_date in: query required: true style: form explode: true schema: type: string format: date example: 2020-01-04 - name: start_date in: query required: true style: form explode: true schema: type: string format: date example: 2020-01-01 - name: base in: query description: Changing base currency. Enter the three-letter currency code of your preferred base currency. required: false allowEmptyValue: true style: form explode: true schema: type: string example: EUR - name: symbols in: query description: Enter a list of comma-separated currency codes to limit output currencies. required: false allowEmptyValue: true style: form explode: true schema: type: string example: USD,EUR,GBP - name: amount in: query description: The amount to be converted. required: false allowEmptyValue: true style: form explode: true schema: type: number example: 1200 - name: callback in: query description: API comes with support for JSONP Callbacks. This feature enables you to specify a function name, pass it into the API's callback GET parameter and cause the API to return your requested API response wrapped inside that function. required: false allowEmptyValue: true style: form explode: true schema: type: string - name: places in: query description: Round numbers to decimal place required: false allowEmptyValue: true style: form explode: true schema: type: integer example: 2 - name: format in: query description: If response success, then you can format output to XML, CSV or TSV. required: false allowEmptyValue: true style: form explode: true schema: type: string examples: xml: summary: XML format value: xml csv: summary: CSV format value: csv tsv: summary: TSV format value: tsv - name: source in: query description: You can switch source data between (default) forex, bank view or crypto currencies. required: false allowEmptyValue: true style: form explode: true schema: type: string examples: ecb: summary: example of European Central Bank source value: ecb crypto: summary: example of Crypto currencies source value: crypto responses: "200": description: OK headers: X-RateLimit-Limit: description: Request limit per hour. style: simple explode: false schema: type: integer X-RateLimit-Remaining: description: The number of requests left for the time window. style: simple explode: false schema: type: integer content: text/plain: schema: type: string example: TODO add response json schena! servers: - url: https://api.apilayer.com/fixer servers: - url: https://api.apilayer.com/fixer /convert: get: summary: Convert any amount from one currency to another. description: Currency conversion endpoint, can be used to convert any amount from one currency to another. In order to convert currencies, please use the API's convert endpoint, append the from and to parameters and set them to your preferred base and target currency codes. parameters: - name: date in: query required: false style: form explode: true schema: type: string format: date example: 2022-03-10 - name: from in: query required: false style: form explode: true schema: type: string example: GBP - name: to in: query required: false style: form explode: true schema: type: string example: EUR - name: base in: query description: Changing base currency. Enter the three-letter currency code of your preferred base currency. required: false allowEmptyValue: true style: form explode: true schema: type: string example: EUR - name: symbols in: query description: Enter a list of comma-separated currency codes to limit output currencies. required: false allowEmptyValue: true style: form explode: true schema: type: string example: USD,EUR,GBP - name: amount in: query description: The amount to be converted. required: false allowEmptyValue: true style: form explode: true schema: type: number example: 1200 - name: callback in: query description: API comes with support for JSONP Callbacks. This feature enables you to specify a function name, pass it into the API's callback GET parameter and cause the API to return your requested API response wrapped inside that function. required: false allowEmptyValue: true style: form explode: true schema: type: string - name: places in: query description: Round numbers to decimal place required: false allowEmptyValue: true style: form explode: true schema: type: integer example: 2 - name: format in: query description: If response success, then you can format output to XML, CSV or TSV. required: false allowEmptyValue: true style: form explode: true schema: type: string examples: xml: summary: XML format value: xml csv: summary: CSV format value: csv tsv: summary: TSV format value: tsv - name: source in: query description: You can switch source data between (default) forex, bank view or crypto currencies. required: false allowEmptyValue: true style: form explode: true schema: type: string examples: ecb: summary: example of European Central Bank source value: ecb crypto: summary: example of Crypto currencies source value: crypto responses: "200": description: OK headers: X-RateLimit-Limit: description: Request limit per hour. style: simple explode: false schema: type: integer X-RateLimit-Remaining: description: The number of requests left for the time window. style: simple explode: false schema: type: integer content: text/plain: schema: type: string example: TODO add response json schena! servers: - url: https://api.apilayer.com/fixer servers: - url: https://api.apilayer.com/fixer /latest: get: summary: Exchange rate data updated on daily basis description: Get the latest foreign exchange reference rates. Latest endpoint will return exchange rate data updated on daily basis. parameters: - name: base in: query description: Changing base currency. Enter the three-letter currency code of your preferred base currency. required: false allowEmptyValue: true style: form explode: true schema: type: string example: EUR - name: symbols in: query description: Enter a list of comma-separated currency codes to limit output currencies. required: false allowEmptyValue: true style: form explode: true schema: type: string example: USD,EUR,GBP - name: amount in: query description: The amount to be converted. required: false allowEmptyValue: true style: form explode: true schema: type: number example: 1200 - name: callback in: query description: API comes with support for JSONP Callbacks. This feature enables you to specify a function name, pass it into the API's callback GET parameter and cause the API to return your requested API response wrapped inside that function. required: false allowEmptyValue: true style: form explode: true schema: type: string - name: places in: query description: Round numbers to decimal place required: false allowEmptyValue: true style: form explode: true schema: type: integer example: 2 - name: format in: query description: If response success, then you can format output to XML, CSV or TSV. required: false allowEmptyValue: true style: form explode: true schema: type: string examples: xml: summary: XML format value: xml csv: summary: CSV format value: csv tsv: summary: TSV format value: tsv - name: source in: query description: You can switch source data between (default) forex, bank view or crypto currencies. required: false allowEmptyValue: true style: form explode: true schema: type: string examples: ecb: summary: example of European Central Bank source value: ecb crypto: summary: example of Crypto currencies source value: crypto responses: "200": description: OK headers: X-RateLimit-Limit: description: Request limit per hour. style: simple explode: false schema: type: integer X-RateLimit-Remaining: description: The number of requests left for the time window. style: simple explode: false schema: type: integer content: text/plain: schema: type: string example: TODO add response json schena! servers: - url: https://api.apilayer.com/fixer servers: - url: https://api.apilayer.com/fixer /timeseries: get: summary: Daily historical rates between two dates of your choice. description: Timeseries endpoint are for daily historical rates between two dates of your choice, with a maximum time frame of 366 days. parameters: - name: start_date in: query description: The start date of your preferred timeframe. required: true style: form explode: true schema: type: string format: date example: 2020-01-01 - name: end_date in: query description: The end date of your preferred timeframe. required: true style: form explode: true schema: type: string format: date example: 2020-12-31 - name: base in: query description: Changing base currency. Enter the three-letter currency code of your preferred base currency. required: false allowEmptyValue: true style: form explode: true schema: type: string example: EUR - name: symbols in: query description: Enter a list of comma-separated currency codes to limit output currencies. required: false allowEmptyValue: true style: form explode: true schema: type: string example: USD,EUR,GBP - name: amount in: query description: The amount to be converted. required: false allowEmptyValue: true style: form explode: true schema: type: number example: 1200 - name: callback in: query description: API comes with support for JSONP Callbacks. This feature enables you to specify a function name, pass it into the API's callback GET parameter and cause the API to return your requested API response wrapped inside that function. required: false allowEmptyValue: true style: form explode: true schema: type: string - name: places in: query description: Round numbers to decimal place required: false allowEmptyValue: true style: form explode: true schema: type: integer example: 2 - name: format in: query description: If response success, then you can format output to XML, CSV or TSV. required: false allowEmptyValue: true style: form explode: true schema: type: string examples: xml: summary: XML format value: xml csv: summary: CSV format value: csv tsv: summary: TSV format value: tsv - name: source in: query description: You can switch source data between (default) forex, bank view or crypto currencies. required: false allowEmptyValue: true style: form explode: true schema: type: string examples: ecb: summary: example of European Central Bank source value: ecb crypto: summary: example of Crypto currencies source value: crypto responses: "200": description: OK headers: X-RateLimit-Limit: description: Request limit per hour. style: simple explode: false schema: type: integer X-RateLimit-Remaining: description: The number of requests left for the time window. style: simple explode: false schema: type: integer content: application/json; charset=utf-8: schema: $ref: '#/components/schemas/TimeSeriesResponse' example: motd: msg: If you or your company use this project or like what we doing, please consider backing us so we can continue maintaining and evolving this project. url: https://exchangerate.host/#/donate success: true timeseries: true base: EUR start_date: 2020-01-01 end_date: 2020-01-02 rates: "2020-01-01": USD: 1346.52 GBP: 1015.44 "2020-01-02": USD: 1346.52 GBP: 1015.92 servers: - url: https://api.apilayer.com/fixer servers: - url: https://api.apilayer.com/fixer /sources: get: summary: List of bank sources description: List of bank sources (see the common source parameter) parameters: [] responses: "200": description: OK headers: X-RateLimit-Limit: description: Request limit per hour. style: simple explode: false schema: type: integer X-RateLimit-Remaining: description: The number of requests left for the time window. style: simple explode: false schema: type: integer servers: - url: https://api.apilayer.com/fixer servers: - url: https://api.apilayer.com/fixer /cryptocurrencies: get: summary: List of crypto currencies description: List of crypto currencies (see the common source parameter) parameters: [] responses: "200": description: OK headers: X-RateLimit-Limit: description: Request limit per hour. style: simple explode: false schema: type: integer X-RateLimit-Remaining: description: The number of requests left for the time window. style: simple explode: false schema: type: integer servers: - url: https://api.apilayer.com/fixer servers: - url: https://api.apilayer.com/fixer components: securitySchemes: ApiKeyAuth: # arbitrary name for the security scheme type: apiKey in: header # can be "header", "query" or "cookie" name: apikey # name of the header, query parameter or cookie schemas: TimeSeriesResponse: type: object properties: motd: $ref: '#/components/schemas/TimeSeriesResponse_motd' success: type: boolean example: true timeseries: type: boolean example: true base: type: string example: EUR start_date: type: string format: date example: 2020-01-01 end_date: type: string format: date example: 2020-01-02 rates: type: object additionalProperties: $ref: '#/components/schemas/TimeSeriesRateResponse' TimeSeriesRateResponse: type: object additionalProperties: type: number description: Rate value example: 1015.92 HistoricalRatesResponse: type: object properties: motd: $ref: '#/components/schemas/TimeSeriesResponse_motd' success: type: boolean historical: type: boolean base: type: string example: EUR date: type: string format: date rates: type: object additionalProperties: type: number description: Rate value example: 1015.92 TimeSeriesResponse_motd: type: object properties: msg: type: string example: If you or your company use this project or like what we doing please consider backing us so we can continue maintaining and evolving this project. url: type: string example: https://exchangerate.host/#/donate example: null parameters: baseParam: name: base in: query description: Changing base currency. Enter the three-letter currency code of your preferred base currency. required: false allowEmptyValue: true style: form explode: true schema: type: string example: EUR symbolsParam: name: symbols in: query description: Enter a list of comma-separated currency codes to limit output currencies. required: false allowEmptyValue: true style: form explode: true schema: type: string example: USD,EUR,GBP amountParam: name: amount in: query description: The amount to be converted. required: false allowEmptyValue: true style: form explode: true schema: type: number example: 1200 callbackParam: name: callback in: query description: API comes with support for JSONP Callbacks. This feature enables you to specify a function name, pass it into the API's callback GET parameter and cause the API to return your requested API response wrapped inside that function. required: false allowEmptyValue: true style: form explode: true schema: type: string placesParam: name: places in: query description: Round numbers to decimal place required: false allowEmptyValue: true style: form explode: true schema: type: integer example: 2 formatParam: name: format in: query description: If response success, then you can format output to XML, CSV or TSV. required: false allowEmptyValue: true style: form explode: true schema: type: string examples: xml: summary: XML format value: xml csv: summary: CSV format value: csv tsv: summary: TSV format value: tsv sourceParam: name: source in: query description: You can switch source data between (default) forex, bank view or crypto currencies. required: false allowEmptyValue: true style: form explode: true schema: type: string examples: ecb: summary: example of European Central Bank source value: ecb crypto: summary: example of Crypto currencies source value: crypto ```

https://app.swaggerhub.com/apis/sommmen/exchangerate.host/1.0