# Integration

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

Invoke REST API requests to our WZDx (Version 4.2) Service API endpoint and retrieve Work Zone Data according to your Rekor Command™ data consumption lifecycle.

The data includes a list of Work Zones customized 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 Work Zone Activity API.

## Base URL

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

<mark style="color:green;">`POST`</mark> `https://api.command.rekor.one`

## Authentication

To access the Work Zone Activity 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:blue;">`POST`</mark> `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 10 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" %}

```json
{
    "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" %}

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

{% endtab %}
{% endtabs %}

## Get Work Zones

The API responds with a list of active incident information, customized based on user preferences. We also provide detailed [JSON Schema](https://docs.rekor.ai/command-intelligence-services/work-zone-activity-api/schema-structure), if necessary.

Include the obtained token from the `/token` request in the Authorization header using the "Bearer" scheme.

## Used to get Work Zone Activity information

<mark style="color:blue;">`GET`</mark> `https://api.command.rekor.one/v1/workzones`

The API responds with a list of active work zone information.

### Headers

| Name                                            | Type   | Description                |
| ----------------------------------------------- | ------ | -------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer your\_access\_token |

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

```json
{
    "type": "String",
    "feed_info": {
        "update_date": "String",
        "publisher": "String",
        "contact_name": "String",
        "contact_email": "String",
        "version": "String",
        "license": "String",
        "data_sources": [
            {
                "data_source_id": "String",
                "organization_name": "String"
            }
        ]
    },
    "features": [
        {
            "type": "String",
            "geometry": {
                "type": "String",
                "coordinates": [
                    [
                        "Double",
                        "Double"
                    ], 
                    [
                        "Double",
                        "Double"
                    ], 
                ]
            },
            "id": "String",
            "bbox": [
                "Double",
                "Double",
                "Double",
                "Double"
            ],
            "properties": {
                "core_details": {
                    "event_type": "String",
                    "data_source_id": "String",
                    "road_names": [
                        "String"
                    ],
                    "direction": "String",
                    "name": "String",
                    "description": "String",
                    "creation_date": "String",
                    "update_date": "String"
                },
                "start_date": "String",
                "end_date": "String",
                "is_start_date_verified": "Boolean",
                "is_end_date_verified": "Boolean",
                "is_start_position_verified": "Boolean",
                "is_end_position_verified": "Boolean",
                "work_zone_type": "String",
                "location_method": "String",
                "vehicle_impact": "String",
                "lanes": [
                    {
                        "order": "Int",
                        "type": "String",
                        "status": "String"
                    },
                    {
                        "order": "Int",
                        "type": "String",
                        "status": "String"
                    }
                ],
                "beginning_cross_street": "String",
                "ending_cross_street": "String",
                "beginning_milepost": "Double",
                "types_of_work": [
                    {
                        "type_name": "String"
                    }
                ],
                "worker_presence": {
                    "are_workers_present": "Boolean",
                    "method": "String",
                    "worker_presence_last_confirmed_date": "String",
                    "confidence": "String"
                }
            }
        }
    ]
}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

For the full work zone schema specification, including the supported types and properties, review the [Schema Structure](https://docs.rekor.ai/command-intelligence-services/work-zone-activity-api/schema-structure) page.

## Error Handling

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