Query sessions
Returns a page of a project's sessions.
Sessions of every lifecycle state are returned; each carries its state.
Requires the session.read scope and the admin role on the project: each
session records the IP and user agent its user signed in from, so a viewer
or an editor is refused.
oauth2 session.readAuthorizationBearer <token>Scope: session.read
project_id*stringThe project ID: the id that createProject (POST /projects) returns. zitadel setup prints
it as "Project id" in its summary and as project_id with --json, and
writes it to .env.local as ZITADEL_PROJECT_ID.
^[a-zA-Z0-9_-]+$Request to query the sessions of a project.
application/json- body
Request to query the sessions of a project.
limit?limit1 <= value <= 10020page_token?|Token to retrieve the next page of results.
sorting?filter?array<>Filter criteria for querying sessions.
A page of the project's sessions.
application/json- response
Paginated list of sessions.
sessions*array<>next_page_token?|Token to pass as page_token in the next request to fetch the following page.
Absent when there are no more results.
import { createZitadelApi, ZitadelClient } from "@zitadel/api/client";const api = createZitadelApi( new ZitadelClient({ baseUrl: process.env.ZITADEL_URL ?? "http://localhost:8080", token: process.env.ZITADEL_PROJECT_SECRET!, // server-side only }),);const sessions = await api.querySessions({}, { project_id: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" });{ "sessions": [ { "session_id": "string", "project_id": "string", "state": "building", "user_id": "string", "user": { "user_id": "string", "identifier": "string", "identifier_property": "string", "display": "string" }, "factors": [ { "method": "identifier", "verified_at": "2019-08-24T14:15:22Z", "payload": { "method": "identifier", "user_id": "string" } } ], "assurance_levels": [ "string" ], "metadata": {}, "user_agent": { "fingerprint": "string", "ip": "string" }, "created_at": "2019-08-24T14:15:22Z", "expires_at": "2019-08-24T14:15:22Z" } ], "next_page_token": "string"}Was this helpful?