Skip to content

DOCS-3295: Add profiles #4318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions docs/dev/tools/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ to later update the Viam CLI tool on macOS, run `brew upgrade viam`.

Once you have [installed the Viam CLI](#install), you must authenticate your CLI session with Viam in order to run CLI commands.

You can authenticate your CLI session using either a personal access token, or an organization, location, or machine part API key.
You can authenticate your CLI session using a personal access token, a profile, or an organization, location, or machine part API key.

- To authenticate your CLI session using a personal access token:

Expand All @@ -133,6 +133,19 @@ An authenticated session is valid for 24 hours, unless you explicitly [log out](

After the session expires or you log out, you must re-authenticate to use the CLI again.

## CLI profiles

You can also authenticate your CLI session with profiles which allow you to switch between using different privileges.
To create a profile, run the following command:

```sh {class="command-line" data-prompt="$"}
viam profiles add --profile-name=default --key-id=<api-key-id> --key=<api-key>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect to see a new section about the profiles command -- there should be update, add, list, and remove subcommands. Are we deliberately omitting that section?

FYI, when I try to run list with no profiles specified, I see the following output:

Error: Unexpected end of JSON input

It might be worth checking to see if this happens on your machine as well -- if so, we should probably let engineering know.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that bug just got fixed so should be gone next week!

```

To use a profile to authenticate a command, pass the `--profile` flag.
By default, the Viam CLI does not use a profile.
To use a specific profile by default, set the environment variable `VIAM_CLI_PROFILE_NAME` to the profile name.

### Create an organization API key

To use an API key to authenticate your CLI session, you must create one.
Expand Down Expand Up @@ -1626,8 +1639,8 @@ You can pass global options after the `viam` CLI keyword with any command.
<!-- prettier-ignore -->
| Global option | Description |
| ------------- | ----------- |
| `--debug` | Enable debug logging (default: false). |
| `--disable-profiles`, `disable-profile` | Disable usage of [profiles](#profiles), falling back to default (false) behavior. |
| `--help`, `-h` | Show help (default: false). |
| `--debug` | Enable debug logging. Default: `false`. |
| `--disable-profiles`, `disable-profile` | Disable usage of [profiles](#profiles), falling back to default (false) behavior. Default: `false`. |
| `--help`, `-h` | Show help. Default: `false`. |
| `--profile` | Specify a particular [profile](#profiles) for the current command. |
| `--quiet`, `-q` | Suppress warnings (default: false). |
| `--quiet`, `-q` | Suppress warnings. Default: `false` |
Loading