---
swagger: '2.0'
info:
  version: '1.0'
  title: SaveEcoBot Radiation Monitoring API
  description: OpenAPI specification for the public SaveEcoBot radiation monitoring API.<br/>To obtain an access key, please fill out <a href="https://forms.gle/r43qfvgmbrsqFkJD7" target="_blank">the access form</a>.
  contact:
    name: SaveDnipro
    email: savednipro@gmail.com
  termsOfService: https://www.saveecobot.com/en/static/terms
host: www.saveecobot.com
basePath: "/api/v1"
schemes:
- https
consumes:
- application/json
produces:
- application/json
securityDefinitions:
  apikey:
    type: apiKey
    name: apikey
    in: query
paths:
  "/radiation-ukraine/sensors-last-data":
    get:
      tags:
      - Radiation monitoring
      summary: Latest data from all public radiation stations in Ukraine
      description: Returns a compact list of latest radiation monitoring values. Restricted stations are not included in this response.
      security:
      - apikey: []
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                type: array
                items:
                  "$ref": "#/definitions/RadiationLastData"
            required:
            - data
          examples:
            application/json:
              data:
              - sensor_id: 61
                updated_at: '2022-03-21 13:04:02'
                gamma_nsv_h: 80
                is_old: 1
              - sensor_id: 62
                updated_at: '2022-03-21 13:04:02'
                gamma_nsv_h: 70
                is_old: 1
        '503':
          description: Data is temporarily unavailable
  "/radiation-ukraine/sensors-last-data-with-history":
    get:
      tags:
      - Radiation monitoring
      summary: Latest data from all public radiation stations in Ukraine with history
      description: Returns latest values and short history for every public radiation station.
      security:
      - apikey: []
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                type: array
                items:
                  "$ref": "#/definitions/RadiationLastDataWithHistory"
            required:
            - data
          examples:
            application/json:
              data:
              - sensor_id: 61
                updated_at: '2022-03-21 13:04:02'
                gamma_nsv_h: 80
                is_old: 1
                history: []
              - sensor_id: 62
                updated_at: '2022-03-21 13:04:02'
                gamma_nsv_h: 70
                is_old: 1
                history: []
        '503':
          description: Data is temporarily unavailable
  "/radiation-ukraine/sensors-details":
    get:
      tags:
      - Radiation stations
      summary: Details of public radiation stations in Ukraine
      description: Returns coordinates, names, and service fields for public radiation stations. Pass `filter[language]=en` for English localized names.
      security:
      - apikey: []
      parameters:
      - name: filter[language]
        in: query
        required: false
        type: string
        enum:
        - uk
        - en
        description: Response language for localized station names. Use `en` for English where translations are available.
        default: en
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                type: array
                items:
                  "$ref": "#/definitions/RadiationSensorDetails"
            required:
            - data
          examples:
            application/json: &1
              data:
              - sensor_id: 61
                sensor_name: vulytsia Batumska, 20A
                latitude: '48.51388889'
                longitude: '35.08222222'
                is_cez: false
                region_name: Dnipropetrovsk Oblast
                city_type_name: city
                city_name: Dnipro
                platform_name: KP "CEM" DOR
                notes: 
                installation_partners: 
                device_type: 
                measurement_type: automatic
                url_maps: https://www.saveecobot.com/radiation-maps#9/48.51388889/35.08222222/gamma+usv/ara+arc+clua+cuc+crc+radh-4/device_61
              - sensor_id: 62
                sensor_name: vulytsia Kosmonavta Volkova, 11A
                latitude: '48.40388889'
                longitude: '35.13166667'
                is_cez: false
                region_name: Dnipropetrovsk Oblast
                city_type_name: city
                city_name: Dnipro
                platform_name: KP "CEM" DOR
                notes: 
                installation_partners: 
                device_type: 
                measurement_type: automatic
                url_maps: https://www.saveecobot.com/radiation-maps#9/48.40388889/35.13166667/gamma+usv/ara+arc+clua+cuc+crc+radh-4/device_62
        '503':
          description: Data is temporarily unavailable
  "/radiation-ukraine/sensor-last-data/{sensor_id}":
    get:
      tags:
      - Radiation stations
      summary: Latest data for one public radiation station
      description: Returns latest values for one public radiation station and short history for the last day.
      security:
      - apikey: []
      parameters:
      - name: sensor_id
        in: path
        required: true
        type: integer
        description: Monitoring station identifier.
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              data:
                type: array
                items:
                  "$ref": "#/definitions/RadiationSingleSensorValue"
            required:
            - data
          examples:
            application/json:
              data:
              - phenomenon: aqi_pm25
                value: 13
                unit: ''
                format: "%d"
                emoji: ''
                updated_at: '2022-03-21T14:00:00.000000Z'
                updated_at_utc: '2022-03-21T12:00:00Z'
                is_old: 1
                history: []
              - phenomenon: co_mg
                value: 0.7787
                unit: мг/м³
                format: "%0.2f"
                emoji: "\U0001F4AD"
                updated_at: '2022-03-21 13:04:02'
                updated_at_utc: '2022-03-21T11:04:02Z'
                is_old: 1
                history: []
        '403':
          description: Station is not available through the public API
        '404':
          description: Station was not found
  "/legacy/radiation-ukraine/sensors-last-data":
    get:
      tags:
      - Legacy
      summary: Legacy endpoint for latest radiation monitoring data
      description: Legacy response variant for integrations created before the current snapshot endpoints. New integrations should use `/radiation-ukraine/sensors-last-data`.
      security:
      - apikey: []
      responses:
        '200':
          description: OK
          examples:
            application/json:
              data:
              - sensor_id: 61
                updated_at: '2022-03-21 13:04:02'
                gamma_nsv_h: 80
                is_old: 1
              - sensor_id: 62
                updated_at: '2022-03-21 13:04:02'
                gamma_nsv_h: 70
                is_old: 1
          schema:
            type: object
            properties:
              data:
                type: array
                items:
                  "$ref": "#/definitions/RadiationLastData"
            required:
            - data
  "/legacy/radiation-ukraine/sensors-last-data-with-history":
    get:
      tags:
      - Legacy
      summary: Legacy endpoint for latest data with history
      description: Legacy response variant with history for older integrations.
      security:
      - apikey: []
      responses:
        '200':
          description: OK
          examples:
            application/json:
              data:
              - sensor_id: 61
                updated_at: '2022-03-21 13:04:02'
                gamma_nsv_h: 80
                is_old: 1
                history: []
              - sensor_id: 62
                updated_at: '2022-03-21 13:04:02'
                gamma_nsv_h: 70
                is_old: 1
                history: []
          schema:
            type: object
            properties:
              data:
                type: array
                items:
                  "$ref": "#/definitions/RadiationLastDataWithHistory"
            required:
            - data
  "/legacy/radiation-ukraine/sensors-details":
    get:
      tags:
      - Legacy
      summary: Legacy endpoint for radiation station details
      description: Legacy station details response variant for older integrations.
      security:
      - apikey: []
      parameters:
      - name: filter[language]
        in: query
        required: false
        type: string
        enum:
        - uk
        - en
        description: Response language for localized station names. Use `en` for English where translations are available.
        default: en
      responses:
        '200':
          description: OK
          examples:
            application/json: *1
          schema:
            type: object
            properties:
              data:
                type: array
                items:
                  "$ref": "#/definitions/RadiationSensorDetails"
            required:
            - data
