> For the complete documentation index, see [llms.txt](https://docs.parqex.com/-MUyxAVrX9S4wky8UoX6/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.parqex.com/-MUyxAVrX9S4wky8UoX6/api-endpoints/get-access-history.md).

# Get Access History

## Get the activity logs for an access point/user

<mark style="color:blue;">`GET`</mark> `https://api.parqex.com/oauth/v1/endpoints/toggle-history`

Retrieve the access logs/history for a single device/door for a given user.&#x20;

#### Query Parameters

| Name          | Type   | Description                               |
| ------------- | ------ | ----------------------------------------- |
| end\_date     | string | Ending date of history ( `YYYY-MM-DD` )   |
| start\_date   | string | Starting date of history ( `YYYY-MM-DD` ) |
| history\_type | string | "door" \| "user"                          |
| door\_id      | string | `UUID` of door                            |

#### Headers

| Name            | Type   | Description                      |
| --------------- | ------ | -------------------------------- |
| Accept          | string | Always set to `application/json` |
| Content-Type    | string | Always set to `application/json` |
| Authorization   | string | Set to `Bearer <ACCESS_TOKEN>`   |
| Accept-Charset  | string | Always set to `utf-8`            |
| Accept-Encoding | string | Always set to `gzip`             |

{% tabs %}
{% tab title="200 Toggle history returned successfully" %}

```
{
    "success": true,
    "timestamp": ,
    "data": {
        "toggle_events": [
            {
                "door_id": "69668e34-2b60-49aa-b42a-7e01ebc0cb58",
                "door_name": "Main Door",
                "door_state": "OPEN",
                "channel": "Door Sensor",
                "user": {
                    "id": "",
                    "first_name": "John",
                    "last_name": "Doe",
                    "email_address": "test@example.com",
                },
                "was_success": true,
                "toggle_date_time": "2019-12-12"
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

The **/toggle-history** endpoint is used to retrieve the selected Controller's recent history. You can request the history of an entire Controller (ie. `Device`) or a specific `Door`. Furthermore, the history can be constrained to a particular time period via `start_date` and `end_date`.

An example request for a specific door may look like this:

```
GET /api/oauth/v1/endpoints/toggle-history/?
    history_type=door&
    door_id=bbf8cf9aa86e396e2fcac0135177eecd&
    start_date=2016-04-01&
    end_date=2016-05-31 
    HTTP/1.1
Host: https://parqex.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer <ACCESS_TOKEN>
Accept-Charset: utf-8
Accept-Encoding: gzip, deflate
```

where `<ACCESS_TOKEN>`  is a valid access token.&#x20;

If requesting the history of an entire device, it might resemble the following:

```
GET /api/oauth/v1/endpoints/toggle-history/?history_type=device&device_id=bbf8cf9aa86e396e2fcac01351771234&start_date=2016-04-01&end_date=<TODAY> HTTP/1.1
Host: https://parqex.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer <ACCESS_TOKEN>
Accept-Charset: utf-8
Accept-Encoding: gzip, deflate
```

where \<TODAY> is today's data with the format *YYYY-MM-DD.*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.parqex.com/-MUyxAVrX9S4wky8UoX6/api-endpoints/get-access-history.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
