---
title: "List device sessions"
method: GET
path: "/sessions"
tags: ["Session Lifecycle"]
---

# List device sessions

`GET /sessions`

## Request

- Base URL: `https://api.us-west-1.saucelabs.com/rdc/v2`
- URL: `https://api.us-west-1.saucelabs.com/rdc/v2/sessions`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/saucelabs/apis/real-device-access-api-reference/docs/sessions/get.ts> (a function with typed inputs; its response is checked against the schema)

Retrieves a list of device sessions, including pending, active and recently closed sessions.

## Query parameters

- `state` 'PENDING' | 'CREATING' | 'ACTIVE' | 'CLOSING' | 'CLOSED' | 'ERRORED'
- `deviceName` string

## Response `200`

OK

- object
  - `sessions` Session[]
    - `id` string: Unique id of device session
    - `state` 'PENDING' | 'CREATING' | 'ACTIVE' | 'CLOSING' | 'CLOSED' | 'ERRORED'
    - `expiresAt` string, date-time: UTC timestamp when the active session expires and will be forcefully closed. Set via `sessionDuration` at creation. Mutually exclusive with `retainUntil`. Sessions longer than 6 hours may be closed before this time. When closed, transitions to terminal state and `retainUntil` is set.
    - `retainUntil` string, date-time: UTC timestamp until which closed/errored sessions are retained before deletion. Mutually exclusive with `expiresAt`. Typically 5 minutes after closure or error.
    - `device` object
      - `descriptor` string
      - `deviceName` string
      - `os` string
      - `osVersion` string
    - `appium` object
      - `url` string: The hosted appium server endpoint associated to this session
      - `version` string: The hosted appium server version
    - `links` object: Links to the resources of this session. The low-level device access links — `adbUrl`, `usbmuxdUrl` and `vusbUrl` — are only present on sessions running on a private device. Low-level device access is not supported on public devices, so on a public session the three fields are absent.
      - `ioWebsocketUrl` string: Websocket for the live device screen and device input. See the [Device Control Socket guide](https://docs.saucelabs.com/mobile-apps/real-device-access-api/real-device-access-api-device-control-socket/).
      - `eventsWebsocketUrl` string: Websocket for retrieving realtime logs, device events, and some statistics. See the [Companion Socket guide](https://docs.saucelabs.com/mobile-apps/real-device-access-api/real-device-access-api-mastering-companion-socket/).
      - `liveViewUrl` string: Live test view for the openapi session
      - `adbUrl` string, nullable: ADB forwarding URL for Android devices. Only set on a private device when the device OS is Android; absent otherwise.
      - `usbmuxdUrl` string, nullable: usbmuxd URL for iOS devices. Only set on a private device when the device OS is iOS; absent otherwise.
      - `vusbUrl` string, nullable: Deprecated: Use adbUrl for Android or usbmuxdUrl for iOS instead. Only set on a private device; absent on a public device.
      - `deviceDescriptorUrl` string: Link to the device descriptor with more details about the device
      - `self` string

## Other responses

- `401`: Not Authorized

---

[API](https://skmtc.dev/saucelabs/apis/real-device-access-api-reference.md) - [All operations](https://skmtc.dev/saucelabs/apis/real-device-access-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/saucelabs/apis/real-device-access-api-reference/revisions/f845a4b66e37?raw)
