# REST API (Pull)

{% hint style="success" %}
**API Version: 1.0**
{% endhint %}

Invoke REST API requests to our Incident Detection API endpoint and retrieve Incident Data according to your Rekor Command™ data consumption lifecycle.

The data includes a list of active incidents [customized](/command-intelligence-services/incident-detection-api/overview.md#customizations) based on user preferences.

## Credentials

To access the API, obtain a unique `client_id` and `client_secret` via registration. These credentials serve as the key authentication mechanism, establishing a secure and authorized connection between the client application and the Incidents API.

## Base URL

All API requests should be made to the following base URL:

[`https://api.command.rekor.one`](https://api.command.rekor.one/v1/incidents)

## Authentication

To access the Incidents API, you need to authenticate using a **Bearer Token**.

Obtain the token by making a POST request using the [obtained](#credentials) `client_id` and `client_secret` to the following endpoint:

## Used to get an Authentication Token&#x20;

<mark style="color:green;">`POST`</mark> [`https://api.command.rekor.one/v1/token`](https://api.command.rekor.one/v1/token)

Use the obtained `access_token` in the Authorization header for subsequent requests.

An `access_token` is valid for 24 hours.

#### Request Body

<table><thead><tr><th>Name</th><th width="244">Type</th><th>Description</th></tr></thead><tbody><tr><td>client_id<mark style="color:red;">*</mark></td><td>String</td><td>The Unique identifier of the Client</td></tr><tr><td>client_secret<mark style="color:red;">*</mark></td><td>String</td><td>The Secret of the Client</td></tr></tbody></table>

{% tabs %}
{% tab title="200: OK Success" %}

```json
{ 
   "access_token": "string", "token_type": "string" 
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid client\_id and/or client\_secret" %}

```
{
    "timestamp": timestamp,
    "path": "/v1/token",
    "status": 401,
    "error": "Unauthorized",
    "message": null,
    "requestId": string
}
```

{% endtab %}

{% tab title="500: Internal Server Error An Unknown Error has occurred" %}

```
{
    "timestamp": timestamp,
    "path": "/v1/token",
    "status": 500,
    "error": "Internal Server Error",
    "message": null,
    "requestId": string
}
```

{% endtab %}
{% endtabs %}

## Get Incidents

The API responds with a list of active incident information, customized based on user preferences. We also provide detailed [JSON Schema](/command-intelligence-services/incident-detection-api/schema-structure.md), if necessary.

Include the token obtained from the request in the authorization header using the "Bearer" scheme.

## Used to get Incident information

<mark style="color:blue;">`GET`</mark> [`https://api.command.rekor.one/v1/incidents`](https://api.command.rekor.one/v1/incidents)

The API responds with a list of active incident information.

#### Headers

<table><thead><tr><th width="181">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>Authorization<mark style="color:red;">*</mark></td><td>String</td><td>Bearer your_access_token</td></tr></tbody></table>

{% tabs %}
{% tab title="200: OK Success" %}

```json
[
    {
        "id": String,
        "incidentType": String,
        "incidentSubType": String,
        "atmsId": String,
        "createdBy": String,
        "reportedBy": String,
        "confirmedBy": String,
        "updatedBy": String,
        "clearedBy": String,
        "clearedReason": String,
        "location": {
            "long": Double,
            "lat": Double
        },
        "state": String,
        "county": String,
        "city": String,
        "roadType": String,
        "corridor": String,
        "direction": String,
        "orientation": String,
        "crossroad": String,
        "mileMarker": String,
        "startTime": String,
        "confirmedTime": String,
        "updateTime": String,
        "endTime": String,
        "affectedLanes": [
            {
                "laneNumber": Int,
                "laneType": String,
                "isClosed": Boolean,
                "updatedTime": String
            }
        ],
        "isFullClosure": Boolean,
        "injuries": Int,
        "fatalities": Int,
        "estimatedEndTime": String,
        "estimatedDurationMin": Int,
        "involvedVehicles": [
            {
                "id": String,
                "state": String,
                "color": String,
                "make": String,
                "model": String,
                "type": String,
                "licensePlate": String
            }
        ],
        "notes": [
            {
                "note": String,
                "updateTime": String,
                "updateBy": String
            }
        ],
        "unitResponse": [
            {
                "respondedBy": String,
                 "unitType": String,
                 "unitId": String,
                 "status": String,
                 "updateTime": String,
                 "mitigationStartTime": String,
                 "mitigationEndTime": String,
                 "mitigationReasons": [String]
            }
        ],
        "involvedVehiclesCount": Int,
        "severity": String,
        "impact": Object
    }
]
```

{% endtab %}

{% tab title="500: Internal Server Error An Unknown Error has occurred" %}

{% endtab %}
{% endtabs %}

For the full *Incident* schema specification, including the supported types and properties, review the [Schema Structure](/command-intelligence-services/incident-detection-api/schema-structure.md) page.

## Error Handling

In case of errors, the API will return appropriate HTTP status codes along with error details in the response body.


---

# 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.rekor.ai/command-intelligence-services/incident-detection-api/integration-methods/rest-api-pull.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.
