Docs

Query users

POST
/users/query

Returns the users of a project, paginated with a cursor.

project_id names the project to list; without it, the credential's own project is listed.

Accepts either a project secret (oauth2) or a user-bound console session cookie (sessionCookie). Cookie-authenticated requests follow the scheme's CSRF rules (sessionCookie).

With a project secret, embedding teams with expand, or filtering by team_id, also needs team_membership.read. Embedding lifecycle_owner_team needs team.read. A console session carries no scopes: it may do both when it may read the whole project, and gets 403 user.permission_denied otherwise.

Authorization

headerAuthorizationBearer <token>

Scope: user.read

Query Parameters

project_id?string

The project the request addresses, by the id that createProject (POST /projects) returns. Omit it to address the credential's own project.

Match^[a-zA-Z0-9_-]+$

Request Body

Request to query the users of a project.

application/json
  1. body

Request to query the users of a project.

limit?limit
Range1 <= value <= 100
Default20
page_token?|

Token to retrieve the next page of results. Must be sent with the same sorting as the request that issued the token. Omitting sorting reuses the default sort and only succeeds when that default matches the token.

expand?array<>

Related collections to embed on each user. Omit it and no embedded collection is returned. An unrecognised value is rejected.

sorting?
filter?array<>

Filter criteria for querying users. Criteria are combined with AND.

Response Body

A page of users.

application/json
  1. response

Paginated list of users.

users*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.

Example Request
import { configureZitadel, getApi } from "@zitadel/api/config";// In the browser, through the SDK proxy: the session cookie authenticates the call.const api = getApi(configureZitadel({ projectId: "proj_01KWH1P4MYS7F0N9WD3P2E4YM5" }));const users = await api.queryUsers({});
Example Response
{  "users": [    {      "id": "string",      "schema": "string",      "attributes": {},      "metadata": {        "created_at": "2019-08-24T14:15:22Z",        "updated_at": "2019-08-24T14:15:22Z",        "status": "active",        "lifecycle_owner_team_id": "string",        "lifecycle_owner_team": {          "id": "string",          "name": "string",          "status": "active",          "created_at": "2019-08-24T14:15:22Z",          "updated_at": "2019-08-24T14:15:22Z"        }      },      "identifier": "string",      "identifier_property": "string",      "display": "string",      "teams": [        {          "id": "string",          "name": "string",          "membership_status": "pending",          "created_at": "2019-08-24T14:15:22Z",          "updated_at": "2019-08-24T14:15:22Z"        }      ],      "teams_truncated": true    }  ],  "next_page_token": "string"}

Was this helpful?