> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wisdom.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# List Users

The `listUsers` query returns users in a workspace along with their attributes and role assignments. Use it to look up user IDs before calling [impersonateUser](/integrations/graphql-api/mutations/auth/impersonate-user) or [setUserAttributes](/integrations/graphql-api/mutations/user/set-user-attributes).

## Signature

```graphql theme={null}
listUsers(workspaceId: ID): [User!]!
```

## Parameters

<ParamField path="workspaceId" type="ID">
  Filters results to a specific workspace. Required for multi-workspace deployments.
</ParamField>

## Response

Returns an array of `User` objects. See [User](/integrations/graphql-api/objects/user) for the full schema. The fields most relevant to user management are:

<ParamField path="id" type="ID!">
  The user's unique ID. Pass this to `impersonateUser`, `setUserAttributes`, or `deleteUsersFromWorkspace`.
</ParamField>

<ParamField path="email" type="String!">
  The user's email address.
</ParamField>

<ParamField path="userAttributes" type="[UserAttribute!]">
  Key-value pairs associated with the user. Each entry includes:

  * `key` — attribute name
  * `value` — attribute value
  * `source` — either `DATABASE` (set via API) or `JWT` (from SSO claims, read-only)

  See [User attributes](/integrations/user-management/user-attributes) for how these sources differ.
</ParamField>

<ParamField path="roleAssignments" type="[RoleAssignment!]">
  The roles assigned to the user and their scope.
</ParamField>

## Usage example

```graphql theme={null}
query ListUsers($workspaceId: ID) {
  listUsers(workspaceId: $workspaceId) {
    id
    email
    userAttributes {
      key
      value
      source
    }
    roleAssignments {
      roleId
      scopes
    }
  }
}
```

<RequestExample>
  ```bash Request theme={null}
  curl -X POST \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <access_token>" \
    -d '{
      "query": "query ListUsers($workspaceId: ID) { listUsers(workspaceId: $workspaceId) { id email userAttributes { key value source } roleAssignments { roleId scopes } } }",
      "variables": {
        "workspaceId": "workspace_123"
      }
    }' \
    https://{ACCOUNT}.askwisdom.ai/graphql
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "data": {
      "listUsers": [
        {
          "id": "user_abc123",
          "email": "alice@yourcompany.com",
          "userAttributes": [
            { "key": "account_id", "value": "acct_456", "source": "DATABASE" },
            { "key": "department", "value": "finance", "source": "JWT" }
          ],
          "roleAssignments": [
            { "roleId": "00000000-0000-0000-0000-000000000003", "scopes": ["{{DOMAIN_ID}}"] }
          ]
        }
      ]
    }
  }
  ```
</ResponseExample>

## Related articles

<CardGroup cols={2}>
  <Card title="Impersonate user" icon="user-secret" href="/integrations/graphql-api/mutations/auth/impersonate-user">
    Use the user ID to start an embedded session
  </Card>

  <Card title="Set user attributes" icon="tag" href="/integrations/graphql-api/mutations/user/set-user-attributes">
    Update DATABASE-sourced attributes on a user
  </Card>

  <Card title="Delete users from workspace" icon="user-minus" href="/integrations/graphql-api/mutations/user/delete-users-from-workspace">
    Remove users from a workspace
  </Card>
</CardGroup>
