> For the complete documentation index, see [llms.txt](https://docs.imperialcad.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.imperialcad.app/api-and-integrations/api-integrations/api-endpoints-and-exports/imperial-emergency-api-and-exports.md). Agents can also search and read this documentation through its [MCP server](https://docs.imperialcad.app/~gitbook/mcp).

# Imperial Emergency API & Exports

The ImperialEmergency module allows a FiveM server to create and manage 911 calls, panic signals, call notes, unit status, and vehicle lookups. These functions use ImperialCAD's secure backend API.

***

### ⚙️ Setup

Add the following to your `server.cfg`:

```bash
setr imperial_community_id "YOUR_COMMUNITY_ID"
set imperialAPI "YOUR_API_SECRET"
```

Enable debug output:

```lua
Config.debug = true
```

***

### 📢 Exports & Examples

***

#### 🔊 `Create911Call(data, callback)`

Creates a standard 911 call. This includes flashing lights and audio in the LEO MDC.

**Required Fields**

| Field       | Type   | Description      |
| ----------- | ------ | ---------------- |
| name        | string | Caller name      |
| street      | string | Street name      |
| crossStreet | string | Cross street     |
| postal      | string | Postal code      |
| city        | string | City             |
| county      | string | County           |
| info        | string | Call description |

**Example**

```lua
exports["ImperialCAD"]:Create911Call({
  name = "Caller Name",
  street = "Main St",
  crossStreet = "2nd Ave",
  postal = "102",
  city = "Los Santos",
  county = "Los Santos County",
  info = "Suspicious vehicle parked on the curb"
}, function(success, res)
  print(success and "Call sent!" or ("Failed: " .. res))
end)
```

**Example Response**

```json
{
  "status": "success",
  "response": {
    "callId": "A1B2C3D4E5",
    "callnum": 203
  }
}
```

***

#### ❌ `DeleteCall(data, callback)`

Deletes an active call using its `callId`.

**Required Fields**

| Field     | Type   |
| --------- | ------ |
| callId    | string |
| discordId | string |

**Example**

```lua
exports["ImperialCAD"]:DeleteCall({
  callId = "A1B2C3D4E5",
  discordId = "123456789012345678"
}, function(success, res)
  print(success and "Call deleted." or ("Failed: " .. res))
end)
```

**Example Response**

```json
"Call ID A1B2C3D4E5 closed"
```

***

#### ✅ `CreateCall(data, callback)`

Creates a call manually (non-911) with custom status and priority.

**Required Fields**

| Field            | Type   |
| ---------------- | ------ |
| users\_discordID | string |
| street           | string |
| crossStreet      | string |
| postal           | string |
| city             | string |
| county           | string |
| info             | string |
| nature           | string |
| status           | string |
| priority         | number |

**Example**

```lua
exports["ImperialCAD"]:CreateCall({
  users_discordID = "123456789012345678",
  street = "Broadway",
  crossStreet = "5th St",
  postal = "309",
  city = "Los Santos",
  county = "Blaine",
  info = "Disturbance reported",
  nature = "Disturbance",
  status = "PENDING",
  priority = 2
}, function(success, res)
  print(success and "Call created." or ("Failed: " .. res))
end)
```

**Example Response**

```json
{
  "status": "success",
  "response": {
    "callId": "F9G8H7I6J5",
    "callnum": 204
  }
}
```

***

#### ➕ `AttachCall(data, callback)`

Attaches a unit to an active call.

**Required Fields**

| Field            | Type   |
| ---------------- | ------ |
| users\_discordID | string |
| callnum          | number |

**Example**

```lua
exports["ImperialCAD"]:AttachCall({
  users_discordID = "123456789012345678",
  callnum = 204
}, function(success, res)
  print(success and "Unit attached." or ("Failed: " .. res))
end)
```

***

#### ✍️ `NewCallNote(data, callback)`

Adds a note to the user's currently assigned call.

**Required Fields**

| Field            | Type   |
| ---------------- | ------ |
| users\_discordID | string |
| description      | string |

**Example**

```lua
exports["ImperialCAD"]:NewCallNote({
  users_discordID = "123456789012345678",
  description = "Caller updated: suspects have left the area."
}, function(success, res)
  print(success and "Note added." or ("Failed: " .. res))
end)
```

***

#### ❌ `Booter(data, callback)`

Sets a unit off-duty (removes from all assignments).

**Required Fields**

| Field            | Type   |
| ---------------- | ------ |
| users\_discordID | string |

**Example**

```lua
exports["ImperialCAD"]:Booter({
  users_discordID = "123456789012345678"
}, function(success, res)
  print(success and "User off-duty." or ("Failed: " .. res))
end)
```

***

#### ⚠️ `Panic(data, callback)`

Triggers a panic alert from a unit.

**Required Fields**

| Field            | Type   |
| ---------------- | ------ |
| users\_discordID | string |
| street           | string |
| postal           | string |

**Example**

```lua
exports["ImperialCAD"]:Panic({
  users_discordID = "123456789012345678",
  street = "Mission Row",
  postal = "203"
}, function(success, res)
  print(success and "Panic sent!" or ("Failed: " .. res))
end)
```

***

#### ❎ `ClearPanic(callback)`

Clears an active panic alert for your community.

**Example**

```lua
exports["ImperialCAD"]:ClearPanic(function(success, res)
  print(success and "Panic cleared." or ("Failed: " .. res))
end)
```

***

#### 🔢 `CheckPlate(data, callback)`

Checks a plate in CAD records.

**Required Fields**

| Field | Type   |
| ----- | ------ |
| plate | string |

**Example**

```lua
exports["ImperialCAD"]:CheckPlate({
  plate = "XYZ123"
}, function(success, res)
  if success then
    local result = json.decode(res)
    print("Plate Registered To: " .. result.response.owner)
  else
    print("Failed to check plate.")
  end
end)
```

**Example Response**

```json
{
  "status": "success",
  "response": {
    "owner": "John Doe",
    "plate_number": "XYZ123",
    "stolen": false,
    "insurance": true,
    "insurance_status": "Active",
    "business": false,
    "reg_status": "Valid"
  }
}
```

***

### 🔗 API Reference

All API's will use the same format of "<https://imperialcad.app/api/1.1/wf/>" and then the provided API Endpoint as provided below.

`TYPE` `https://imperialcad.app/api/1.1/wf/<API_GOES_HERE>`

<table><thead><tr><th width="90">TYPE</th><th>Export Name</th><th>API Endpoint</th></tr></thead><tbody><tr><td><strong>POST</strong></td><td><code>Create911Call</code></td><td><code>911</code></td></tr><tr><td><strong>POST</strong></td><td><code>CreateCall</code></td><td><code>CallCreate</code></td></tr><tr><td><strong>POST</strong></td><td><code>DeleteCall</code></td><td><code>CallDelete</code></td></tr><tr><td><strong>POST</strong></td><td><code>AttachCall</code></td><td><code>AttachCall</code></td></tr><tr><td><strong>POST</strong></td><td><code>NewCallNote</code></td><td><code>callnote</code></td></tr><tr><td><strong>POST</strong></td><td><code>Booter</code></td><td><code>offduty</code></td></tr><tr><td><strong>POST</strong></td><td><code>Panic</code></td><td><code>panic</code></td></tr><tr><td><strong>POST</strong></td><td><code>ClearPanic</code></td><td><code>clearpanic</code></td></tr><tr><td><strong>POST</strong></td><td><code>CheckPlate</code></td><td><code>checkplate</code></td></tr></tbody></table>

***

### 🔐 API Authorization

All `POST` endpoints require the following header:

```json
{
  "Content-Type": "application/json",
  "APIKEY": GetConvar("imperialAPI", "")
}
```

***

### 👉 License

© Imperial Solutions. Unauthorized distribution or use is prohibited.
