# Incidents

The emergencies Ella PSAP handles, each with its [calls](<https://docs.ellanetworks.com/psap/reference/api/calls/index.md>), [texts](<https://docs.ellanetworks.com/psap/reference/api/texts/index.md>) and [AML reports](<https://docs.ellanetworks.com/psap/reference/api/aml/index.md>).

## List Incidents

Returns the incidents that match a state, a number or a search, with a summary of their calls and texts.

| Method | Path |
| --- | --- |
| GET | `/api/v1/incidents` |

### Query Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `state` | string | `open`, `closed` for the closed incidents that were not merged, or `merged`. Default: all. |
| `number` | string | Only the incidents with a call or a text from or to this number, with or without `+`. |
| `start` | string | Only the incidents that started at or after this RFC 3339 time. |
| `end` | string | Only the incidents that started at or before this RFC 3339 time. Not before `start`. |
| `q` | string | Only the incidents whose ID, number or SIP `Call-ID` matches. Part of an ID or a number matches; digits alone match a number. Up to 200 characters. |
| `order` | string | `asc`, oldest first, or `desc`, newest first. Default: `asc`. |
| `limit` | integer | 1 to 500. Default: 100. |
| `wait` | integer | Seconds, 0 to 30, to wait for an incident when none matches. Default: 0. |

### Response Fields

| Field | Type | Description |
| --- | --- | --- |
| `items` | array | The incidents. |
| `items[].id` | string | The incident tracking identifier, `urn:emergency:uid:incidentid:<unique string>:<element ID>`. |
| `items[].state` | string | `open`, `closed`, or `merged` into another incident. |
| `items[].merged_into` | string | The ID of the incident this one was merged into. `null` otherwise. |
| `items[].closed_by` | string | Email of the call taker who closed or merged the incident. `null` while it is open. |
| `items[].numbers` | array | The numbers of the callers, of the phones that texted, and the number given when the incident was created, the first contact first. |
| `items[].calls` | integer | Calls of the incident, callbacks included. |
| `items[].texts` | integer | Texts of the incident, in both directions. |
| `items[].ringing` | boolean | A call of the incident rings. |
| `items[].live` | boolean | A call of the incident rings, calls the caller back, or is answered. |
| `items[].last_call` | string | The [state](<https://docs.ellanetworks.com/psap/reference/api/calls/index.md#states>) of the incident's latest call. `null` when it has none. |
| `items[].created_at` | string | Time the incident opened. |
| `items[].updated_at` | string | Time of the last change to the incident. |
| `items[].last_activity_at` | string | Time of the last change to the incident, its calls or its texts. |
| `items[].closed_at` | string | Time the incident closed. `null` while it is open. |
| `items[].location` | object | Where the emergency is, as a call taker set it. `null` until set, or once cleared. |
| `items[].location.shape` | object | Coordinates. `null` when only an address was given. |
| `items[].location.civic` | array | The address, as civic address elements. |
| `items[].location.method` | string | `Manual` when entered, else the method of the copied location. |
| `items[].location.verified` | boolean | The call taker verified the location. |
| `items[].location.source` | object | Where it came from, as in [Set the Emergency Location](<#set-the-emergency-location>). |
| `items[].location.set_by` | string | Email of the call taker who set it. |
| `items[].location.set_at` | string | Time it was set. |
| `items[].caller_location` | object | Where the caller is: the latest handset (AML) location of the incident's phones, else the first location of its latest call. `null` when none was received. |
| `items[].caller_location.source` | string | `aml` or `call`. |
| `items[].caller_location.id` | integer | ID of the AML report or of the call. |
| `items[].caller_location.at` | string | Time the AML report arrived, or the call last changed. |
| `items[].caller_location.location` | object | The location, as in a [call's locations](<https://docs.ellanetworks.com/psap/reference/api/calls/index.md>). |
| `items[].type` | string | The [incident type](<https://docs.ellanetworks.com/psap/reference/incident_codes/index.md#incident-types>). `null` until set. |
| `items[].type_label` | string | The description of the type. `null` until set. |
| `items[].disposition` | string | The [disposition](<https://docs.ellanetworks.com/psap/reference/incident_codes/index.md#dispositions>) of the last close, kept on reopen. `null` until first closed. |
| `items[].disposition_label` | string | The description of the disposition. `null` until first closed. |

### Sample Response

```
{
    "result": {
        "items": [
            {
                "id": "urn:emergency:uid:incidentid:01M8Y7CAN3N9GYZWWWAD7QMJSE:psap.example.org",
                "state": "open",
                "merged_into": null,
                "closed_by": null,
                "numbers": ["+16135550177"],
                "calls": 1,
                "texts": 0,
                "ringing": false,
                "live": false,
                "last_call": "abandoned",
                "created_at": "2026-12-03T15:11:46.520Z",
                "updated_at": "2026-12-03T15:11:46.520Z",
                "last_activity_at": "2026-12-03T15:11:50.611Z",
                "closed_at": null,
                "location": null,
                "caller_location": {
                    "source": "call",
                    "id": 12,
                    "at": "2026-12-03T15:11:50.611Z",
                    "location": {
                        "shape": {
                            "type": "Circle",
                            "positions": [{"latitude": 45.4215, "longitude": -75.6972}],
                            "radius": 50
                        },
                        "method": "Cell"
                    }
                },
                "type": "CARDIAC",
                "type_label": "Cardiac Related Event, Heart Attack, Chest Pain",
                "disposition": null,
                "disposition_label": null
            }
        ]
    }
}
```

## Create an Incident

Opens an incident with no call or text yet, for a person to call or text, and returns it.

| Method | Path |
| --- | --- |
| POST | `/api/v1/incidents` |

### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `number` | string | No | The number of the person, in international format, such as `+16135550100`. |

## Count Incidents

Returns how many incidents are open, and how many of those have a call in progress.

| Method | Path |
| --- | --- |
| GET | `/api/v1/incidents/counts` |

### Response Fields

| Field | Type | Description |
| --- | --- | --- |
| `open` | integer | Open incidents. |
| `active` | integer | Open incidents with a call that rings, calls the caller back, or is answered. |

## List the Incident Codes

Returns the [incident types and dispositions](<https://docs.ellanetworks.com/psap/reference/incident_codes/index.md>), each with its code and description.

| Method | Path |
| --- | --- |
| GET | `/api/v1/incidents/codes` |

### Response Fields

| Field | Type | Description |
| --- | --- | --- |
| `types[].code` | string | An incident type. |
| `types[].label` | string | Its description. |
| `dispositions[].code` | string | A disposition. |
| `dispositions[].label` | string | Its description. |

## Get an Incident

Returns one incident, with a summary of its calls and texts.

| Method | Path |
| --- | --- |
| GET | `/api/v1/incidents/{id}` |

## List an Incident's AML Reports

Returns the AML locations that the phones of the incident sent while it was open.

| Method | Path |
| --- | --- |
| GET | `/api/v1/incidents/{id}/aml` |

## Set the Incident Type

Sets the type of an open incident, and returns the incident.

| Method | Path |
| --- | --- |
| PUT | `/api/v1/incidents/{id}/type` |

### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | string | Yes | An [incident type](<https://docs.ellanetworks.com/psap/reference/incident_codes/index.md#incident-types>). |

## Set the Emergency Location

Sets where the emergency is on an open incident, and returns the incident.

| Method | Path |
| --- | --- |
| PUT | `/api/v1/incidents/{id}/location` |

### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `shape` | object | No | Coordinates, as a shape of a [call's locations](<https://docs.ellanetworks.com/psap/reference/api/calls/index.md>). |
| `civic` | array | No | The address, as `{name, value}` civic address elements of RFC 5139 and RFC 6848, at most 40. `country` is two upper case letters. |
| `verified` | boolean | No | The call taker verified the location. Default: `false`. |
| `source.kind` | string | Yes | `manual`, `call` or `aml`. |
| `source.call_id` | integer | For `call` | The call of the incident whose location was copied. |
| `source.index` | integer | For `call` | The position of the copied location among the call's locations, from 0. |
| `source.aml_id` | integer | For `aml` | The AML report of the incident whose location was copied. |

A location needs a shape, a civic address, or both.

### Sample Request

```
{
    "civic": [
        {"name": "HNO", "value": "12"},
        {"name": "RD", "value": "Main St"},
        {"name": "A3", "value": "Ottawa"},
        {"name": "country", "value": "CA"}
    ],
    "shape": {"type": "Point", "positions": [{"latitude": 45.4215, "longitude": -75.6972}]},
    "verified": true,
    "source": {"kind": "manual"}
}
```

## Clear the Emergency Location

Clears the emergency location of an open incident, and returns the incident.

| Method | Path |
| --- | --- |
| DELETE | `/api/v1/incidents/{id}/location` |

## List an Incident's Changes

Returns the type, emergency location, close, reopen and merge changes of an incident, oldest first.

| Method | Path |
| --- | --- |
| GET | `/api/v1/incidents/{id}/entries` |

### Response Fields

| Field | Type | Description |
| --- | --- | --- |
| `items[].kind` | string | `type`, `location`, `closed`, `reopened` or `merged`. |
| `items[].actor` | string | Email of the call taker. `null` when a call or text reopened the incident. |
| `items[].code` | string | The type set, or the disposition of the close. `null` otherwise. |
| `items[].label` | string | The description of `code`. `null` otherwise. |
| `items[].incident` | string | The ID of the incident merged into this one. `null` otherwise. |
| `items[].location` | object | The emergency location set, as in `location` of an incident. `null` otherwise, and when cleared. |
| `items[].created_at` | string | When it changed, in RFC 3339. |

## List an Incident's Notes

Returns the notes of an incident, oldest first.

| Method | Path |
| --- | --- |
| GET | `/api/v1/incidents/{id}/notes` |

### Response Fields

| Field | Type | Description |
| --- | --- | --- |
| `items[].id` | integer | ID of the note. |
| `items[].author` | string | Email of the user who wrote it. |
| `items[].text` | string | The note. |
| `items[].created_at` | string | When it was written, in RFC 3339. |

## Add a Note to an Incident

Adds a note to an open or closed incident, and returns it.

| Method | Path |
| --- | --- |
| POST | `/api/v1/incidents/{id}/notes` |

### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | string | Yes | The note, up to 4000 characters. Leading and trailing spaces are removed. |

### Sample Request

```
{
    "text": "Smoke on the second floor"
}
```

## Close an Incident

Closes an open incident without a call in progress, and returns it.

| Method | Path |
| --- | --- |
| POST | `/api/v1/incidents/{id}/close` |

### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `disposition` | string | Yes | A [disposition](<https://docs.ellanetworks.com/psap/reference/incident_codes/index.md#dispositions>). |
| `note` | string | No | A closing note, at most 4000 characters, added to the notes. |

## Call From an Incident

Calls a number from an open incident, through the SIP trunk of its latest emergency call or else the only enabled SIP trunk, and connects the call to the call taker's browser.

| Method | Path |
| --- | --- |
| POST | `/api/v1/incidents/{id}/call` |

### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `number` | string | Yes | The number to call, in international format. |
| `sdp` | string | Yes | A WebRTC SDP offer with an audio stream in PCMU, with all its ICE candidates. |

### Response Fields

| Field | Type | Description |
| --- | --- | --- |
| `id` | integer | ID of the call, a call of direction `out`. |
| `sdp` | string | The WebRTC SDP answer of Ella PSAP, with all its ICE candidates. |

## Reopen an Incident

Opens a closed incident that was not merged, and returns it.

| Method | Path |
| --- | --- |
| POST | `/api/v1/incidents/{id}/reopen` |

## Merge Incidents

Merges two open incidents into the older one, and returns it.

| Method | Path |
| --- | --- |
| POST | `/api/v1/incidents/{id}/merge` |

### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `with` | string | Yes | The ID of the other open incident. |

## Delete Incidents

Deletes every incident without a call in progress, with its calls and texts, and every AML report.

| Method | Path |
| --- | --- |
| DELETE | `/api/v1/incidents` |

## Get the Retention

Returns how long Ella PSAP keeps closed incidents and AML reports.

| Method | Path |
| --- | --- |
| GET | `/api/v1/incidents/retention` |

### Response Fields

| Field | Type | Description |
| --- | --- | --- |
| `max_age_days` | integer | Incidents closed more than this many days ago are deleted, with their calls and texts, and so are older AML reports. An open incident is kept. |

### Sample Response

```
{
    "result": {
        "max_age_days": 31
    }
}
```

## Update the Retention

Sets how long Ella PSAP keeps closed incidents and AML reports.

| Method | Path |
| --- | --- |
| PUT | `/api/v1/incidents/retention` |

### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `max_age_days` | integer | Yes | From 1 to 3650. |
