# Incidents

Incidents: what went wrong, its timeline and how to act on it.

Its operations need the scopes `incidents.view` or `incidents.edit`.

**Endpoints**

- `GET/v1/incidents/{incident_uuid}`
- `GET/v1/incidents`
- `POST/v1/incidents/{incident_uuid}/acknowledge`
- `POST/v1/incidents/{incident_uuid}/resolve`

## The Incident object

### Attributes

- `uuid` (string): The incident’s uuid.
- `status` (string): One of `open`, `acknowledged`, `resolved`.
- `severity` (string): One of `warning`, `critical`.
- `message` (string): The incident’s message, as the alarm worded it when it fired.
- `rule_name` (string): The alarm’s own name, which tells apart two alarms on one metric.
- `rule_slug` (any): The slug of the catalogue rule behind the alarm; null once the alarm is gone.
- `metric_name` (any): The catalogue rule’s name; null once the alarm is gone.
- `scan_type` (any): The kind of scan that raises the incident, for a rule that is raised by scans; null otherwise.
- `entity` (object): The resource the incident is about, of any type that has alarms.
  - `type` (any): The type of the resource, such as `server`.
  - `uuid` (any): The uuid of the resource.
  - `name` (any): The name of the resource.
- `parent_entity` (object or null): The server of a volume, port or unit; null for every other entity.
  - `type` (string): The type of the server, such as `server`.
  - `uuid` (string): The uuid of the server.
  - `name` (string or null): The name of the server.
- `server` (object or null): The server the incident is about: the entity itself for a server incident, its server for a volume, port or unit; null for every other type, which has no server.
  - `uuid` (string): The uuid of the server.
  - `name` (string or null): The name of the server.
- `triggered_at` (integer or null): Epoch milliseconds. When the incident was triggered. An instant: epoch milliseconds, UTC.
- `acknowledged_at` (integer or null): Epoch milliseconds. When the incident was acknowledged; null while it has not been. An instant: epoch milliseconds, UTC.
- `acknowledged_by` (object or null): Who acknowledged the incident; null while it has not been.
  - `name` (string or null): The person’s display name; null when it is not known.
- `resolved_at` (integer or null): Epoch milliseconds. When the incident was resolved; null while it is open. An instant: epoch milliseconds, UTC.
- `resolved_by` (object or null): Who resolved the incident; null while it is open or when the system resolved it.
  - `name` (string or null): The person’s display name; null when it is not known.
- `resolved_by_system` (boolean): Whether the system resolved it (the condition cleared), not a person.
- `console_url` (string): The address of the incident’s page in the WatchTower15 console.
- `change_detail` (object): What changed when the incident fired, `{<field>: {old, new}}`, the stored normalised strings (an SSL instant as its text, the one exception to epoch milliseconds); `{}` with none. The WHOIS registrant fields are left out.
- `alarm_uuid` (string or null): The alarm the incident belongs to; null once it is gone.
- `trigger_scan_uuid` (string or null): The scan that raised the incident.
- `resolve_scan_uuid` (string or null): The scan that cleared it.
- `notification_sent_at` (integer or null): Epoch milliseconds: when notifications for the trigger were sent; null when none were. An instant: epoch milliseconds, UTC.
- `notification_held_at` (integer or null): Epoch milliseconds: when an alarm snooze on the incident’s resource (its server, that server’s profile or its service) held its triggered notification; null when none is held. Cleared when the snooze’s end releases it, or when it is acknowledged or resolved first. An instant: epoch milliseconds, UTC.
- `notifications` (array of objects): The notifications sent for the incident, one for each channel.
  - `channel` (string): The channel it went out on, such as `email` or `slack`: an open set.
  - `status` (string): How it went: `sent`, `failed`, `skipped` or `queued`, as the notifier records it; an open set.
  - `sent_at` (integer or null): Epoch milliseconds. When the notification was sent; null when it was not sent. An instant: epoch milliseconds, UTC.
