swagger: "2.0"
schemes:
  - https
  - http
host: api.quarantine.country
basePath: /api/v1
info:
  contact:
    email: api+covid19@h7.org
  description: Coronavirus API with free COVID-19 live updates. The best free coronavirus API and COVID-19 update source. Programmatically access live corona virus updates for statistics with historical data, maps, charts, graphs. COVID-19 API and corona virus live updates.
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  termsOfService: https://quarantine.country/coronavirus/api/privacy.html
  title: Coronavirus API
  version: "1.0"
  x-apisguru-categories:
    - open_data
  x-origin:
    - format: swagger
      url: https://quarantine.country/coronavirus/api/swagger.json
      version: "2.0"
  x-providerName: quarantine.country
externalDocs:
  description: Find out more about Swagger
  url: http://swagger.io
tags:
  - description: Latest data
    name: summary
  - description: Chart data
    name: spot
paths:
  /spots/day:
    get:
      parameters:
        - description: Region short name
          in: query
          name: region
          required: true
          type: string
        - default: Today
          description: Date to query spots on
          in: query
          name: date
          type: string
      produces:
        - application/json
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/SpotsResponse"
        "404":
          description: Unknown region
      summary: Resolve change chart by day
      tags:
        - spot
  /spots/month:
    get:
      parameters:
        - description: Region short name
          in: query
          name: region
          required: true
          type: string
        - default: Today
          description: Date to query spots on
          in: query
          name: date
          type: string
      produces:
        - application/json
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/SpotsResponse"
        "404":
          description: Unknown region
      summary: Resolve change chart for week
      tags:
        - spot
  /spots/week:
    get:
      parameters:
        - description: Region short name
          in: query
          name: region
          required: true
          type: string
        - default: Today
          description: Date to query spots on
          in: query
          name: date
          type: string
      produces:
        - application/json
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/SpotsResponse"
        "404":
          description: Unknown region
      summary: Resolve change chart for week
      tags:
        - spot
  /spots/year:
    get:
      parameters:
        - description: Region short name
          in: query
          name: region
          required: true
          type: string
        - default: Today
          description: Date to query spots on
          in: query
          name: date
          type: string
      produces:
        - application/json
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/SpotsResponse"
        "404":
          description: Unknown region
      summary: Resolve change chart for week
      tags:
        - spot
  /summary/latest:
    get:
      description: ""
      parameters:
        - default: today
          description: Date of the report
          in: query
          name: date
          type: string
      produces:
        - application/json
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/ReportResponse"
      summary: Get latest coronavirus situation report
      tags:
        - summary
  /summary/region:
    get:
      parameters:
        - description: Region short name
          in: query
          name: region
          required: true
          type: string
        - default: today
          description: Date of the report
          in: query
          name: date
          type: string
      produces:
        - application/json
      responses:
        "200":
          description: Success
          schema:
            $ref: "#/definitions/ReportResponse"
        "404":
          description: Region does not exist
      summary: Resolve report for region
      tags:
        - summary
definitions:
  Report:
    properties:
      active_cases:
        title: Active cases number
        type: integer
      change:
        $ref: "#/definitions/Report"
        title: Change over previous day
        type: object
      death_ratio:
        description: Dead / Total cases
        title: Death ratio
        type: number
      deaths:
        title: Deaths number
        type: integer
      name:
        title: Region name
        type: string
      recovered":
        title: Recovered cases number
        type: integer
      recovery_ratio:
        description: Recovered / Total cases
        title: Recovery ratio
        type: number
      total_cases:
        title: Total registered cases
        type: integer
    type: object
  ReportResponse:
    properties:
      data:
        properties:
          change:
            $ref: "#/definitions/Report"
            description: Change over previous day
            type: object
          generated_on:
            description: Timestamp report been updated at
            type: integer
          regions:
            additionalProperties:
              $ref: "#/definitions/Report"
              type: object
            example:
              switzerland:
                active_cases: 12585
                change:
                  active_cases: -143
                  death_ratio: 0.0015511152363255273
                  deaths: 74
                  recovered: 1096
                  recovery_ratio: 0.02982392582150012
                  total_cases: 1027
                death_ratio: 0.038445017182130586
                deaths: 895
                name: switzerland
                recovered: 9800
                recovery_ratio: 0.4209621993127148
                total_cases: 23280
            type: object
          summary:
            $ref: "#/definitions/Report"
            description: Summary data for date
            type: object
        type: object
      status:
        format: int8
        type: integer
      type:
        enum:
          - stack
          - collection
          - pagination
        type: string
    type: object
  SpotsResponse:
    properties:
      data:
        additionalProperties:
          $ref: "#/definitions/Report"
          type: object
        example:
          2020-04-09 12:20:00:
            death_ratio: 0.040285703944113994
            deaths: 3339
            recovered: 77678
            recovery_ratio: 0.937200632216498
            total_cases: 82883
          2020-04-09 12:40:00:
            death_ratio: 0.040285703944113994
            deaths: 3339
            recovered: 77678
            recovery_ratio: 0.937200632216498
            total_cases: 82883
        type: object
      status:
        format: int8
        type: integer
      type:
        enum:
          - stack
          - collection
          - pagination
        type: string
    type: object
