{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/airthings/json-schema/airthings-hook-response-enriched-schema.json",
  "title": "HookResponse-enriched",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/airthings-webhooks-api-openapi.yml#/components/schemas/HookResponse-enriched",
  "type": "object",
  "properties": {
    "active": {
      "type": "boolean"
    },
    "devices": {
      "items": {
        "$ref": "#/$defs/GetDeviceDetailedResponse"
      },
      "deprecated": true,
      "description": "List of devices the webhook is subscribed to (deprecated, use locations instead)",
      "type": "array"
    },
    "eventTypes": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "headers": {
      "additionalProperties": {
        "type": "string"
      },
      "type": "object"
    },
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "labels": {
      "additionalProperties": {
        "type": "string"
      },
      "type": "object"
    },
    "locations": {
      "items": {
        "$ref": "#/$defs/LocationResponse"
      },
      "description": "List of locations the webhook is subscribed to",
      "type": "array"
    },
    "mostRecentEvent": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/HookEvent"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "sensorUnits": {
      "$ref": "#/$defs/HookSensorUnits"
    },
    "subscribedToAll": {
      "type": "boolean",
      "description": "Webhook subscribes to all devices in all locations, including devices and locations that are added in the future"
    },
    "url": {
      "type": "string"
    }
  },
  "required": [
    "active",
    "devices",
    "eventTypes",
    "headers",
    "id",
    "labels",
    "locations",
    "name",
    "sensorUnits",
    "subscribedToAll",
    "url"
  ],
  "$defs": {
    "DeviceType": {
      "type": "string",
      "enum": [
        "WAVE",
        "WAVE_GEN2",
        "WAVE_MINI",
        "WAVE_PLUS",
        "WAVE_CO2",
        "VIEW_PLUS",
        "VIEW_PLUS_BUSINESS",
        "VIEW_POLLUTION",
        "VIEW_RADON",
        "VIEW_CO2",
        "SPACE_CO2_MINI",
        "SPACE_RADON",
        "WAVE_NANO",
        "WAVE_ENHANCE",
        "HUB",
        "HOME",
        "HOME_COLIBRI",
        "PRO",
        "BREEZOMETER_WEATHER",
        "BACNET",
        "AP_1",
        "RAVEN_RADON",
        "UNKNOWN"
      ]
    },
    "GetDeviceDetailedResponse": {
      "type": "object",
      "properties": {
        "deviceType": {
          "$ref": "#/$defs/DeviceType"
        },
        "id": {
          "type": "string",
          "maxLength": 10,
          "minLength": 10
        },
        "location": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/LocationSimpleResponse"
            }
          ]
        },
        "productName": {
          "type": "string"
        },
        "segment": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/SegmentSimpleResponse"
            }
          ]
        },
        "sensors": {
          "items": {
            "type": "string",
            "enum": [
              "radonShortTermAvg",
              "radonLongTermAvg",
              "hctsbk",
              "hctsrn222l",
              "hctsrn222h",
              "hctssa",
              "hctspo21xl",
              "hctspo21xh",
              "hctscomparator",
              "hctsprocessed",
              "temp",
              "outdoorTemp",
              "humidity",
              "outdoorHumidity",
              "co2",
              "voc",
              "pressure",
              "outdoorPressure",
              "pressureDifference",
              "light",
              "lux",
              "batteryPercentage",
              "batteryVoltage",
              "orientation",
              "pm1",
              "pm25",
              "pm10",
              "mold",
              "staleAir",
              "transmissionEfficiency",
              "virusSurvivalRate",
              "virusRisk",
              "windSpeed",
              "windDirection",
              "windGust",
              "dewPoint",
              "cloudCover",
              "visibility",
              "precipitation_probability",
              "total_precipitation",
              "outdoorWeather",
              "hourlyRadonStandardDeviation",
              "hourlyRadon",
              "historicVentilationConfidence",
              "daytimeBaseline",
              "daytimePeak",
              "nightBaseline",
              "historicVentilation",
              "ventilationRunningConfidence",
              "occupantsUpper",
              "occupantsLower",
              "presence",
              "occupants",
              "relativeOccupants",
              "ventilationAmount",
              "historicVentilationRunning",
              "ventilationRunning",
              "ventilationAmountRelative",
              "airExchangeRateUpper",
              "airExchangeRateLower",
              "airExchangeRate",
              "sla",
              "bacnet"
            ]
          },
          "type": "array"
        }
      },
      "required": [
        "deviceType",
        "id",
        "productName",
        "sensors"
      ]
    },
    "HookEvent": {
      "type": "object",
      "properties": {
        "completedAt": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "format": "date-time"
            }
          ]
        },
        "correlationId": {
          "type": "string"
        },
        "createdAt": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "format": "date-time"
            }
          ]
        },
        "hookId": {
          "type": "string",
          "format": "uuid"
        },
        "statusCode": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "number",
              "format": "int32"
            }
          ]
        },
        "updatedAt": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "format": "date-time"
            }
          ]
        },
        "url": {
          "type": "string"
        }
      },
      "required": [
        "correlationId",
        "hookId",
        "url"
      ]
    },
    "HookSensorUnits": {
      "type": "object",
      "format": "string",
      "properties": {
        "radonUnit": {
          "type": "string",
          "enum": [
            "pci",
            "bq"
          ]
        },
        "tempUnit": {
          "type": "string",
          "enum": [
            "c",
            "f"
          ]
        },
        "pressureUnit": {
          "type": "string",
          "enum": [
            "hpa",
            "inhg"
          ]
        },
        "vocUnit": {
          "type": "string",
          "enum": [
            "ppb",
            "mgpc"
          ]
        }
      }
    },
    "LocationResponse": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "labels": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "labels",
        "name"
      ]
    },
    "LocationSimpleResponse": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name"
      ]
    },
    "SegmentSimpleResponse": {
      "type": "object",
      "properties": {
        "active": {
          "type": "boolean"
        },
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        },
        "spaceId": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "string",
              "format": "uuid"
            }
          ]
        },
        "started": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "active",
        "id",
        "name",
        "started"
      ]
    }
  }
}