# New Dispatch

{% hint style="warning" %}
This API endpoint requires the **plus** version of Sonoran CAD or higher. For more information, see our [pricing ](/cad/pricing/faq.md)page.
{% endhint %}

## New Dispatch

<mark style="color:green;">`POST`</mark> `https://api.sonorancad.com/emergency/new_dispatch`

The unit location API endpoint allows you to create and assign a new dispatch.

#### Request Body

| Name | Type   | Description               |
| ---- | ------ | ------------------------- |
| id   | string | Your community's ID       |
| key  | string | Your community's API Key  |
| type | string | NEW\_DISPATCH             |
| data | array  | Array of dispatch objects |

{% tabs %}
{% tab title="200 A successful call will be met with the following response:" %}

```
NEW DISPATCH CREATED - ID: {CallId}
```

{% endtab %}

{% tab title="400 The following 400 errors may be sent in response:" %}

```http
INVALID REQUEST TYPE
INVALID COMMUNITY ID
API IS NOT ENABLED FOR THIS COMMUNITY
INVALID API KEY
```

{% endtab %}
{% endtabs %}

```javascript
{
    "id": "YOUR_COMMUNITY_ID",
    "key": "YOUR_API_KEY",
    "type": "NEW_DISPATCH",
    "data": [
        {
            "serverId": 1, // Default 1 - See guide on setting up multiple servers
            "origin": 0, // See ORIGIN Enum
            "status": 0, // See STATUS Enum
            "priority": 1, // 1, 2, or 3
            "block": "123",
            "address": "4234 E. Example Ave",
            "postal": "456",
            "title": "Traffic Stop",
            "code": "10-39 - Traffic Stop",
            "primary": 123, // Primary unit identifier on the call
            "trackPrimary": true, // Track the primary unit in-game with the Dispatch Notify plugin
            "description": "Traffic Stop - Blue Sedan - XP123BS",
            "notes": [], // Array of call note objects
            "metaData": {
                "someKey": "someValue" // OPTIONAL: metaData for API custom storage
            },
            "units": ["STEAM:1234"], // Array of API IDs
            "deleteAfterMinutes": 30 // OPTIONAL: Delete record after X minutes (temporary record)
        },
    ]
}
```

{% hint style="info" %}
The "Primary" unit field in the new dispatch is set to the first unit in the `units` array, if it exists.
{% endhint %}

### Enumeration Values

Sonoran CAD uses integer enumeration values for the `origin` and `status` fields. See the tables below for more information.

{% tabs %}
{% tab title="ORIGIN" %}

| Integer (Enumeration) Value | Origin Description |
| --------------------------- | ------------------ |
| 0                           | CALLER             |
| 1                           | RADIO DISPATCH     |
| 2                           | OBSERVED           |
| 3                           | WALK\_UP           |
| {% endtab %}                |                    |

{% tab title="STATUS" %}

| Integer (Enumeration) Value | Status Description |
| --------------------------- | ------------------ |
| 0                           | PENDING            |
| 1                           | ACTIVE             |
| 2                           | CLOSED             |
| {% endtab %}                |                    |
| {% endtabs %}               |                    |

### Note Object

Call notes are formatted on dispatch calls with the following object:

```json
{
    "time": "12:00:00",
    "label": "A-10",
    "type": "text",
    "content": "This is a note!"
}
```


---

# 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.sonoransoftware.com/cad/api-integration/api-endpoints/emergency/dispatch-and-emergency-calls/new-dispatch.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.
