Class UsersClient

Client for managing users in a Sanity project. Provides methods for fetching user information and managing user settings.

// Get current user info
const me = await client.users.getById('me')

// List all users in project
const users = await client.users.list()

Constructors

Methods

Constructors

Methods

  • Get information about a specific user by ID. Use 'me' to get the current authenticated user.

    Type Parameters

    • T extends string

    Parameters

    • id: T

      User ID or 'me' for current user

    Returns Promise<T extends "me" ? CurrentSanityUser : SanityUser>

    Promise resolving to user info

  • List all users in the project. Returns array of user information.

    Returns Promise<SanityUser[]>

    Promise resolving to array of users