# /events/list

<img src="https://1793946085-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LpgT4ViDhP33dpxyTTr%2F-M5VL4avA8wYY_3T7hc6%2F-M5VUbC0pXukjxeyjAz2%2Fpost-badge.png?alt=media&#x26;token=c2683668-accd-429b-b5e3-505dd5e93d1d" alt="" data-size="line">**`https://api.intserv.se/v1/events/list`**

Fetches event history from the access control systems the integration has permission to. Events that indicates access granted and access denied is currenly supported.

> Authentication Type: Integration API Key

### :envelope\_with\_arrow:Request Body Parameters

| Field                                 | Type                  | Description                                                                                                                   |
| ------------------------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| <p><code>from\_date</code></p><p></p> | <p>string</p><p> </p> | <p><em>(optional)</em> Start of time range of events to receive. </p><p>Default is 7 days from now.</p>                       |
| <p><code>to\_date</code></p><p></p>   | <p>string</p><p> </p> | <p><em>(optional)</em> End of time range of events to receive.</p><p>Default is now.</p>                                      |
| `systems`                             | string\[]             | *(optional)* An identifier for each access control system to filter on. If omitted, events from all systems will be included. |
| `include_access_granted`              | boolean               | *(optional)* `true` if events in the access granted category should be included, otherwise `false`.                           |
| `include_access_denied`               | boolean               | *(optional)* `true` if events in the access denied category should be included, otherwise `false`.                            |
| <p><code>limit</code></p><p></p>      | <p>int</p><p> </p>    | <p><em>(optional)</em> The maximum number of events to return.</p><p>Default and max allowed is 1000 events.</p>              |
| `continuation_key`                    | string                | *(optional)* Token returned in a previous response that can be used to return the next set of events.                         |

If both `include_access_granted` and `include_access_denied` fields is omitted or is set to `false` in the request, this will be eqvivalent to not filtering on a event category at all.&#x20;

### Responses

#### :white\_check\_mark:200 OK Response Body Parameters

{% tabs %}
{% tab title="Sample Response" %}

```
{
    "least_sync_time": "2020-03-01T00:00:00Z",
    "has_more": false,
    "continuation_key": null,
    "events": 
    [
        {
            "event_time": "2020-03-01T00:00:00Z",
            "sequence_id": 12345,
            "category": "accessgranted",
            "type": 101,
            "system_id": "abc123-001",
            "door_name": "entrance",
            "key_id": "47c73793-ac07-4180-b660-438ca589c0b6",
            "key": 
            {
                "identification": "0001234567890",
                "type": "proximity"
            },
            "person":
            {
                "id": "81bd075c-f97b-4576-96f5-9821c7d80e98",
                "first_name": "first name",
                "last_name": "last_name"
            },
            "subject": null
        }
    ]
}
```

{% endtab %}

{% tab title="Model Schema" %}

```
EventResponse {
    least_sync_time (string),
    has_more (boolean),
    continuation_key (string),
    events (array[Event])
}

Event {
    event_time (string),
    sequence_id (int),
    category (string),
    type (int),
    system_id (string),
    door_name (string),
    key_id (string(uuid)),
    key (AccessKey),
    person (Person),
    subject (Subject)
}

AccessKey {
    identification (string),
    type (string)
}

Person {
    id (string(uuid)),
    first_name (string),
    last_name (string)
}

Subject {
    name (string)
}
```

{% endtab %}
{% endtabs %}

#### Event Response Model

| Field                                                | Type                         | Description                                                                                                                                                                                |
| ---------------------------------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <p><code>least\_sync\_time</code></p><p></p><p> </p> | <p>string</p><p></p><p> </p> | Indicates until which point in time it is guaranteed that events has been synchronized for the access control systems in scope for the request.                                            |
| `has_more`                                           | boolean                      | Is `true` if there is more events that has not been returned yet, otherwise false. If true the continuation\_key value can be used in subsequent requests to fetch the next set of events. |
| `continuation_key`                                   | string                       | Token that can be used to fetch the next set of events (if any). `null` if there is no more events to fetch.                                                                               |
| `events`                                             | array\[Event]                | Array of the requested events.                                                                                                                                                             |

#### Event Model

| Field                                                 | Type                            | Description                                                                                                                                                                                                                 |
| ----------------------------------------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `event_time`                                          | string                          | The time of the event.                                                                                                                                                                                                      |
| <p><code>sequence\_id</code></p><p></p><p></p><p></p> | <p>int</p><p></p><p></p><p></p> | A sequence number that can be used to determine the order of the events originating from the same access control system. Guaranteed to be unique only in the scope of the same access control system and event\_time value. |
| `category`                                            | string                          | The category of events this event belongs to.                                                                                                                                                                               |
| `type`                                                | int                             | The type of event. See [event types](https://apidocs.intserv.se/api-overview/event-types) for more information.                                                                                                             |
| `system_id`                                           | string                          | Identifier of the access control system the event originates from.                                                                                                                                                          |
| `door_name`                                           | string                          | Name of the door.                                                                                                                                                                                                           |
| `key_id`                                              | string(uuid)                    | Identifier of the access key or `null`. A null value typically indicates that the access key has not been created or imported into IntServ Access, or the event is not associated to an access key.                         |
| `key`                                                 | AccessKey                       | The access key used or `null`if the event is not associated to an access key.                                                                                                                                               |
| `person`                                              | Person                          | The person associated to the event, or `null`.                                                                                                                                                                              |
| `subject`                                             | Subject                         | The subject (if the subject is not a person) associated to the event, or `null`.                                                                                                                                            |

#### AccessKey Model

| Field            | Type   | Description                                                                                                          |
| ---------------- | ------ | -------------------------------------------------------------------------------------------------------------------- |
| `identification` | string | The raw identification number (csn or code) of the access key.                                                       |
| `type`           | string | The type of access key. See [access keys](https://apidocs.intserv.se/api-overview/access-keys) for more information. |

#### Person Model

| Field        | Type         | Description                                                   |
| ------------ | ------------ | ------------------------------------------------------------- |
| `id`         | string(uuid) | Identifier of an existing person to assign the access key to. |
| `first_name` | string       | The first name of the person.                                 |
| `last_name`  | string       | The last name of the person.                                  |

#### Subject Model

| Field  | Type   | Description              |
| ------ | ------ | ------------------------ |
| `name` | string | The name of the subject. |
