# Unread events

## API actions

API path: `/history/unread`.

### list

List less than or equal to `limit` of the latest user's unread history events. Described how it works in our [guide](https://www.navixy.com/docs/navixy-api/user-api/guides/rules-notifications/work-with-notifications#all-unread-events-of-a-user).

#### Parameters

| name  | description                                                                                                                                                     | type      |
| ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| limit | Optional. Limit of entries in response.                                                                                                                         | int       |
| from  | Optional. Start [date/time](https://www.navixy.com/docs/navixy-api/user-api/backend-api/..#data-types) for searching. Default `from` is **now** minus one year. | date/time |

Default and max limit is [history.maxLimit](https://www.navixy.com/docs/navixy-api/user-api/backend-api/resources/commons/dealer).

#### Examples

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

```sh
curl -X POST 'https://api.eu.navixy.com/v2/history/unread/list' \
    -H 'Content-Type: application/json' \
    -d '{"hash": "22eac1c27af4be7b9d04da2ce1af111b"}'
```

{% endtab %}

{% tab title="HTTP GET" %}
{% code overflow="wrap" %}

```http
https://api.eu.navixy.com/v2/history/unread/list?hash=a6aa75587e5c59c32d347da438505fc3
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Response

```json
{
  "success": true,
  "list": [
    {
      "id": 1,
      "type": "tracker",
      "is_read": false,
      "message": "Alarm",
      "time": "2020-01-01 00:00:00",
      "event": "offline",
      "tracker_id": 2,
      "rule_id": 3,
      "track_id": 4,
      "location": {
        "lat": 50.0,
        "lng": 60.0,
        "precision": 50
      },
      "address": "address",
      "extra": {
        "task_id": null,
        "parent_task_id": null,
        "counter_id": null,
        "service_task_id": null,
        "checkin_id": null,
        "place_ids": null,
        "last_known_location": false,
        "tracker_label": "Tracker label",
        "emergency": false,
        "employee_id": 4563
      }
    }
  ]
}
```

* `list` - array of objects. list of zero or more [Tracker history entry](https://www.navixy.com/docs/navixy-api/user-api/backend-api/resources/commons/index#tracker-history-entry) objects.

#### Errors

* 212 – Requested limit is too big (more [history.maxLimit](https://www.navixy.com/docs/navixy-api/user-api/backend-api/resources/commons/dealer) config option).

### `count`

Get count of user's unread history messages starting `from` date.

#### Parameters

| name | description                                                                                                                                                     | type                                                                              |
| ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| from | Optional. Start [date/time](https://www.navixy.com/docs/navixy-api/user-api/backend-api/..#data-types) for searching. Default `from` is **now** minus one year. | date/time                                                                         |
| type | Optional. Type of devices that should be count. Can be "socket", "tracker", or "camera".                                                                        | [enum](https://www.navixy.com/docs/navixy-api/user-api/backend-api/..#data-types) |

#### Examples

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

```sh
curl -X POST 'https://api.eu.navixy.com/v2/history/unread/count' \
    -H 'Content-Type: application/json' \
    -d '{"hash": "22eac1c27af4be7b9d04da2ce1af111b"}'
```

{% endtab %}

{% tab title="HTTP GET" %}
{% code overflow="wrap" %}

```http
https://api.eu.navixy.com/v2/history/unread/count?hash=a6aa75587e5c59c32d347da438505fc3
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Response

```json
{
  "success": true,
  "count": 1
}
```

#### Errors

* [General](https://www.navixy.com/docs/navixy-api/user-api/errors#error-codes) types only.
