Class ProjectsClient

Client for managing Sanity projects. Provides methods for fetching project information and managing project settings.

// Get current project info
const project = await client.projects.getById('myproject')

// List all projects user has access to
const projects = await client.projects.list()

Constructors

Methods

Constructors

Methods

  • Fetch a project by project ID

    Parameters

    • projectId: string

      ID of the project to fetch

    Returns Promise<SanityProject>

  • Fetch a list of projects the authenticated user has access to.

    Parameters

    • Optionaloptions: { includeMembers?: true }

      Options for the list request

      • OptionalincludeMembers?: true

        Whether to include members in the response (default: true)

    Returns Promise<SanityProject[]>

  • Fetch a list of projects the authenticated user has access to.

    Parameters

    • Optionaloptions: { includeMembers?: false }

      Options for the list request

      • OptionalincludeMembers?: false

        Whether to include members in the response (default: true)

    Returns Promise<Omit<SanityProject, "members">[]>