---
title: Returns a list of OpenVPN sessions by batches (up to 100 in a single request).
canonical: https://openvpn.net/cloud-docs/developer/cloudconnexa-beta-api-v0-16-0/session/returns-a-list-of-openvpn-sessions-by-batches--up-to-100-in-a-single-request/
product: CloudConnexa Docs
---

# Returns a list of OpenVPN sessions by batches (up to 100 in a single request).

`GET /api/beta/sessions`

Endpoint to retrieve a list of sessions with filters by date range and status.

For example:

```
GET /api/beta/sessions?startDate=2022-10-25T00:00:00.000Z&endDate=2022-10-26T00:00:00.000Z&size=100&status=ACTIVE
```

Will return:

```json
{
  "sessions": [ .. ],
  "nextCursor: "63527ce1d8e5811243db4902"
}
```

```
If nextCursor is not empty, then it should be passed in the subsequent request to retrieve the next 100 sessions:
GET /api/beta/sessions?startDate=2022-10-25T00:00:00.000Z&endDate=2022-10-26T00:00:00.000Z&size=100&status=ACTIVE&cursor=63527ce1d8e5811243db4902
```

```
When nextCursor is missing in the response, then there are no more sessions.
```

If you encounter rate-limit issues, retry after 1 minute. If the issue persists, please open a [Support Ticket](https://support.openvpn.com/hc/en-us/requests/new?ticket_form_id=360001597871).

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| cursor | query | string | false | An opaque string value that represents a cursor pointer for the next batch of sessions. |
| endDate | query | string(date-time) | false | Filter sessions by created or updated before this date (exclusive). |
| returnOnlyNew | query | boolean | false | `Notes:` |
| size | query | integer(int32) | true | Session count to return in one batch min = 1 max = 100. |
| startDate | query | string(date-time) | false | Filter sessions by created or updated after this date (inclusive). |
| status | query | string | false | Filter by session status. |

### Detailed descriptions

```
endDate: Filter sessions by created or updated before this date (exclusive).
Notes: * Should use ISO_INSTANT format, e.g. 2022-11-08T14:53:43Z.
```

```
returnOnlyNew: Notes: * If true, returns only new sessions created between specified dates (no duplicates).
* If false, returns updated sessions between specified dates (duplicates may be returned in subsequent requests).
```

**size**: Session count to return in one batch min = 1 max = 100.

```
startDate: Filter sessions by created or updated after this date (inclusive).
Notes: * Max 7 days of history available.
* If value is before (now - 7 days), an error will be returned.
* Should use ISO_INSTANT format, e.g. 2022-11-08T14:53:43Z.
* Should be less than endDate, otherwise no sessions will be returned.
```

**Default value : now - 1 day**

### Enumerated Values

| Parameter | Value |
| --- | --- |
| status | ACTIVE |
| status | COMPLETED |
| status | FAILED |

## Responses

| Status | Meaning | Description |
| --- | --- | --- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK |
| 400 | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | Bad Request |
| 401 | [Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1) | Unauthorized |
| 403 | [Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3) | Access Forbidden |
| 404 | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4) | Not Found |
| 406 | [Not Acceptable](https://tools.ietf.org/html/rfc7231#section-6.5.6) | Not Acceptable |
| 429 | [Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4) | Too Many Requests |
| 500 | [Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) | Internal Server Error |

```json
{
  "nextCursor": "string",
  "sessions": [
    {
      "bytesIn": 0,
      "bytesOut": 0,
      "clientUUID": "string",
      "connectorId": "string",
      "connectorName": "string",
      "deviceId": "string",
      "deviceName": "string",
      "disconnectReason": "string",
      "email": "string",
      "firstName": "string",
      "hostId": "string",
      "hostName": "string",
      "id": "string",
      "lastName": "string",
      "networkId": "string",
      "networkName": "string",
      "osType": "string",
      "osVersion": "string",
      "protocol": "string",
      "publicIp": "string",
      "region": "string",
      "sessionDurationSeconds": 0,
      "sessionEndTime": "2023-07-21T14:49:53.940Z",
      "sessionStartTime": "2023-07-21T14:49:53.940Z",
      "status": "string",
      "tunnelIpV4": "string",
      "tunnelIpV6": "string",
      "userGroup": "string",
      "userId": "string",
      "userName": "string"
    }
  ]
}
```

To perform this operation, you must be authenticated by means of one of the following methods: OAuth\_authorization

---

Prev: [Session](https://openvpn.net/cloud-docs/developer/cloudconnexa-beta-api-v0-16-0/session.md)
Next: [User](https://openvpn.net/cloud-docs/developer/cloudconnexa-beta-api-v0-16-0/user.md)
Index: https://openvpn.net/cloud-docs/llms.txt