definitions:
  RadiationLastData:
    type: object
    properties:
      sensor_id:
        type: integer
      updated_at:
        type: string
      gamma_nsv_h:
        type: number
        format: float
      is_old:
        type: integer
        enum:
        - 0
        - 1
  RadiationLastDataWithHistory:
    allOf:
    - "$ref": "#/definitions/RadiationLastData"
    - type: object
      properties:
        history:
          type: array
          items:
            "$ref": "#/definitions/RadiationHistoryPoint"
  RadiationHistoryPoint:
    type: object
    properties:
      datetime:
        type: string
      value:
        type: number
        format: float
  RadiationSensorDetails:
    type: object
    properties:
      sensor_id:
        type: integer
      sensor_name:
        type: string
      latitude:
        type: string
      longitude:
        type: string
      is_cez:
        type: boolean
      region_name:
        type: string
      city_type_name:
        type: string
      city_name:
        type: string
      platform_name:
        type: string
      notes:
        type: string
        x-nullable: true
      installation_partners:
        type: string
        x-nullable: true
      device_type:
        type: string
        x-nullable: true
      measurement_type:
        type: string
        x-nullable: true
      url_maps:
        type: string
        format: uri
  RadiationSingleSensorValue:
    type: object
    properties:
      phenomenon:
        type: string
        example: gamma_nsv_h
      value:
        type: number
        format: float
        x-nullable: true
      unit:
        type: string
      format:
        type: string
      emoji:
        type: string
      updated_at:
        type: string
      updated_at_utc:
        type: string
        format: date-time
      is_old:
        type: integer
        enum:
        - 0
        - 1
      history:
        type: array
        items:
          "$ref": "#/definitions/RadiationHistoryPoint"
