# profile

> Shoplazza CLI profile commands: add a profile per store, list and inspect profiles, switch the current one, change its scopes, rename it, or remove it.

Manage store profiles. A profile is a per-store context (store, store token, and scopes) under your logged-in account, so you can work with several stores without re-authenticating. [`auth login --store-domain`](./auth#login) and [`auth store use`](./auth#store-use) create and switch profiles automatically.

To run one command against another profile without switching, pass the global `--profile <name>` flag or set `SHOPLAZZA_CLI_PROFILE`. `--profile` wins over the environment variable, which wins over the current profile.

At an interactive terminal, `add` asks for a missing name and store, `use`, `rename`, and `remove` let you pick the profile, and `remove` asks you to confirm.

## add

Add a named profile bound to a store, minting and caching its store token. Requires an account login first (`shoplazza auth login`).

```shell
shoplazza profile add [flags]
```

### Flags

| Flag | Type | Description |
|------|------|-------------|
| `--name <name>` | string | Profile name (required) |
| `--store-domain, -s <domain>` | string | Store domain to bind this profile to (e.g. `my-store.myshoplaza.com`) (required) |
| `--scope <scopes>` | StringSlice | Scopes for this profile (must be a subset of the account's granted scopes); empty grants the account's full scope set |
| `--use` | bool | Set this profile as current after adding it |

### Examples

```shell
# Add a profile for a store
shoplazza profile add --name prod --store-domain my-store.myshoplaza.com

# Add a scoped profile and switch to it
shoplazza profile add --name staging --store-domain staging.myshoplaza.com --scope read_product --use
```

## list

List all configured profiles with their store, scopes, token status, and which one is current.

```shell
shoplazza profile list
```

## info

Show a profile's details (defaults to the current profile).

```shell
shoplazza profile info [flags]
```

### Flags

| Flag | Type | Description |
|------|------|-------------|
| `--name <name>` | string | Profile to show (defaults to the current profile) |

## use

Switch the current profile to a named one, or back to the previously-current profile.

```shell
shoplazza profile use [flags]
```

### Flags

| Flag | Type | Description |
|------|------|-------------|
| `--name <name>` | string | Profile to switch to |
| `--previous` | bool | Switch back to the previously-current profile |

### Examples

```shell
# Switch to a named profile
shoplazza profile use --name prod

# Switch back to the previous profile
shoplazza profile use --previous

# Run one command against another profile without switching
shoplazza products list --profile prod
```

## update

Update a profile's scopes. The cached store token is dropped and minted again with the new scopes on the next command.

```shell
shoplazza profile update [flags]
```

### Flags

| Flag | Type | Description |
|------|------|-------------|
| `--name <name>` | string | Profile to update (defaults to the current profile) |
| `--scope <scopes>` | StringSlice | New scopes for this profile (must be a subset of the account's granted scopes) |

## rename

Rename a profile.

```shell
shoplazza profile rename [flags]
```

### Flags

| Flag | Type | Description |
|------|------|-------------|
| `--from <name>` | string | Existing profile name (defaults to the current profile) |
| `--to <name>` | string | New profile name (required) |

## remove

Remove a profile: its cached store token and config record. Your account login is kept.

```shell
shoplazza profile remove [flags]
```

### Flags

| Flag | Type | Description |
|------|------|-------------|
| `--name <name>` | string | Profile to remove (required) |
