# Use the CLI

Use `moi-cli` to work with Product resources from a terminal or script. Before starting, go to [Download MOI-CLI](../downloads/cli.md) to obtain the precompiled binary for your operating system.

For all commands and tasks, see [CLI](../../cli/index.md).

## 1. Configure the endpoint and credentials

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

The endpoint must include `/newmoi`. Pass the personal access token as its original value, without a `Bearer` prefix. Command-line arguments can be stored in terminal history; configure credentials only in a protected local environment.

## 2. Find and select a workspace

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

A successful workspace-list response confirms that the endpoint and personal access token work. Use the workspace name only to identify the workspace; save and use its ID in subsequent commands.

## 3. Check the configuration

```shell
moi-cli config show
```

The output should show the complete endpoint and workspace ID, while `api_key` is masked. You can then run `moi-cli --help` or `moi-cli <command> --help` to select a task.

## Next steps

- [View the full configuration rules](../../cli/configuration-authentication.md)
- [Choose a common task](../../cli/tasks/index.md)
