---
title: "List CLI sessions"
method: POST
path: "/v2/cli.listSessions"
tags: ["cli"]
---

# List CLI sessions

`POST /v2/cli.listSessions`

## Request

- Base URL: `https://api.unkey.com`
- URL: `https://api.unkey.com/v2/cli.listSessions`
- Auth: HTTP bearer

Lists CLI sessions in the caller's workspace. A member sees their own sessions. An admin sees every session.
Requires a dashboard session or a CLI access token. Root keys are rejected.
This endpoint takes no request body.

## Response `200`

Sessions the caller can see.

- V2CliListSessionsResponseBody
  - `meta` Meta, required: Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
    - `requestId` string, required: A unique id for this request. Always include this ID when contacting support about a specific API request. This identifier allows Unkey's support team to trace the exact request through logs and diagnostic systems to provide faster assistance.
  - `data` V2CliListSessionsResponseData, required
    - `sessions` V2CliListSessionsSession[], required
      - `id` string, required
      - `userId` string, required
      - `deviceName` string
      - `permissions` string[], required
      - `createdAt` integer, required
      - `lastUsedAt` integer, required
      - `expiresAt` integer, required: Unix millisecond time the session expires. Each refresh moves it to 7 days later, but never past 30 days after createdAt.
      - `revokedAt` integer: Unix millisecond time the session was revoked. Omitted when the session is still active.

## Other responses

- `401`: Unauthorized
- `403`: The caller is not a dashboard or CLI user.
- `500`: Internal server error.

## Changes

- **2026-10-28** `5949ec68734a`: 1 breaking
  - removed the request body
- **2026-10-26** `9829df3465a0`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/unkeyed/apis/unkey-api/changes/v2/cli.listSessions/post.md)

---

[API](https://skmtc.dev/unkeyed/apis/unkey-api.md) - [All operations](https://skmtc.dev/unkeyed/apis/unkey-api/llms.txt) - [OpenAPI document](https://skmtc.dev/unkeyed/apis/unkey-api/revisions/6fbaa27f19e0?raw)
