# Imperial Emergency API & Exports

***

### ⚙️ 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.imperialcad.app/api-and-integrations/api-integrations/api-endpoints-and-exports/imperial-emergency-api-and-exports.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
