{"openapi":"3.1.0","info":{"version":"1.5.0","title":"Alerts API","description":"Start, update, or cancel an alert, or, Post message to alert chat thread"},"tags":[{"name":"alerts","description":"Operations related to alerts"}],"servers":[{"url":"https://api.aegix.global/","description":"Production server"},{"url":"https://api.stage.aegix.global","description":"Staging server"}],"paths":{"/alert":{"parameters":[{"$ref":"#/components/parameters/VendorId"}],"post":{"tags":["alerts"],"description":"Start an alert","operationId":"startAlert","parameters":[{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of optional response enrichments.\n- `incidents` — emit the `kind: \"alert\" | \"incident\"` discriminator on the returned payload. When omitted, the response is a plain `Alert` with no `kind` field (pre-AP-272 shape).\n"}],"requestBody":{"description":"Alert to be started","required":true,"content":{"application/json":{"schema":{"type":"object","required":["alert","source"],"properties":{"alert":{"$ref":"#/components/schemas/Alert"},"source":{"$ref":"#/components/schemas/AlertSource"},"post":{"$ref":"#/components/schemas/AlertPost"}}}},"multipart/form-data":{"schema":{"type":"object","properties":{"alert[siteId]":{"type":"string"},"alert[title]":{"type":"string"},"alert[message]":{"type":"string"},"alert[startedAt]":{"type":"string","format":"date-time"},"alert[disposition][urgency]":{"type":"string","enum":["emergency","attention"]},"alert[disposition][notification][silent]":{"type":"boolean"},"alert[disposition][notification][drill]":{"type":"boolean"},"source[id]":{"type":"string"},"source[label]":{"type":"string"},"source[description]":{"type":"string"},"post[message]":{"type":"string"},"post[location][latitude]":{"type":"number"},"post[location][longitude]":{"type":"number"},"media":{"type":"string","format":"binary"}}}}}},"responses":{"201":{"description":"Alert started successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Alert"}}}},"400":{"$ref":"#/components/responses/InvalidInput"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/Unexpected"}}}},"/alert/site/{siteId}":{"parameters":[{"$ref":"#/components/parameters/SiteId"},{"$ref":"#/components/parameters/VendorId"}],"get":{"tags":["alerts"],"description":"Describe a site's alert","operationId":"describeSiteAlert","parameters":[{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of optional response enrichments.\n- `incidents` — attach a sibling `incidents[]` array to the response and emit the `kind` discriminator on the root alert and each incident entry. When the site has no active alert, the response becomes `{ message, incidents }`.\n- `location-status` — attach room safety statuses as `locations[]` on the root alert.\nAccepts a single token or multiple comma-separated tokens, e.g. `?include=incidents`, `?include=location-status`, `?include=incidents,location-status`. When omitted, the response is a plain `Alert` at the root (pre-AP-272 shape) — no `kind`, no `incidents` — or `{ message }` when nothing is active.\n"}],"responses":{"200":{"description":"**Default** (no `?include=incidents`): a flat `Alert` at the root\n(pre-AP-272 shape) when an alert is active, or `{ message: \"No active alerts for site\" }` when none is active.\n\n**With `?include=incidents`**: a flat `Alert` at the root plus a\nsibling `incidents[]` array when an alert is active, or\n`{ message, incidents }` when no alert is active. Each incident\nentry carries `kind: \"incident\"`; the root alert carries `kind: \"alert\"`.\n","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Alert"},{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"Informative message when no alert is active."}}},{"allOf":[{"$ref":"#/components/schemas/Alert"},{"type":"object","required":["incidents"],"properties":{"incidents":{"type":"array","description":"Sibling array of active incidents at this site. Each\nentry conforms to the `Alert` schema with\n`kind: \"incident\"`. Empty array when no incidents\nqualify.\n","items":{"$ref":"#/components/schemas/Alert"}}}}]},{"type":"object","required":["message","incidents"],"properties":{"message":{"type":"string","description":"Informative message when no alert is active."},"incidents":{"type":"array","items":{"$ref":"#/components/schemas/Alert"},"description":"Sibling array of active incidents at this site.\n"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/Unexpected"}}}},"/alert/{alertId}":{"parameters":[{"$ref":"#/components/parameters/AlertId"},{"$ref":"#/components/parameters/VendorId"}],"get":{"tags":["alerts"],"description":"Describe an alert","operationId":"describeAlert","parameters":[{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of optional response enrichments.\n- `incidents` — include the `kind` discriminator on the returned Alert/Incident payload (useful when the same id space is shared between alerts and incidents).\n- `location-status` — attach room safety statuses to `locations`.\nAccepts comma-separated tokens, e.g. `?include=incidents,location-status`.\n"}],"responses":{"200":{"description":"The alert corresponding to the provided `alertId`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Alert"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/AlertNotFound"},"500":{"$ref":"#/components/responses/Unexpected"}}},"delete":{"tags":["alerts"],"description":"Cancel an alert","operationId":"cancelAlert","responses":{"200":{"description":"Alert is cancelled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Alert"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/AlertNotFound"},"500":{"$ref":"#/components/responses/Unexpected"}}},"patch":{"tags":["alerts"],"description":"Update the disposition of an alert","operationId":"patchAlert","parameters":[{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of optional response enrichments.\n- `incidents` — emit the `kind: \"alert\" | \"incident\"` discriminator on the returned payload. When omitted, the response is a plain `Alert` with no `kind` field (pre-AP-272 shape).\n"}],"requestBody":{"description":"Fields to be updated in the alert","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertDisposition"}}}},"responses":{"200":{"description":"Alert updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Alert"}}}},"400":{"$ref":"#/components/responses/InvalidInput"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/AlertNotFound"},"500":{"$ref":"#/components/responses/Unexpected"}}}},"/alert/{alertId}/post":{"parameters":[{"$ref":"#/components/parameters/AlertId"},{"$ref":"#/components/parameters/VendorId"}],"post":{"tags":["alerts"],"summary":"Post a message on an alert's chat thread","description":"Post a message, media, or location to an alert's chat thread.\n\n**Alert Restart Capability:**\nIf posting to a cancelled alert, the alert will be restarted (status changed to active)\nand the message will be posted. In this case, a 201 response is returned.\n\nIf the alert cannot be restarted (e.g., resolved or expired), a 410 Gone response is returned.\n\n**Author Safety Status:**\nWhen `author` is provided with a `status` object:\n- `author.status.safe` - marks the user as safe (default: false)\n- `author.status.needsMedicalAttention` - indicates medical attention needed (default: false)\n\nIf `author` is provided with a `location`, the room safety status is also updated.\n","operationId":"postAlertMessage","parameters":[{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of optional response enrichments.\n- `incidents` — emit the `kind: \"alert\" | \"incident\"` discriminator on the returned payload. When omitted, the response is a plain `Alert` with no `kind` field (pre-AP-272 shape).\n"}],"requestBody":{"description":"Alert message to be posted","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertPost"}},"multipart/form-data":{"schema":{"type":"object","properties":{"message":{"type":"string"},"location[latitude]":{"type":"number"},"location[longitude]":{"type":"number"},"media":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"description":"Alert message posted to chat thread","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Alert"}}}},"201":{"description":"Alert was restarted (from cancelled status) and message posted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Alert"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/AlertNotFound"},"410":{"$ref":"#/components/responses/AlertGone"},"500":{"$ref":"#/components/responses/Unexpected"}}}},"/alert/{alertId}/location/{locationId}":{"parameters":[{"$ref":"#/components/parameters/AlertId"},{"$ref":"#/components/parameters/LocationId"},{"$ref":"#/components/parameters/VendorId"}],"patch":{"tags":["alerts"],"summary":"Update location status during an alert","description":"Update the safety status of a location (room, POI, or area) during an active alert.\nThe locationId can be:\n- A UUID identifying a specific room or POI\n- An encoded structure identifier (e.g., building:floor:room)\n\nThis endpoint only works for active alerts. Attempting to update a cancelled or\nresolved alert will return 409 Conflict.\n","operationId":"updateAlertLocation","requestBody":{"description":"Location status update","required":true,"content":{"application/json":{"schema":{"type":"object","required":["safetyStatus"],"properties":{"safetyStatus":{"$ref":"#/components/schemas/SafetyStatus"},"author":{"$ref":"#/components/schemas/User","description":"User reporting the status (optional, for attribution)"}}}}}},"responses":{"200":{"description":"Location status updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertLocationStatusUpdate"}}}},"400":{"$ref":"#/components/responses/InvalidInput"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/LocationNotFound"},"409":{"$ref":"#/components/responses/AlertNotActive"},"500":{"$ref":"#/components/responses/Unexpected"}}}},"/alert/{alertId}/user/{userId}":{"parameters":[{"$ref":"#/components/parameters/AlertId"},{"$ref":"#/components/parameters/UserId"},{"$ref":"#/components/parameters/VendorId"}],"patch":{"tags":["alerts"],"summary":"Update user status during an alert","description":"Update the safety status of a user during an active alert.\nThe userId can be:\n- A UUID (public_id) identifying the user\n- An integer ID\n\nThis endpoint updates user status independent of room status. Use this when\nyou need to track individual user safety without associating it with a specific room.\n\nThis endpoint only works for active alerts. Attempting to update a cancelled or\nresolved alert will return 409 Conflict.\n","operationId":"updateAlertUser","requestBody":{"description":"User status update","required":true,"content":{"application/json":{"schema":{"type":"object","required":["safetyStatus"],"properties":{"safetyStatus":{"$ref":"#/components/schemas/SafetyStatus"},"location":{"$ref":"#/components/schemas/AlertLocation","description":"Optional location context for the user status"}}}}}},"responses":{"200":{"description":"User status updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertUserStatusUpdate"}}}},"400":{"$ref":"#/components/responses/InvalidInput"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/UserNotFound"},"409":{"$ref":"#/components/responses/AlertNotActive"},"500":{"$ref":"#/components/responses/Unexpected"}}}},"/alert/types/{siteId}":{"parameters":[{"$ref":"#/components/parameters/SiteId"},{"$ref":"#/components/parameters/VendorId"}],"get":{"tags":["alerts"],"description":"List alert types (deprecated - use /alert/site/{siteId}/type)","operationId":"listAlertTypes","deprecated":true,"responses":{"200":{"description":"The alert types corresponding to the provided `siteId`","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AlertType"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/SiteNotFound"},"500":{"$ref":"#/components/responses/Unexpected"}}}},"/alert/site/{siteId}/types":{"parameters":[{"$ref":"#/components/parameters/SiteId"},{"$ref":"#/components/parameters/VendorId"}],"get":{"tags":["alerts"],"description":"List alert types for a site","operationId":"listSiteAlertTypes","responses":{"200":{"description":"The alert types corresponding to the provided `siteId`","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AlertType"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/SiteNotFound"},"500":{"$ref":"#/components/responses/Unexpected"}}}},"/alert/site/{siteId}/type":{"parameters":[{"$ref":"#/components/parameters/SiteId"},{"$ref":"#/components/parameters/VendorId"}],"post":{"tags":["alerts"],"description":"Create a new alert type for a site","operationId":"createAlertType","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertType"}}}},"responses":{"201":{"description":"Alert type created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertType"}}}},"400":{"$ref":"#/components/responses/InvalidInput"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/SiteNotFound"},"500":{"$ref":"#/components/responses/Unexpected"}}}},"/alert/site/{siteId}/type/{typeId}":{"parameters":[{"$ref":"#/components/parameters/SiteId"},{"$ref":"#/components/parameters/TypeId"},{"$ref":"#/components/parameters/VendorId"}],"get":{"tags":["alerts"],"description":"Get a specific alert type","operationId":"getAlertType","responses":{"200":{"description":"Alert type details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertType"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/AlertTypeNotFound"},"500":{"$ref":"#/components/responses/Unexpected"}}},"put":{"tags":["alerts"],"description":"Update an alert type","operationId":"updateAlertType","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertType"}}}},"responses":{"200":{"description":"Alert type updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertType"}}}},"400":{"$ref":"#/components/responses/InvalidInput"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/AlertTypeNotFound"},"500":{"$ref":"#/components/responses/Unexpected"}}},"patch":{"tags":["alerts"],"description":"Partially update an alert type","operationId":"patchAlertType","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertType"}}}},"responses":{"200":{"description":"Alert type updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertType"}}}},"400":{"$ref":"#/components/responses/InvalidInput"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/AlertTypeNotFound"},"500":{"$ref":"#/components/responses/Unexpected"}}},"delete":{"tags":["alerts"],"description":"Delete an alert type","operationId":"deleteAlertType","responses":{"204":{"description":"Alert type deleted successfully"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/AlertTypeNotFound"},"500":{"$ref":"#/components/responses/Unexpected"}}}},"/alert/site/{siteId}/type/{typeId}/plan":{"parameters":[{"$ref":"#/components/parameters/SiteId"},{"$ref":"#/components/parameters/TypeId"},{"$ref":"#/components/parameters/VendorId"}],"post":{"tags":["alerts"],"description":"Create a new guidance plan for an alert type","operationId":"createAlertTypePlan","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertGuidance"}}}},"responses":{"201":{"description":"Guidance plan created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertGuidance"}}}},"400":{"$ref":"#/components/responses/InvalidInput"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/AlertTypeNotFound"},"500":{"$ref":"#/components/responses/Unexpected"}}}},"/alert/site/{siteId}/type/{typeId}/plan/{planId}":{"parameters":[{"$ref":"#/components/parameters/SiteId"},{"$ref":"#/components/parameters/TypeId"},{"$ref":"#/components/parameters/PlanId"},{"$ref":"#/components/parameters/VendorId"}],"get":{"tags":["alerts"],"description":"Get a specific guidance plan","operationId":"getAlertTypePlan","responses":{"200":{"description":"Guidance plan details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertGuidance"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/PlanNotFound"},"500":{"$ref":"#/components/responses/Unexpected"}}},"put":{"tags":["alerts"],"description":"Update a guidance plan","operationId":"updateAlertTypePlan","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertGuidance"}}}},"responses":{"200":{"description":"Guidance plan updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertGuidance"}}}},"400":{"$ref":"#/components/responses/InvalidInput"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/PlanNotFound"},"500":{"$ref":"#/components/responses/Unexpected"}}},"delete":{"tags":["alerts"],"description":"Delete a guidance plan","operationId":"deleteAlertTypePlan","responses":{"204":{"description":"Guidance plan deleted successfully"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/PlanNotFound"},"500":{"$ref":"#/components/responses/Unexpected"}}}}},"components":{"parameters":{"AlertId":{"name":"alertId","description":"The unique identifier of the alert","in":"path","required":true,"schema":{"$ref":"#/components/schemas/AlertId"}},"SiteId":{"name":"siteId","description":"The unique identifier of the site","in":"path","required":true,"schema":{"$ref":"#/components/schemas/SiteId"}},"VendorId":{"name":"vendor","description":"The vendor identifier","in":"header","required":true,"schema":{"type":"string"}},"TypeId":{"name":"typeId","description":"The unique identifier of the alert type","in":"path","required":true,"schema":{"$ref":"#/components/schemas/AlertTypeId"}},"PlanId":{"name":"planId","description":"The unique identifier of the guidance plan","in":"path","required":true,"schema":{"type":"string"}},"LocationId":{"name":"locationId","description":"Location identifier (UUID for room/POI, or encoded structure like building:floor:room)","in":"path","required":true,"schema":{"type":"string"}},"UserId":{"name":"userId","description":"User identifier (UUID public_id or integer ID)","in":"path","required":true,"schema":{"type":"string"}}},"responses":{"InvalidInput":{"description":"Invalid input, alert not updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvalidInput"}}}},"Unauthorized":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"Access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"AlertNotFound":{"description":"No alert found for the provided `alertId`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertNotFound"}}}},"SiteNotFound":{"description":"No site found for the provided `siteId`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteNotFound"}}}},"Unexpected":{"description":"Unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unexpected"}}}},"AlertTypeNotFound":{"description":"No alert type found for the provided `typeId`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertTypeNotFound"}}}},"PlanNotFound":{"description":"No guidance plan found for the provided `planId`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanNotFound"}}}},"LocationNotFound":{"description":"No location found for the provided `locationId`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationNotFound"}}}},"UserNotFound":{"description":"No user found for the provided `userId`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserNotFound"}}}},"AlertNotActive":{"description":"Alert is not active (cancelled or resolved)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertNotActive"}}}},"AlertGone":{"description":"Alert cannot be restarted (resolved or expired)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertGone"}}}}},"schemas":{"AlertId":{"description":"The unique identifier of an alert","type":"string","examples":["123456789"]},"AlertTypeId":{"description":"The unique identifier of an alert type","type":"string","examples":["123456789"]},"SiteId":{"type":"string","description":"The key of the site for which the alert targets","examples":["123"],"oneOf":[{"description":"The public id of the site","type":"string","format":"uuid"},{"description":"The private id of the site","type":"string"}]},"Alert":{"description":"An alert object; The type object may be used, or alternately, individual elements of typeId and/or disposition may be used.","type":"object","allOf":[{"oneOf":[{"required":["id"]},{"required":["siteId"]}]},{"oneOf":[{"not":{"anyOf":[{"required":["type"]},{"required":["typeId"]}]}},{"allOf":[{"anyOf":[{"required":["typeId"]}]},{"not":{"required":["type"]}}]},{"allOf":[{"anyOf":[{"required":["type"]}]},{"not":{"required":["typeId"]}}]}]}],"properties":{"id":{"$ref":"#/components/schemas/AlertId"},"siteId":{"$ref":"#/components/schemas/SiteId"},"title":{"$ref":"#/components/schemas/AlertTitle"},"type":{"$ref":"#/components/schemas/AlertType"},"disposition":{"$ref":"#/components/schemas/AlertDisposition"},"message":{"type":"string","description":"The reasoning for the alert which is posted to the alert's chat thread.","examples":["Fire detected in the building"]},"startedAt":{"type":"string","format":"date-time","description":"An ISO timestamp of when the alert was started at","examples":["2023-04-26T10:00:00Z"]},"cancelledAt":{"type":"string","format":"date-time","description":"An ISO timestamp of when the alert was cancelled at","examples":["2023-04-26T10:30:00Z"]},"initiator":{"type":"integer","description":"Integer identifier of the user who started the alert\n(BaseUser.id primary key).\n","examples":[42]},"typeId":{"description":"The unique identifier of an alert type","type":"string","examples":["123456789"],"deprecated":true},"status":{"$ref":"#/components/schemas/AlertStatus"},"location":{"$ref":"#/components/schemas/AlertLocation"},"locations":{"type":"array","description":"Named locations (rooms, POIs, areas) attached to the alert with\ntheir current safety status. Always present on responses (may be an\nempty array if no locations have reported status yet). Each entry\nincludes the full `NamedLocation.structure` (building/floor/room)\nso clients can place and colorize map markers without a secondary\nlookup.\n\nThe `?include=location-status` query parameter is retained as a\nno-op for backwards compatibility; clients generated against\nearlier specs will continue to receive `locations[]` and can\nignore the parameter.\n","items":{"$ref":"#/components/schemas/AlertLocationStatus"}},"geolocation":{"allOf":[{"$ref":"#/components/schemas/GeoLocation"}],"description":"Legacy/alternative location field. When provided, automatically normalized to post.location.\nPrefer using location.point or post.location for new integrations.\n","deprecated":true},"kind":{"type":"string","enum":["alert","incident"],"default":"alert","description":"Discriminates records backed by the Alert model (\"alert\") from records\nbacked by the Incident model (\"incident\").\n\n**AP-289**: this field is only emitted on responses when the request\nopts in via `?include=incidents`. Clients that pre-date the\ndiscriminator (and don't need to distinguish between the two backing\nmodels) should omit the flag and will receive a plain Alert shape.\nClients generated against earlier versions of this spec will ignore\nthis field and continue to treat the payload as an alert — the\ndefault when absent.\n\nIncidents are included in responses when their urgency is `attention`\nor `emergency` and they have at least one named location attached.\nIncident `id` values are the incident's 6-character base-34 reference\nid (e.g. `K7WM3P`), not a numeric alert id.\n\nOn `POST /alert` requests, an explicit `kind: \"incident\"` routes the\nstart into the Incident pipeline (creates an Incident record rather\nthan an Alert). When omitted on request, the resolved AlertType's\n`activationMode` decides (`activationMode: \"incident\"` routes to the\nIncident pipeline; otherwise the Alert pipeline is used).\n\n`DELETE /alert/{alertId}` and `POST /alert/{alertId}/post` accept\nboth an Alert numeric id and an Incident `reference_id` for the\npath parameter, transparently dispatching to the right resource.\n"}},"examples":[{"id":"123456789","kind":"alert","siteId":"123","title":"Fire Alert","type":{"id":"42","title":"Fire Alert","activationMode":"alert","promptLocation":false},"message":"Fire detected in building","startedAt":"2023-04-26T10:00:00Z","disposition":{"urgency":"emergency","notification":{"silent":false,"drill":false}}},{"id":"K7WM3P","kind":"incident","siteId":"123","title":"Missing Person","type":{"id":"88","title":"Missing Person","activationMode":"incident","promptLocation":true},"startedAt":"2023-04-26T10:15:00Z","status":{"status":"active"},"disposition":{"urgency":"attention","notification":{"silent":false,"drill":false}},"location":{"named":{"name":"Library","scope":"room"}}}],"additionalProperties":true},"AlertDisposition":{"description":"The disposition (e.g. urgency and notification) of an alert","type":"object","properties":{"urgency":{"$ref":"#/components/schemas/AlertUrgency"},"notification":{"$ref":"#/components/schemas/AlertNotification"}},"minProperties":1},"AlertLocation":{"description":"The location of an alert, optionally including the resource type for map display.\nAt least one of `point` or `named` must be provided.\n","type":"object","anyOf":[{"required":["point"]},{"required":["named"]}],"properties":{"point":{"$ref":"#/components/schemas/GeoLocation"},"named":{"$ref":"#/components/schemas/NamedLocation"},"resourceType":{"$ref":"#/components/schemas/ResourceType"}}},"AlertType":{"description":"The alert type determines most characteristics of an active alert","type":"object","allOf":[{"oneOf":[{"required":["id"]},{"required":["title"]}]},{"oneOf":[{"not":{"anyOf":[{"required":["sound"]},{"required":["audio"]}]}},{"allOf":[{"anyOf":[{"required":["sound"]}]},{"not":{"required":["audio"]}}]},{"allOf":[{"anyOf":[{"required":["audio"]}]},{"not":{"required":["sound"]}}]}]}],"properties":{"id":{"$ref":"#/components/schemas/AlertTypeId"},"title":{"$ref":"#/components/schemas/AlertTitle"},"icon":{"$ref":"#/components/schemas/AlertIcon"},"sound":{"$ref":"#/components/schemas/AlertSound"},"audio":{"$ref":"#/components/schemas/AlertAudio"},"urgency":{"$ref":"#/components/schemas/AlertUrgency"},"guidance":{"type":"array","items":{"$ref":"#/components/schemas/AlertGuidance"}},"listOrdinal":{"$ref":"#/components/schemas/Ordinal"},"siteDefault":{"$ref":"#/components/schemas/Boolean"},"requireApproval":{"$ref":"#/components/schemas/Boolean"},"requireTargetMemberStart":{"$ref":"#/components/schemas/Boolean"},"elevateTargetMember":{"$ref":"#/components/schemas/Boolean"},"activationMode":{"description":"Whether starting this type creates an alert or incident","type":"string","enum":["alert","incident"],"default":"alert"},"promptLocation":{"description":"Whether to prompt for location when starting an incident of this type","type":"boolean","default":false},"isSsystem":{"type":"boolean","default":false,"description":"Whether this alert type is system-provided (seeded / reserved for\nplatform use) versus user-defined at a school or district.\n"},"target":{"$ref":"#/components/schemas/AlertTarget"}},"additionalProperties":true},"Ordinal":{"type":"integer","minimum":0,"maximum":999,"examples":[0]},"Seconds":{"allOf":[{"$ref":"#/components/schemas/Ordinal"}]},"Interval":{"allOf":[{"$ref":"#/components/schemas/Seconds"}],"minimum":1,"maximum":60,"examples":[30]},"Timeout":{"allOf":[{"$ref":"#/components/schemas/Seconds"}],"minimum":1,"maximum":600,"examples":[300]},"Boolean":{"type":"boolean","default":false,"examples":[false]},"AlertTitle":{"description":"The title of an alert type","type":"string"},"AlertIcon":{"description":"The URL of the image file to visually represet an alert type","type":"string"},"AlertSound":{"description":"The URL of the sound file to audibly represet an alert type","type":"string","deprecated":true},"AlertGuidance":{"description":"The stepwise guidance of an alert type describing how to responsd to an alert","type":"object","properties":{"role":{"type":"string"},"text":{"type":"string"}}},"AlertTarget":{"description":"The intended targets of an alert","type":"object","properties":{"groups":{"type":"array","items":{"$ref":"#/components/schemas/ChatGroup"}},"range":{"$ref":"#/components/schemas/AlertReverse"}},"additionalProperties":true},"AlertReverse":{"description":"The circular range to seek sites to reverse alert when starting an alert at the current site.","type":"object","properties":{"radius":{"$ref":"#/components/schemas/Radius"}},"additionalProperties":true},"Radius":{"description":"radius specification","type":"object","properties":{"value":{"type":"number","format":"float","minimum":0.1,"maximum":100.0,"examples":[5.0]},"unit":{"type":"string","enum":["miles","kilometers"],"examples":["kilometers"]}}},"ChatGroup":{"description":"A chat group to target for an alert","type":"object","oneOf":[{"required":["id"]},{"required":["name"]}],"properties":{"id":{"type":"string","examples":["group-123"]},"name":{"type":"string","examples":["Group Name"]},"members":{"type":"array","items":{"type":"object","oneOf":[{"required":["id"]},{"required":["email"]}],"properties":{"id":{"type":"string","examples":["user-123"]},"firstName":{"type":"string","examples":["First Name"]},"lastName":{"type":"string","examples":["Last Name"]},"email":{"type":"string","format":"email","examples":["first.last@email.domain"]}}}}}},"AlertUrgency":{"description":"The urgency an alert should be considered having","type":"string","default":"emergency","enum":["emergency","attention"],"examples":["emergency"]},"AlertNotification":{"description":"The notification parameters of an alert","type":"object","properties":{"silent":{"$ref":"#/components/schemas/Boolean"},"drill":{"$ref":"#/components/schemas/Boolean"}}},"AlertAudio":{"description":"The audio parameters of an alert","type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri","examples":["https://domain.test/sound-path/secure.mp3"]},"interval":{"$ref":"#/components/schemas/Interval"},"timeout":{"$ref":"#/components/schemas/Timeout"}}},"AlertStatus":{"description":"The status of an alert","type":"object","properties":{"status":{"type":"string","enum":["active","pending","rejected","cancelled"],"examples":["active"]}}},"AlertLocationStatus":{"description":"A location with its current safety status during an alert","allOf":[{"$ref":"#/components/schemas/NamedLocation"},{"$ref":"#/components/schemas/SafetyStatus"}]},"AlertLocationStatusUpdate":{"description":"Enriched response returned by `PATCH /alert/{alertId}/location/{locationId}`\nand broadcast as the `AlertLocationStatusUpdated` WebSocket event. Carries\nenough context (full `location` with `named.structure`, reporter attribution,\nsafety status) for clients to update a map marker in place without a\nfull alert refetch.\n","type":"object","required":["alertId","location","safetyStatus","updatedAt"],"properties":{"alertId":{"$ref":"#/components/schemas/AlertId"},"location":{"$ref":"#/components/schemas/AlertLocation","description":"The resolved location with full `named.structure` (building/floor/room)\npopulated. Clients should use `location.named.id` as the stable,\nselectable marker handle.\n"},"safetyStatus":{"$ref":"#/components/schemas/SafetyStatus"},"author":{"$ref":"#/components/schemas/User","description":"The user who reported the status update. `author.id` is the UUID\n(public_id). Emitted when attribution is available.\n"},"updatedAt":{"type":"string","format":"date-time","description":"ISO timestamp at which the status was recorded server-side."}}},"AlertUserStatusUpdate":{"description":"Enriched response returned by `PATCH /alert/{alertId}/user/{userId}` and\nbroadcast as the `AlertUserStatusUpdated` WebSocket event. Carries the\nfull `user` with `id` (UUID), name, reported location, and safety status\nso clients can colorize and place a map marker without a secondary\nlookup.\n","type":"object","required":["alertId","user","safetyStatus","updatedAt"],"properties":{"alertId":{"$ref":"#/components/schemas/AlertId"},"user":{"$ref":"#/components/schemas/User","description":"The user whose status was updated. `user.id` is the UUID (public_id)\nthat should be used as the stable, selectable marker handle. When\nthe user reported a location, `user.status` includes location\ncontext.\n"},"safetyStatus":{"$ref":"#/components/schemas/SafetyStatus"},"location":{"$ref":"#/components/schemas/AlertLocation","description":"Optional location context for the user status — when present,\nincludes full `named.structure` so the map can place the user on\nthe correct floor/building.\n"},"updatedAt":{"type":"string","format":"date-time","description":"ISO timestamp at which the status was recorded server-side."}}},"Contact":{"description":"Contact information (email or phone)","type":"object","anyOf":[{"required":["phone"]},{"required":["email"]}],"properties":{"email":{"type":"string","format":"email","examples":["info@domain.tld"]},"phone":{"type":"string","examples":["000000000000"]}}},"User":{"description":"A user who can interact with alerts (author, reporter, assignee)","type":"object","oneOf":[{"required":["id"]},{"required":["username"]}],"properties":{"id":{"type":"string","format":"uuid","examples":["57857204-af71-4eb6-8368-311c70a5a9a8"]},"name":{"type":"object","properties":{"givenNames":{"type":"string","description":"Given names","examples":["James Michael"]},"surnames":{"type":"string","description":"All surnames","examples":["Ibbetson Johnson"]}}},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"username":{"type":"string","description":"Commonly an email"},"status":{"$ref":"#/components/schemas/SafetyStatus","description":"Safety status of the user (used when reporting location during alert)"}},"additionalProperties":true},"AlertPost":{"description":"The content of a post (e.g. message, image, etc.) to be placed in an alert's chat thread","type":"object","oneOf":[{"required":["message"]},{"required":["media"]}],"properties":{"alertId":{"$ref":"#/components/schemas/AlertId"},"message":{"type":"string","description":"A text message to post to an alert's chat thread","examples":["Please evacuate the building immediately"]},"author":{"$ref":"#/components/schemas/User"},"location":{"description":"Location of the post. Accepts either:\n- **GeoLocation** (legacy): `{ \"latitude\": 32.4, \"longitude\": -96.8 }` or GeoJSON Point\n- **AlertLocation** (preferred): `{ \"point\": {...}, \"named\": {...}, \"resourceType\": \"panic_button\" }`\nBoth formats are supported for backwards compatibility.\n","oneOf":[{"$ref":"#/components/schemas/GeoLocation"},{"$ref":"#/components/schemas/AlertLocation"}]},"namedLocation":{"allOf":[{"$ref":"#/components/schemas/NamedLocation"}],"deprecated":true,"description":"Deprecated. Prefer using `location` with AlertLocation format:\n`{ \"location\": { \"named\": {...}, \"point\": {...} } }`\n"},"resourceType":{"allOf":[{"$ref":"#/components/schemas/ResourceType"}],"description":"Resource type for map pin display. Can also be nested inside `location`\nwhen using AlertLocation format. If both are provided, this flat value takes precedence.\n"},"media":{"type":"object","required":["contentType"],"properties":{"contentType":{"type":"string","description":"The content type of the media stream","examples":["image/jpeg"]},"content":{"type":"string","format":"binary","description":"The binary stream of the media file","examples":["<binary data>"]}}}},"examples":[{"alertId":"123456789","message":"Please evacuate the building immediately","location":{"latitude":37.7749,"longitude":-122.4194}}]},"AlertSource":{"description":"The specification of the triggering source system or vendor","type":"object","required":["id"],"properties":{"id":{"type":"string","examples":["vendor-123"]},"label":{"type":"string","examples":["Vendor Label"]},"description":{"type":"string","examples":["Description of the alert source; typically a vendor or branded system"]}},"additionalProperties":true},"GeoLocationLatitude":{"type":"number","format":"double","description":"The latitude in degrees (WGS84)","minimum":-90,"maximum":90,"examples":[37.7749]},"GeoLocationLongitude":{"type":"number","format":"double","description":"The longitude in degrees (WGS84)","minimum":-180,"maximum":180,"examples":[-122.4194]},"GeoLocationElevation":{"type":"number","format":"double","description":"The elevation of the location in meters from sea level.","examples":[50.2]},"GeoLocation":{"description":"Location point supporting both legacy format and GeoJSON Point (RFC 7946).\nClients can use either format; servers should accept both.\n\n**Legacy format:**\n```json\n{ \"latitude\": 37.7749, \"longitude\": -122.4194, \"elevation\": 50.2 }\n```\n\n**GeoJSON Point format:**\n```json\n{ \"type\": \"Point\", \"coordinates\": [-122.4194, 37.7749, 50.2] }\n```\n\nNote: GeoJSON uses [longitude, latitude, elevation] order.\n","oneOf":[{"$ref":"#/components/schemas/GeoLocationLegacy"},{"$ref":"#/components/schemas/GeoJsonPoint"}]},"GeoLocationLegacy":{"description":"Legacy location format with separate lat/lon properties","type":"object","required":["latitude","longitude"],"properties":{"latitude":{"$ref":"#/components/schemas/GeoLocationLatitude"},"longitude":{"$ref":"#/components/schemas/GeoLocationLongitude"},"elevation":{"$ref":"#/components/schemas/GeoLocationElevation"},"altitude":{"deprecated":true,"type":"number","format":"double","description":"Deprecated. Use elevation instead.","examples":[50.2]}}},"GeoJsonPoint":{"description":"GeoJSON Point geometry (RFC 7946)","type":"object","required":["type","coordinates"],"properties":{"type":{"type":"string","enum":["Point"],"examples":["Point"]},"coordinates":{"type":"array","description":"Position as [longitude, latitude, elevation (optional)]. Note GeoJSON uses lon/lat order.","items":{"type":"number"},"minItems":2,"maxItems":3,"examples":[[-122.4194,37.7749,50.2]]}}},"NamedLocation":{"description":"The predined location on the map (e.g., POI, area, room)","type":"object","oneOf":[{"required":["id"]},{"required":["name","scope","structure"]}],"properties":{"id":{"type":"string","format":"uuid","examples":["57857204-af71-4eb6-8368-311c70a5a9a8"]},"name":{"type":"string","examples":["The name of the location"]},"scope":{"type":"string","enum":["point","area","room","floor","building"],"examples":["room"]},"structure":{"type":"object","properties":{"room":{"type":"string","examples":["room-123"]},"floor":{"type":"string","examples":["floor-123"]},"building":{"type":"string","examples":["building-123"]}},"additionalProperties":true}}},"SafetyStatus":{"description":"Safety status for a user or location during an alert","type":"object","properties":{"safe":{"type":["string","null"],"enum":["safe","cleared","unsafe","unknown",null],"description":"The safety status of the user/location","examples":["safe"]},"needsMedicalAttention":{"type":"boolean","default":false,"description":"Whether medical attention is needed","examples":[false]}}},"ResourceType":{"description":"Type of resource/POI for map display","type":"string","enum":["aed","first_aid_kit","eyewash_station","emergency_oxygen","fire_extinguisher","fire_alarm_pull","fire_hose","emergency_exit","assembly_point","panic_button","lock_box","security_camera","emergency_phone","tornado_shelter","severe_weather_shelter","gas_shutoff","water_shutoff","electrical_panel","pin"],"examples":["panic_button"]},"ResourceMetadata":{"description":"Vendor-specific metadata stored with a resource/POI","type":"object","properties":{"image_url":{"type":"string","format":"uri","description":"URL of detection image (for security cameras)","examples":["https://example.com/detection-image.jpg"]},"user_id":{"type":"string","description":"UUID or ID of the user who triggered the alert","examples":["57857204-af71-4eb6-8368-311c70a5a9a8"]},"user_name":{"type":"string","description":"Display name of the user","examples":["John Doe"]},"user_email":{"type":"string","format":"email","description":"Email of the user","examples":["john.doe@example.com"]},"timestamp":{"type":"string","format":"date-time","description":"When the resource was created","examples":["2025-01-20T10:30:00Z"]}},"additionalProperties":true},"Error":{"type":"object","required":["message"],"properties":{"message":{"description":"A human readable error message","type":"string","examples":["Invalid input"]}}},"AlertNotFound":{"allOf":[{"$ref":"#/components/schemas/Error"}],"examples":[{"message":"Alert not found"}]},"SiteNotFound":{"allOf":[{"$ref":"#/components/schemas/Error"}],"examples":[{"message":"Site not found"}]},"InvalidInput":{"allOf":[{"$ref":"#/components/schemas/Error"}],"examples":[{"message":"Invalid input"}]},"Unexpected":{"allOf":[{"$ref":"#/components/schemas/Error"}],"examples":[{"message":"Internal server error"}]},"AlertTypeNotFound":{"allOf":[{"$ref":"#/components/schemas/Error"}],"examples":[{"message":"Alert type not found"}]},"PlanNotFound":{"allOf":[{"$ref":"#/components/schemas/Error"}],"examples":[{"message":"Guidance plan not found"}]},"LocationNotFound":{"allOf":[{"$ref":"#/components/schemas/Error"}],"examples":[{"message":"Location not found"}]},"UserNotFound":{"allOf":[{"$ref":"#/components/schemas/Error"}],"examples":[{"message":"User not found"}]},"AlertNotActive":{"allOf":[{"$ref":"#/components/schemas/Error"}],"examples":[{"message":"Alert is not active"}]},"AlertGone":{"allOf":[{"$ref":"#/components/schemas/Error"}],"examples":[{"message":"Alert cannot be restarted"}]}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT Authorization header using the Bearer scheme. examples: [\"Authorization: Bearer {token}\" |]\nJWT Specification: |\n{ |\n  \"header\": { |\n    \"alg\": \"HS256\", |\n    \"typ\": \"JWT\" |\n  }, |\n  \"body\": { |\n    \"iss\": \"aegix\", |\n    \"sub\": \"client-api\", |\n    \"aud\": ${vendor-id}, |\n    \"iat\": ${past-unix-epoch-time-in-seconds}, |\n    “exp”: ${future-unix-epoch-time-in-seconds}, |\n    “jti”: ${UUID-v4} |\n  } |\n}\n"}}},"security":[{"BearerAuth":[]}]}