> For the complete documentation index, see [llms.txt](https://cde-inc.gitbook.io/cde-cad-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cde-inc.gitbook.io/cde-cad-documentation/fivem-developer-integration/call-lifecycle.md). Agents can also search and read this documentation through its [MCP server](https://cde-inc.gitbook.io/cde-cad-documentation/~gitbook/mcp).

# Call Lifecycle

## Update a Call

```
PATCH /api/fivem/call/:incidentNumber
```

### Request Body

```json
{
  "communityId": "DISCORD_GUILD_ID",
  "status": "on-scene",          // optional: pending, assigned, enroute, on-scene, closed, cancelled
  "notes": "Suspect detained",   // optional: string or array of strings, appended to call notes
  "assignedUnits": ["1-A-12"]    // optional: replaces assigned units
}
```

### Response

```json
{
  "incidentNumber": "INC-1717012345678",
  "status": "on-scene",
  "callType": "ROBBERY",
  "location": "Legion Square",
  "assignedUnits": ["1-A-12"]
}
```

Emits `call-updated` Socket.IO event.

## Assign to a Call (Self-Assign)

```
POST /api/fivem/call/:incidentNumber/assign
```

Attaches an on-duty officer to a call: the dispatch "respond" button. The officer is identified by Discord ID and must be a member of the community. Enforced server-side.

### Request Body

```json
{ "discordId": "DISCORD_USER_ID" }
```

### Response

```json
{
  "success": true,
  "incidentNumber": "INC-1717012345678",
  "status": "assigned",
  "assigned": true,
  "assignedUnits": [ { "unitId": "665f0a1b2c3d4e5f6a7b8c9d", "status": "assigned" } ]
}
```

`assigned` is `false` if the officer was already on the call. A `pending` call moves to `assigned`. Emits `call-updated`. Returns `404` if the call doesn't exist and `409` if it's already closed.

## Close a Call

```
POST /api/fivem/call/:incidentNumber/close
```

### Request Body

```json
{
  "communityId": "DISCORD_GUILD_ID",
  "resolution": "Suspect arrested, vehicle impounded" // optional
}
```

### Response

```json
{ "success": true, "incidentNumber": "INC-1717012345678" }
```

Sets `status` to `closed` and stamps `clearedAt`. Emits `call-updated`.
