> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nscale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Contexts

> Manage CLI contexts to switch between organizations and user configurations.

Contexts let you store named configurations — including organization, project, region, and user credentials — so you don't need to pass these flags on every command.

Contexts are persisted in the user configuration folder. For example, on macOS they are stored in `~/.config/nscale/contexts.yaml`.

**Aliases:** `context`, `ctx`

## Subcommands

* [set](#set) — Create or update a context
* [use](#use) — Set the current active context
* [list](#list) — List all contexts
* [delete](#delete) — Delete a context
* [clear](#clear) — Clear the current context

***

## set

Create or update a context with a given name, organization, and user.

The `--org`, `--project`, and `--region` flags expect resource IDs, not names. Use `nscale organizations list`, `nscale projects list`, and `nscale regions list` to discover the IDs. Any flag that is omitted will be prompted for interactively.

```bash theme={null}
nscale contexts set --name <name> --org <organization-id> [--project <project-id>] [--region <region-id>] [--user <user>]
```

### Flags

| Flag               | Description                     |
| ------------------ | ------------------------------- |
| `--name string`    | Context name                    |
| `--org string`     | Organization ID                 |
| `--project string` | Project ID                      |
| `--region string`  | Region ID                       |
| `--user string`    | Keyring user credentials to use |

### Examples

```bash theme={null}
nscale contexts set --name prod --user default --org <organization-id> --project <project-id> --region <region-id>
```

For interactive mode (prompts for all values):

```bash theme={null}
nscale contexts set
```

***

## use

Set the current active context. All subsequent commands will use this context unless overridden with `--context`.

```bash theme={null}
nscale contexts use <name>
```

### Example

```bash theme={null}
nscale contexts use prod
```

***

## list

List all configured contexts.

**Aliases:** `list`, `ls`

```bash theme={null}
nscale contexts list
```

***

## delete

Delete a context by name.

**Aliases:** `delete`, `rm`, `remove`

```bash theme={null}
nscale contexts delete <name>
```

### Example

```bash theme={null}
nscale contexts delete prod
```

***

## clear

Clear the current active context. After clearing, commands will require explicit flags for organization, project, etc.

```bash theme={null}
nscale contexts clear
```
