Configuration and authentication

Before running resource commands, configure the Product API endpoint and a personal access token, then discover and select a workspace with read-only commands. moi-cli saves these values in ~/.moi-cli.json; config show masks the token.

Configure connection information

moi-cli config set-endpoint "<Product API Base URL ending in /newmoi>"
moi-cli config set-api-key "<personal-access-token>"

Use the complete Product API Base URL supplied by the current environment, including /newmoi. The CLI does not add this prefix automatically. Pass the personal access token as its raw value: do not add a Bearer prefix or write the token to scripts, shell history, or source control.

List the workspaces visible to the current identity, then save the ID of the workspace to operate on:

moi-cli -o workspace list
moi-cli config set-workspace "<workspace-id-from-list>"

Verify the saved configuration:

moi-cli config show

The output shows the endpoint and workspace ID and masks api_key. Listing workspaces does not require a saved workspace ID; other workspace-scoped commands require all necessary configuration values.

Provide configuration for one command

You can supply the endpoint, token, or workspace for the current command without changing saved configuration:

moi-cli \
  -endpoint "<Product API Base URL ending in /newmoi>" \
  -api-key "<personal-access-token>" \
  -workspace-id "<workspace-id>" \
  workspace-member current-principal

Pass a token this way only in a secure execution environment. Shared terminals, CI logs, and process lists can expose command-line arguments; prefer protected configuration files or deployment-managed secret injection.

Configure a workspace role

To select the current role for a workspace, save the workspace and role relationship:

moi-cli config set-role "<workspace-id>" "<role-id>"

Use moi-cli config unset-role <workspace-id> to remove the saved role for that workspace. Role configuration affects only the specified workspace; when switching workspaces, confirm the role and permissions again.

Last updated on