- `unit_state` (object or null): The state of the systemd unit when the incident opened, so what it was doing is known after it recovers; null for an incident on anything else and for one opened before this was recorded.
  - `active_state` (string or null): systemd’s `ActiveState` of the unit when the incident opened.
  - `sub_state` (string or null): systemd’s `SubState` of the unit when the incident opened.
  - `result` (string or null): systemd’s `Result` of the unit when the incident opened; null when it was not reported (the unit was active or had not run).
  - `exit_code` (integer or null): The unit’s exit status when the incident opened (systemd’s `ExecMainStatus`, or the signal number when `result` is `signal` or `core-dump`); null when not reported.
  - `state_changed_at` (integer or null): Epoch milliseconds. When the unit’s state last changed, as it stood when the incident opened; null when not known. An instant: epoch milliseconds, UTC.
  - `active_entered_at` (integer or null): Epoch milliseconds. When the unit last entered `active`, as it stood when the incident opened; null when it has not since it was loaded. An instant: epoch milliseconds, UTC.
  - `inventory_at` (integer or null): Epoch milliseconds. When the agent reported the inventory this state was read from, at most one system-info interval before the incident opened. An instant: epoch milliseconds, UTC.

**The Incident object**

```json
{
  "uuid": "75666699-b77d-4631-b576-041e8102a55b",
  "status": "example",
  "severity": "example",
  "message": "example",
  "rule_name": "example",
  "rule_slug": null,
  "metric_name": null,
  "scan_type": null,
  "entity": {
    "type": null,
    "uuid": null,
    "name": null
  },
  "parent_entity": {
    "type": "example",
    "uuid": "75666699-b77d-4631-b576-041e8102a55b",
    "name": "example"
  },
  "server": {
    "uuid": "75666699-b77d-4631-b576-041e8102a55b",
    "name": "example"
  },
  "triggered_at": 1794214800000,
  "acknowledged_at": 1794214800000,
  "acknowledged_by": {
    "name": "example"
  },
  "resolved_at": 1794214800000,
  "resolved_by": {
    "name": "example"
  },
  "resolved_by_system": true,
  "console_url": "example",
  "change_detail": {},
  "alarm_uuid": "e3dec13b-3b7d-46bc-a5f3-e122d2ad3a75",
  "trigger_scan_uuid": "611023dd-f862-402c-ae45-76dd86bf8cf4",
  "resolve_scan_uuid": "bf235050-233d-40b5-9335-b7862e6b056b",
  "notification_sent_at": 1794214800000,
  "notification_held_at": 1794214800000,
  "notifications": [
    {
      "channel": "example",
      "status": "example",
      "sent_at": 1794214800000
    }
  ],
  "unit_state": {
    "active_state": "example",
    "sub_state": "example",
    "result": "example",
    "exit_code": 1,
    "state_changed_at": 1794214800000,
    "active_entered_at": 1794214800000,
    "inventory_at": 1794214800000
  }
}
```

## Get an incident

GET/v1/incidents/{incident\_uuid}

Returns one incident with what changed when it fired, the alarm it belongs to, the scans that raised and cleared it, and the notifications sent for it.

Needs the scope `incidents.view`.

### Path parameters

- `incident_uuid` (string (uuid), required): The uuid of the incident.

### Returns

`200 OK`:

The incident.

Each failure is a problem document with a stable `code`; the response panel's status selector shows each one this operation can answer, and [errors](https://developer.watchtower15.com/api/errors/) lists them all.

**GET /v1/incidents/{incident_uuid}**

curl:

```bash
curl https://rest.watchtower15.com/v1/incidents/ad1ce9ff-c6d0-475c-8f5f-afef44885f4b \
  -H "Authorization: Bearer $WT15_API_KEY"
```

PHP:

```php
$wt15 = WatchTower15\Client::fromEnvironment();

$incident = $wt15->incidents->view('ad1ce9ff-c6d0-475c-8f5f-afef44885f4b');
```

