# Azion CLI profiles

The Azion CLI `profiles` command shows the profiles configured on your machine and switches the active one. A profile holds the personal token of one account, so several profiles let you work with several accounts or environments from the same machine. To create or delete a profile, use the commands on [Azion CLI profile](/en/documentation/devtools/cli/resources/profile/). The options every command accepts, such as `--debug` and `--timeout`, are on [Global options](/en/documentation/devtools/cli/globals/).

---

## Usage

`azion profiles` opens a selector with every profile you configured, unless you pass `--refresh`:

```bash
azion profiles [flags]
```

| Flag        | Short | Type | Default | Description                                                                                                                                                              |
| ----------- | ----- | ---- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `--help`    | `-h`  | —    | —       | Prints the help of the command.                                                                                                                                          |
| `--refresh` | —     | —    | —       | Re-checks which Azion API version the account of the active profile uses and saves the result, instead of opening the selector. Use it when the account changed version. |

The selector is interactive: move the cursor with the arrow keys and press Enter to choose a profile. The command needs a terminal to read your choice. Without one, as in a script, it prints the list and exits with `Error: EOF`. No command lists the profiles without a selector.

The selector always opens with the cursor on `default`, whichever profile is active. To see the active profile, run [`azion whoami`](/en/documentation/devtools/cli/whoami/), which prints it as `Active Profile`.

---

## Examples

### Switch the active profile

This command opens the selector on a machine with two profiles, `default` and `my-profile`:

```bash
azion profiles
```

The command lists the profiles, with the cursor on `default`:

```text
? Choose a profile:  [Use arrows to move, type to filter]
> default
  my-profile
```

After you move the cursor to `my-profile` and press Enter, the command replaces the list with your choice and prints nothing else:

```text
? Choose a profile: my-profile
```

`my-profile` is then the active profile, and `~/.azion/profiles.json` names it:

```text
Name = 'my-profile'
```

### Create a profile

The selector lists only the profiles that exist. `azion create profile` adds one, with a personal token you created with `azion create personal-token`:

```bash
azion create profile --name my-profile --personal-token "[TOKEN VALUE]"
```

The command checks the token, asks whether to make the new profile the default, and creates nothing when the token is invalid. For every flag it takes, refer to [Azion CLI profile](/en/documentation/devtools/cli/resources/profile/#create).

### Re-check the API version of an account

The CLI detects which Azion API version an account uses and remembers the answer. This command checks it again for the active profile:

```bash
azion profiles --refresh
```

The command reads the version from Azion, saves it, and opens no selector. Use it when the account moved between API versions and the CLI still acts on the version it recorded before. It fails when no token is available, or when the token no longer authorizes the account.

---

## Related resources

- [Azion CLI profile](/en/documentation/devtools/cli/resources/profile.md): The commands that create and delete the profiles this selector lists.
- [Azion CLI whoami](/en/documentation/devtools/cli/whoami.md): The command that prints the active profile and the account it uses.
- [Azion CLI login](/en/documentation/devtools/cli/login.md): The command that authenticates the CLI and saves a personal token locally.
- [Global options](/en/documentation/devtools/cli/globals.md): The options every command accepts, such as `--config`, `--token`, and `-y`.
