---
title: "List live sessions"
method: GET
path: "/admin/sessions"
tags: ["Admin Sessions"]
---

# List live sessions

`GET /admin/sessions`

## Request

- Base URL: `https://h2ogpte.genai.h2o.ai/api/v1`
- URL: `https://h2ogpte.genai.h2o.ai/api/v1/admin/sessions`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/h2o/apis/h2ogpte-rest-api/docs/admin/sessions/get.ts> (a function with typed inputs; its response is checked against the schema)

Allows admins to enumerate live sessions stored in Redis. Returns metadata only — never access tokens, refresh tokens, or CSRF values. Pagination is cursor-based; pass back the `next_cursor` from a previous response to continue, or omit to start fresh. Iteration is complete when `next_cursor` is absent.

## Query parameters

- `cursor` string
- `limit` integer

## Response `200`

Successful operation

- AdminSessionsListResponse
  - `items` AdminSessionItem[], required: Page of session metadata.
    - `session_id` string, required: Unique identifier of the session.
    - `user_id` string, required: ID of the user the session belongs to.
    - `username` string, required: Username of the user the session belongs to.
    - `subject` string: OIDC subject claim for the user (when known).
    - `transport` 'keycloak' | 'anonymous' | 'spoof' | 'unknown', required: How the session authenticated. One of `keycloak`, `anonymous`, `spoof`, or `unknown`.
    - `is_anonymous` boolean, required: True if the session is for a guest / anonymous user.
    - `expires_in_seconds` integer, required: Remaining Redis TTL on the session key, in seconds.
    - `expires_at` string, date-time: Access-token expiry from the underlying OAuth2 token. Zero for anonymous or spoofed sessions.
  - `next_cursor` string: Opaque cursor for the next page. Absent when iteration is complete.

## Other responses

- `401`: Unauthorized - Invalid or missing API key
- `403`: Caller is not an admin.
- `500`: Internal server error
- `default`: Unexpected error

---

[API](https://skmtc.dev/h2o/apis/h2ogpte-rest-api.md) - [All operations](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/h2o/apis/h2ogpte-rest-api/revisions/a82a117320f4?raw)