Node.js:

```ts
const wt15 = WatchTower15.fromEnvironment();

const result = await wt15.incidents.view('ad1ce9ff-c6d0-475c-8f5f-afef44885f4b');
```

Python:

```python
client = Client.from_environment()

result = client.incidents.view('ad1ce9ff-c6d0-475c-8f5f-afef44885f4b')
```

**Response (200 OK)**

```json
{
  "data": {
    "uuid": "75666699-b77d-4631-b576-041e8102a55b",
    "status": "example",
    "severity": "example",
    "message": "example",
    "rule_name": "example",
    "rule_slug": null,
    "metric_name": null,
    "scan_type": null,
    "entity": {
      "type": null,
      "uuid": null,
      "name": null
    },
    "parent_entity": {
      "type": "example",
      "uuid": "75666699-b77d-4631-b576-041e8102a55b",
      "name": "example"
    },
    "server": {
      "uuid": "75666699-b77d-4631-b576-041e8102a55b",
      "name": "example"
    },
    "triggered_at": 1794214800000,
    "acknowledged_at": 1794214800000,
    "acknowledged_by": {
      "name": "example"
    },
    "resolved_at": 1794214800000,
    "resolved_by": {
      "name": "example"
    },
    "resolved_by_system": true,
    "console_url": "example",
    "change_detail": {},
    "alarm_uuid": "e3dec13b-3b7d-46bc-a5f3-e122d2ad3a75",
    "trigger_scan_uuid": "611023dd-f862-402c-ae45-76dd86bf8cf4",
    "resolve_scan_uuid": "bf235050-233d-40b5-9335-b7862e6b056b",
    "notification_sent_at": 1794214800000,
    "notification_held_at": 1794214800000,
    "notifications": [
      {
        "channel": "example",
        "status": "example",
        "sent_at": 1794214800000
      }
    ],
    "unit_state": {
      "active_state": "example",
      "sub_state": "example",
      "result": "example",
      "exit_code": 1,
      "state_changed_at": 1794214800000,
      "active_entered_at": 1794214800000,
      "inventory_at": 1794214800000
    }
  }
}
```

**Response (401 Unauthorized)**

The API key is missing, malformed, expired or revoked.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/unauthorized/",
  "title": "Unauthorized",
  "status": 401,
  "code": "unauthorized",
  "detail": "The API key is missing, malformed, expired or revoked",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (403 Forbidden)**

The key or its owner does not hold what the operation needs.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/forbidden/",
  "title": "Forbidden",
  "status": 403,
  "code": "forbidden",
  "detail": "This key does not have the incidents.view scope",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (404 Not Found)**

