> For AI agents: the complete Sanity documentation index is available at [https://www.sanity.io/docs/llms.txt](https://www.sanity.io/docs/llms.txt).

# Users CLI command reference

Manage users of your project

**npm**

```shell
npx sanity users --help
```

**pnpm**

```shell
pnpm dlx sanity users --help
```

**yarn**

```shell
yarn dlx sanity users --help
```

**bun**

```shell
bunx sanity users --help
```

## Commands

### `invite`

**CLI output**

```sh
USAGE
  $ sanity users invite [EMAIL] [-p <id>] [--role <value>]

ARGUMENTS
  [EMAIL]  Email address to invite

FLAGS
      --role=<value>  Role to invite the user as

OVERRIDE FLAGS
  -p, --project-id=<id>  Project ID to invite user to (overrides CLI configuration)

DESCRIPTION
  Invite a new user to the project

EXAMPLES
  Invite a new user to the project (prompt for details)

    $ sanity users invite

  Send a new user invite to the email "pippi@sanity.io", prompt for role

    $ sanity users invite pippi@sanity.io

  Send a new user invite to the email "pippi@sanity.io", as administrator

    $ sanity users invite pippi@sanity.io --role administrator

  Invite a user to a specific project

    $ sanity users invite pippi@sanity.io --project-id abc123
```

### `list`

**CLI output**

```sh
USAGE
  $ sanity users list [-p <id>] [--invitations] [--order <value>] [--robots] [--sort <value>]

FLAGS
      --invitations    Includes or excludes pending invitations
      --order=<value>  Sort output ascending/descending
      --robots         Includes or excludes robots (token users)
      --sort=<value>   Sort users by specified column

OVERRIDE FLAGS
  -p, --project-id=<id>  Project ID to list users for (overrides CLI configuration)

DESCRIPTION
  List project members

EXAMPLES
  List all users of the project

    $ sanity users list

  List all users of the project, but exclude pending invitations and robots

    $ sanity users list --no-invitations --no-robots

  List all users, sorted by role

    $ sanity users list --sort role

  List users for a specific project

    $ sanity users list --project-id abc123
```

