openapi: 3.0.0
servers:
  - url: https://api.openuv.io/api/{version}
    variables:
      version:
        default: v1
info:
  description: The missing minimalistic JSON real-time UV Index API for awesome Developers, Innovators and Smart Home Enthusiasts
  title: OpenUV - Global Real-Time UV Index Forecast API
  version: v1
  x-origin:
    - format: openapi
      url: https://gist.githubusercontent.com/MikeRalphson/77bb693d4cf9213909527b9cc4566609/raw/9febc5d16d8d162c93f3503510ce0808a8075d5b/openuv.yaml
      version: "3.0"
  x-providerName: openuv.io
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_apis.guru_assets_images_no-logo.svg
paths:
  /forecast:
    description: Hourly UV Index Forecast
    get:
      description: Get hourly UV Index Forecast by location and date. Optional altitude, ozone level and datetime could be provided.
      parameters:
        - description: latitude, from -90.00 to 90.00
          in: query
          name: lat
          required: true
          schema:
            description: latitude, from -90.00 to 90.00
            example: 78.67
            type: number
        - description: longitude, from -180.00 to 180.00
          in: query
          name: lng
          required: true
          schema:
            description: longitude, from -180.00 to 180.00
            example: 115.67
            type: number
        - description: Altitude in meters, from 0 to 10000m, 0m by default. If provided the altitude correction factor will be applied to clear sky sea level UV Index value.
          in: query
          name: alt
          required: false
          schema:
            description: Altitude in meters, from 0 to 10000m, 0m by default. If provided the altitude correction factor will be applied to clear sky sea level UV Index value.
            example: 1050
            type: number
        - description: Ozone in du (Dobson Units), from 100 to 550du, the latest forecast from OMI dataset is used by default.
          in: query
          name: ozone
          required: false
          schema:
            description: Ozone in du (Dobson Units), from 100 to 550du, the latest forecast from OMI dataset is used by default.
            example: 304.5
            type: number
        - description: UTC datetime in ISO-8601 format, now by default. Use that parameter to get UV Index Forecast for any point in time.
          in: query
          name: dt
          required: false
          schema:
            description: UTC datetime in ISO-8601 format, now by default. Use that parameter to get UV Index Forecast for any point in time.
            example: 2018-02-04T04:39:06.467Z
            format: date-time
            type: string
        - description: This header is used to send data that contains your OpenUV API key
          in: header
          name: x-access-token
          required: true
          schema:
            description: This header is used to send data that contains your OpenUV API key
            title: x-access-token
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/forecastResult"
                type: array
          description: ""
  /protection:
    description: Daily Protection Time
    get:
      description: Get daily protection time by location, UV Index from and UV Index to with 10 minutes accuracy. Optional altitide and ozone level could be provided.
      parameters:
        - description: latitude, from -90.00 to 90.00
          in: query
          name: lat
          required: true
          schema:
            description: latitude, from -90.00 to 90.00
            example: 78.67
            type: number
        - description: longitude, from -180.00 to 180.00
          in: query
          name: lng
          required: true
          schema:
            description: longitude, from -180.00 to 180.00
            example: 115.67
            type: number
        - description: UV Index from value for protection datetime lookup. From 0 to 40.
          in: query
          name: from
          required: true
          schema:
            description: UV Index from value for protection datetime lookup. From 0 to 40.
            example: 2.5
            type: number
        - description: UV Index to value for protection datetime lookup. From 0 to 40.
          in: query
          name: to
          required: true
          schema:
            description: UV Index to value for protection datetime lookup. From 0 to 40.
            example: 3.6
            type: number
        - description: Altitude in meters, from 0 to 10000m, 0m by default. If provided the altitude correction factor will be applied to clear sky sea level UV Index value.
          in: query
          name: alt
          required: false
          schema:
            description: Altitude in meters, from 0 to 10000m, 0m by default. If provided the altitude correction factor will be applied to clear sky sea level UV Index value.
            example: 1050
            type: number
        - description: Ozone in du (Dobson Units), from 100 to 550du, the latest forecast from OMI dataset is used by default.
          in: query
          name: ozone
          required: false
          schema:
            description: Ozone in du (Dobson Units), from 100 to 550du, the latest forecast from OMI dataset is used by default.
            example: 304.5
            type: number
        - description: This header is used to send data that contains your OpenUV API key
          in: header
          name: x-access-token
          required: true
          schema:
            description: This header is used to send data that contains your OpenUV API key
            title: x-access-token
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/protectionResult"
                type: object
          description: ""
  /uv:
    description: Real-time UV Index
    get:
      description: Get real-time UV Index by location. Optional altitude, ozone level and datetime could be provided.
      parameters:
        - description: latitude, from -90.00 to 90.00
          in: query
          name: lat
          required: true
          schema:
            description: latitude, from -90.00 to 90.00
            example: 78.67
            type: number
        - description: longitude, from -180.00 to 180.00
          in: query
          name: lng
          required: true
          schema:
            description: longitude, from -180.00 to 180.00
            example: 115.67
            type: number
        - description: Altitude in meters, from 0 to 10000m, 0m by default. If provided the altitude correction factor will be applied to clear sky sea level UV Index value.
          in: query
          name: alt
          required: false
          schema:
            description: Altitude in meters, from 0 to 10000m, 0m by default. If provided the altitude correction factor will be applied to clear sky sea level UV Index value.
            example: 1050
            type: number
        - description: Ozone in du (Dobson Units), from 100 to 550du, the latest forecast from OMI dataset is used by default.
          in: query
          name: ozone
          required: false
          schema:
            description: Ozone in du (Dobson Units), from 100 to 550du, the latest forecast from OMI dataset is used by default.
            example: 304.5
            type: number
        - description: UTC datetime in ISO-8601 format, now by default. Use that parameter to get UV Index Forecast for any point in time.
          in: query
          name: dt
          required: false
          schema:
            description: UTC datetime in ISO-8601 format, now by default. Use that parameter to get UV Index Forecast for any point in time.
            example: 2018-02-04T04:39:06.467Z
            format: date-time
            type: string
        - description: This header is used to send data that contains your OpenUV API key
          in: header
          name: x-access-token
          required: true
          schema:
            description: This header is used to send data that contains your OpenUV API key
            title: x-access-token
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/uvIndexResult"
                type: object
          description: ""
components:
  schemas:
    Error:
      properties:
        error:
          type: string
      required:
        - error
      type: object
    forecast:
      properties:
        uv:
          type: number
        uv_time:
          format: date-time-only
          type: string
      required:
        - uv
        - uv_time
      type: object
    forecastResult:
      items:
        $ref: "#/components/schemas/forecast"
      title: result
      type: array
      uniqueItems: true
    protectionResult:
      properties:
        ozone:
          type: number
        ozone_time:
          format: date-time-only
          type: string
        uv:
          type: number
        uv_max:
          type: number
        uv_max_time:
          format: date-time-only
          type: string
        uv_time:
          format: date-time-only
          type: string
      required:
        - uv
        - uv_time
        - uv_max
        - uv_max_time
        - ozone
        - ozone_time
      title: result
      type: object
    uvIndexResult:
      properties:
        from_time:
          format: date-time-only
          type: string
        from_uv:
          type: number
        to_time:
          format: date-time-only
          type: string
        to_uv:
          type: number
      required:
        - from_time
        - from_uv
        - to_time
        - to_uv
      title: result
      type: object