No such record in this organisation (an absent id and another organisation's answer alike).

```json
{
  "type": "https://docs.watchtower15.com/api/errors/not_found/",
  "title": "Not found",
  "status": 404,
  "code": "not_found",
  "detail": "No record with that id exists in this organisation.",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (422 Unprocessable Content)**

The request is invalid (`invalid_request`; `errors` names the parameters).

```json
{
  "type": "https://docs.watchtower15.com/api/errors/invalid_request/",
  "title": "Invalid request",
  "status": 422,
  "code": "invalid_request",
  "detail": "The request is invalid",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "errors": {
    "name": [
      "The name field is required."
    ]
  }
}
```

**Response (429 Too Many Requests)**

A rate limit or the organisation's daily limit is reached; `Retry-After` says when to retry.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/rate_limited/",
  "title": "Rate limited",
  "status": 429,
  "code": "rate_limited",
  "detail": "Too many requests: the limit is 240 a minute",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "limit": 60
}
```

**Response (500 Internal Server Error)**

An unexpected error.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/internal_error/",
  "title": "Internal error",
  "status": 500,
  "code": "internal_error",
  "detail": "An unexpected error has happened",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

## List incidents

GET/v1/incidents

Lists the organisation’s incidents by when they were triggered, newest first unless `direction` is `asc`. Filter by `status`, by one resource with `entity_type` and `entity_uuid`, by metric source with `metric_source_uuids` (the incidents of those sources’ custom metrics), and by a time window; an incident is listed when it was open at any point inside the window. With no window, every incident is listed. Pages by `page` and `per_page` (`limit` is the same as `per_page`); every page carries `current_page`, `per_page`, `last_page` and `total`.

Needs the scope `incidents.view`.

### Query parameters

- `status` (array of strings or null): Only incidents in these statuses: any of `open`, `acknowledged` and `resolved`; with none, every status. A bare value is read as a one-item list. A list: repeat the parameter (`status=open&status=acknowledged`) or send one value (`status=open`); `status[]=open` is accepted too. Values:`open``acknowledged``resolved`(an open set: new values may be added)
- `entity_type` (string or null): The type of resource to list incidents of; required with `entity_uuid`. Alone, the incidents of every resource of that type. `server` includes each server’s volumes, ports and systemd units, with or without `entity_uuid` (on `GET /v1/organisation/alarms`, `entity_type=server` is the servers’ own alarms only). Values:`domain``service``server``log_source``custom_metric``database_instance``server_port``server_system_service``server_volume`(an open set: new values may be added)
- `entity_uuid` (string (uuid) or null): The uuid of the resource to list incidents of; it needs its `entity_type`.
- `direction` (string or null): The order by trigger time: `desc` (the default) is the newest first, `asc` the oldest first. Values:`asc``desc`(an open set: new values may be added)
- `period` (string or null): A relative window ending now: 1 to 9999 minutes, hours, days or weeks (`3h`, `2w`). Not with `from` and `to`. The operation names its longest window and its default.
- `from` (string or null): The start of a pinned window, epoch milliseconds or RFC 3339 with an offset. Needs `to`. A start before the oldest data kept is served from it.
- `to` (string or null): The end of a pinned window, epoch milliseconds or RFC 3339 with an offset, after `from`. A window that ends before the oldest data kept, or in the future, is refused.
- `limit` (integer or null): The same as `per_page`, kept for existing clients.
- `include_total` (string or null): Ignored: `total` is always present. Values:`true``false``1``0`(an open set: new values may be added)
- `metric_source_uuids` (array of strings or null): Only the incidents of these metric sources’ custom metrics, by source uuid, at most 100; a single uuid may be sent bare. A list: repeat the parameter (`metric_source_uuids=<uuid>&metric_source_uuids=<uuid>`) or send one value (`metric_source_uuids=<uuid>`); `metric_source_uuids[]=<uuid>` is accepted too.
- `rule_slug` (array of strings or null): Only incidents of alarms on these catalogue rules, by `rule_slug`; every rule when omitted. A bare value is read as a one-item list. An incident of an alarm that was since deleted is still listed. A list: repeat the parameter (`rule_slug=<value>&rule_slug=<value>`) or send one value (`rule_slug=<value>`); `rule_slug[]=<value>` is accepted too.
- `severity` (array of strings or null): Only incidents of these severities: `warning` or `critical`; every severity when omitted. A bare value is read as a one-item list. A list: repeat the parameter (`severity=warning&severity=critical`) or send one value (`severity=warning`); `severity[]=warning` is accepted too. Values:`warning``critical`(an open set: new values may be added)
- `per_page` (integer or null): How many incidents to return in one page, from 1 to 100.
- `page` (integer or null): The page to read, from 1; 1 when omitted. A page past the last answers no rows.

### Returns

`200 OK`:

One page of the organisation’s incidents.

Each item of the page:

- `uuid` (string): The incident’s uuid.
- `status` (string): One of `open`, `acknowledged`, `resolved`.
- `severity` (string): One of `warning`, `critical`.
- `message` (string): The incident’s message, as the alarm worded it when it fired.
- `rule_name` (string): The alarm’s own name, which tells apart two alarms on one metric.
- `rule_slug` (any): The slug of the catalogue rule behind the alarm; null once the alarm is gone.
- `alarm_uuid` (string or null): The uuid of the alarm that raised the incident; null when the alarm no longer resolves. The alarm may since have been deleted: `GET /v1/alarms/{alarm_uuid}` then answers 404.
- `metric_name` (any): The catalogue rule’s name; null once the alarm is gone.
- `scan_type` (any): The kind of scan that raises the incident, for a rule that is raised by scans; null otherwise.
- `entity` (object): The resource the incident is about, of any type that has alarms.
  - `type` (any): The type of the resource, such as `server`.
  - `uuid` (any): The uuid of the resource.
  - `name` (any): The name of the resource.
- `parent_entity` (object or null): The server of a volume, port or unit; null for every other entity.
  - `type` (string): The type of the server, such as `server`.
  - `uuid` (string): The uuid of the server.
  - `name` (string or null): The name of the server.
- `server` (object or null): The server the incident is about: the entity itself for a server incident, its server for a volume, port or unit; null for every other type, which has no server.
  - `uuid` (string): The uuid of the server.
  - `name` (string or null): The name of the server.
- `triggered_at` (integer or null): Epoch milliseconds. When the incident was triggered. An instant: epoch milliseconds, UTC.
- `acknowledged_at` (integer or null): Epoch milliseconds. When the incident was acknowledged; null while it has not been. An instant: epoch milliseconds, UTC.
- `acknowledged_by` (object or null): Who acknowledged the incident; null while it has not been.
  - `name` (string or null): The person’s display name; null when it is not known.
- `resolved_at` (integer or null): Epoch milliseconds. When the incident was resolved; null while it is open. An instant: epoch milliseconds, UTC.
- `resolved_by` (object or null): Who resolved the incident; null while it is open or when the system resolved it.
  - `name` (string or null): The person’s display name; null when it is not known.
- `resolved_by_system` (boolean): Whether the system resolved it (the condition cleared), not a person.
- `console_url` (string): The address of the incident’s page in the WatchTower15 console.
- `notifications` (array of objects): The notifications sent for the incident, one for each channel.
  - `channel` (string): The channel it went out on, such as `email` or `slack`: an open set.
  - `status` (string): How it went: `sent`, `failed`, `skipped` or `queued`, as the notifier records it; an open set.
  - `sent_at` (integer or null): Epoch milliseconds. When the notification was sent; null when it was not sent. An instant: epoch milliseconds, UTC.
- `unit_state` (object or null): The state of the systemd unit when the incident opened, so what it was doing is known after it recovers; null for an incident on anything else and for one opened before this was recorded.
  - `active_state` (string or null): systemd’s `ActiveState` of the unit when the incident opened.
  - `sub_state` (string or null): systemd’s `SubState` of the unit when the incident opened.
  - `result` (string or null): systemd’s `Result` of the unit when the incident opened; null when it was not reported (the unit was active or had not run).
  - `exit_code` (integer or null): The unit’s exit status when the incident opened (systemd’s `ExecMainStatus`, or the signal number when `result` is `signal` or `core-dump`); null when not reported.
  - `state_changed_at` (integer or null): Epoch milliseconds. When the unit’s state last changed, as it stood when the incident opened; null when not known. An instant: epoch milliseconds, UTC.
  - `active_entered_at` (integer or null): Epoch milliseconds. When the unit last entered `active`, as it stood when the incident opened; null when it has not since it was loaded. An instant: epoch milliseconds, UTC.
  - `inventory_at` (integer or null): Epoch milliseconds. When the agent reported the inventory this state was read from, at most one system-info interval before the incident opened. An instant: epoch milliseconds, UTC.

Each failure is a problem document with a stable `code`; the response panel's status selector shows each one this operation can answer, and [errors](https://developer.watchtower15.com/api/errors/) lists them all.

**GET /v1/incidents**

curl:

```bash
curl https://rest.watchtower15.com/v1/incidents \
  -H "Authorization: Bearer $WT15_API_KEY"
```

PHP:

```php
$wt15 = WatchTower15\Client::fromEnvironment();

foreach ($wt15->incidents->list()->autoPaging() as $incident) { echo $incident->uuid, "\n"; }
```

Node.js:

```ts
const wt15 = WatchTower15.fromEnvironment();

for await (const item of wt15.incidents.list()) {
  console.log(item.uuid);
}
```

Python:

```python
client = Client.from_environment()

for item in client.incidents.list():
    print(item.uuid)
```

**Response (200 OK)**

```json
{
  "data": [
    {
      "uuid": "75666699-b77d-4631-b576-041e8102a55b",
      "status": "example",
      "severity": "example",
      "message": "example",
      "rule_name": "example",
      "rule_slug": null,
      "alarm_uuid": "e3dec13b-3b7d-46bc-a5f3-e122d2ad3a75",
      "metric_name": null,
      "scan_type": null,
      "entity": {
        "type": null,
        "uuid": null,
        "name": null
      },
      "parent_entity": {
        "type": "example",
        "uuid": "75666699-b77d-4631-b576-041e8102a55b",
        "name": "example"
      },
      "server": {
        "uuid": "75666699-b77d-4631-b576-041e8102a55b",
        "name": "example"
      },
      "triggered_at": 1794214800000,
      "acknowledged_at": 1794214800000,
      "acknowledged_by": {
        "name": "example"
      },
      "resolved_at": 1794214800000,
      "resolved_by": {
        "name": "example"
      },
      "resolved_by_system": true,
      "console_url": "example",
      "notifications": [
        {
          "channel": "example",
          "status": "example",
          "sent_at": 1794214800000
        }
      ],
      "unit_state": {
        "active_state": "example",
        "sub_state": "example",
        "result": "example",
        "exit_code": 1,
        "state_changed_at": 1794214800000,
        "active_entered_at": 1794214800000,
        "inventory_at": 1794214800000
      }
    }
  ],
  "current_page": 1,
  "per_page": 1,
  "last_page": 1,
  "total": 1
}
```

**Response (401 Unauthorized)**

The API key is missing, malformed, expired or revoked.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/unauthorized/",
  "title": "Unauthorized",
  "status": 401,
  "code": "unauthorized",
  "detail": "The API key is missing, malformed, expired or revoked",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (403 Forbidden)**

The key or its owner does not hold what the operation needs.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/forbidden/",
  "title": "Forbidden",
  "status": 403,
  "code": "forbidden",
  "detail": "This key does not have the incidents.view scope",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (404 Not Found)**

No such record in this organisation (an absent id and another organisation's answer alike).

```json
{
  "type": "https://docs.watchtower15.com/api/errors/not_found/",
  "title": "Not found",
  "status": 404,
  "code": "not_found",
  "detail": "No record with that id exists in this organisation.",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (422 Unprocessable Content)**

The request is invalid (`invalid_request`; `errors` names the parameters).

```json
{
  "type": "https://docs.watchtower15.com/api/errors/invalid_request/",
  "title": "Invalid request",
  "status": 422,
  "code": "invalid_request",
  "detail": "The request is invalid",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "errors": {
    "name": [
      "The name field is required."
    ]
  }
}
```

**Response (429 Too Many Requests)**

A rate limit or the organisation's daily limit is reached; `Retry-After` says when to retry.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/rate_limited/",
  "title": "Rate limited",
  "status": 429,
  "code": "rate_limited",
  "detail": "Too many requests: the limit is 240 a minute",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "limit": 60
}
```

**Response (500 Internal Server Error)**

An unexpected error.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/internal_error/",
  "title": "Internal error",
  "status": 500,
  "code": "internal_error",
  "detail": "An unexpected error has happened",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

## Acknowledge an incident

POST/v1/incidents/{incident\_uuid}/acknowledge

Acknowledges an open incident, as the console’s Acknowledge does, and records the key’s user as who acknowledged it. The call is safe to repeat: `changed` says whether it changed anything, and is false for an incident that was no longer open.

Needs the scope `incidents.edit`.

### Headers

- `Idempotency-Key` (string): Any text of 1 to 255 visible ASCII characters. A repeat of the same request within 24 hours returns the first answer without running again (the response carries `Idempotent-Replayed: true`); the same key on a different request is refused 422 `invalid_request`.

### Path parameters

- `incident_uuid` (string (uuid), required): The uuid of the incident.

### Returns

`200 OK`:

The incident after the call, with whether the call changed it.

Each failure is a problem document with a stable `code`; the response panel's status selector shows each one this operation can answer, and [errors](https://developer.watchtower15.com/api/errors/) lists them all.

**POST /v1/incidents/{incident_uuid}/acknowledge**

curl:

```bash
curl -X POST https://rest.watchtower15.com/v1/incidents/ad1ce9ff-c6d0-475c-8f5f-afef44885f4b/acknowledge \
  -H "Authorization: Bearer $WT15_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

PHP:

```php
$wt15 = WatchTower15\Client::fromEnvironment();

$result = $wt15->incidents->acknowledge('ad1ce9ff-c6d0-475c-8f5f-afef44885f4b');
```

Node.js:

```ts
const wt15 = WatchTower15.fromEnvironment();

const result = await wt15.incidents.acknowledge('ad1ce9ff-c6d0-475c-8f5f-afef44885f4b');
```

Python:

```python
client = Client.from_environment()

result = client.incidents.acknowledge('ad1ce9ff-c6d0-475c-8f5f-afef44885f4b')
```

**Response (200 OK)**

```json
{
  "data": {
    "uuid": "75666699-b77d-4631-b576-041e8102a55b",
    "status": "example",
    "changed": true,
    "acknowledged_at": 1794214800000,
    "acknowledged_by": {
      "name": "example"
    }
  }
}
```

**Response (401 Unauthorized)**

The API key is missing, malformed, expired or revoked.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/unauthorized/",
  "title": "Unauthorized",
  "status": 401,
  "code": "unauthorized",
  "detail": "The API key is missing, malformed, expired or revoked",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (403 Forbidden)**

The key or its owner does not hold what the operation needs.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/forbidden/",
  "title": "Forbidden",
  "status": 403,
  "code": "forbidden",
  "detail": "This key does not have the incidents.edit scope",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (404 Not Found)**

No such record in this organisation (an absent id and another organisation's answer alike).

```json
{
  "type": "https://docs.watchtower15.com/api/errors/not_found/",
  "title": "Not found",
  "status": 404,
  "code": "not_found",
  "detail": "No record with that id exists in this organisation.",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (422 Unprocessable Content)**

The request is invalid; `errors` names the parameters.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/invalid_request/",
  "title": "Invalid request",
  "status": 422,
  "code": "invalid_request",
  "detail": "The request is invalid",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "errors": {
    "name": [
      "The name field is required."
    ]
  }
}
```

**Response (429 Too Many Requests)**

A rate limit or the organisation's daily limit is reached; `Retry-After` says when to retry.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/rate_limited/",
  "title": "Rate limited",
  "status": 429,
  "code": "rate_limited",
  "detail": "Too many requests: the limit is 240 a minute",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "limit": 60
}
```

**Response (500 Internal Server Error)**

An unexpected error.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/internal_error/",
  "title": "Internal error",
  "status": 500,
  "code": "internal_error",
  "detail": "An unexpected error has happened",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

## Resolve an incident

POST/v1/incidents/{incident\_uuid}/resolve

Resolves an incident by hand, as the console’s Resolve does, and records the key’s user as who resolved it. `changed` says whether the call changed anything, and `resolution` says how WatchTower15 will treat the condition afterwards. Repeating the call on a resolved incident changes nothing.

Needs the scope `incidents.edit`.

### Headers

- `Idempotency-Key` (string): Any text of 1 to 255 visible ASCII characters. A repeat of the same request within 24 hours returns the first answer without running again (the response carries `Idempotent-Replayed: true`); the same key on a different request is refused 422 `invalid_request`.

### Path parameters

- `incident_uuid` (string (uuid), required): The uuid of the incident.

### Returns

`200 OK`:

The incident after the call, with whether the call changed it and how the condition is treated.

Each failure is a problem document with a stable `code`; the response panel's status selector shows each one this operation can answer, and [errors](https://developer.watchtower15.com/api/errors/) lists them all.

**POST /v1/incidents/{incident_uuid}/resolve**

curl:

```bash
curl -X POST https://rest.watchtower15.com/v1/incidents/ad1ce9ff-c6d0-475c-8f5f-afef44885f4b/resolve \
  -H "Authorization: Bearer $WT15_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

PHP:

```php
$wt15 = WatchTower15\Client::fromEnvironment();

$result = $wt15->incidents->resolve('ad1ce9ff-c6d0-475c-8f5f-afef44885f4b');
```

Node.js:

```ts
const wt15 = WatchTower15.fromEnvironment();

const result = await wt15.incidents.resolve('ad1ce9ff-c6d0-475c-8f5f-afef44885f4b');
```

Python:

```python
client = Client.from_environment()

result = client.incidents.resolve('ad1ce9ff-c6d0-475c-8f5f-afef44885f4b')
```

**Response (200 OK)**

```json
{
  "data": {
    "uuid": "75666699-b77d-4631-b576-041e8102a55b",
    "status": "example",
    "changed": true,
    "resolved_at": 1794214800000,
    "resolved_by": {
      "name": "example"
    },
    "resolution": null
  }
}
```

**Response (401 Unauthorized)**

The API key is missing, malformed, expired or revoked.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/unauthorized/",
  "title": "Unauthorized",
  "status": 401,
  "code": "unauthorized",
  "detail": "The API key is missing, malformed, expired or revoked",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (403 Forbidden)**

The key or its owner does not hold what the operation needs.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/forbidden/",
  "title": "Forbidden",
  "status": 403,
  "code": "forbidden",
  "detail": "This key does not have the incidents.edit scope",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (404 Not Found)**

No such record in this organisation (an absent id and another organisation's answer alike).

```json
{
  "type": "https://docs.watchtower15.com/api/errors/not_found/",
  "title": "Not found",
  "status": 404,
  "code": "not_found",
  "detail": "No record with that id exists in this organisation.",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

**Response (422 Unprocessable Content)**

The request is invalid; `errors` names the parameters.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/invalid_request/",
  "title": "Invalid request",
  "status": 422,
  "code": "invalid_request",
  "detail": "The request is invalid",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "errors": {
    "name": [
      "The name field is required."
    ]
  }
}
```

**Response (429 Too Many Requests)**

A rate limit or the organisation's daily limit is reached; `Retry-After` says when to retry.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/rate_limited/",
  "title": "Rate limited",
  "status": 429,
  "code": "rate_limited",
  "detail": "Too many requests: the limit is 240 a minute",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d",
  "limit": 60
}
```

**Response (500 Internal Server Error)**

An unexpected error.

```json
{
  "type": "https://docs.watchtower15.com/api/errors/internal_error/",
  "title": "Internal error",
  "status": 500,
  "code": "internal_error",
  "detail": "An unexpected error has happened",
  "request_id": "4d1e8b7a-2c9f-4a3e-b6d5-7f0c1a2e3b4d"
}
```

Source: https://developer.watchtower15.com/api/reference/incidents/
