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

# Authentication

> Log in through the browser and manage credentials for one or more workspaces.

The CLI authenticates through your browser and stores credentials locally — you never paste an API key.

## Log in

```bash theme={"system"}
neetocal login --subdomain your-workspace
```

This opens your browser to complete the sign-in. Once approved, the CLI saves the credentials for that subdomain. Omit `--subdomain` and the CLI prompts you for it.

<Tip>
  Your subdomain is the first part of your workspace URL — for
  `https://spinkart.neetocal.com`, the subdomain is `spinkart`.
</Tip>

## Where credentials are stored

Credentials for every logged-in workspace live in a single file:

```
~/.config/neetocal/auth.json
```

Removing this file logs you out of every workspace, the same as `neetocal logout --all`.

## Check who you are

```bash theme={"system"}
neetocal whoami
```

Lists every logged-in account. When exactly one is logged in, it is marked `(default)`. Pass `--subdomain <name>` to show just one.

## Log out

```bash theme={"system"}
neetocal logout --subdomain your-workspace   # remove one workspace
neetocal logout --all                         # remove every workspace
neetocal logout                               # remove the only one, if a single workspace is logged in
```

## Working with multiple workspaces

If you manage more than one NeetoCal workspace, the CLI makes it easy to juggle them.

You can be logged into several subdomains at once. Once you are logged into one, log into another by naming its subdomain:

```bash theme={"system"}
neetocal login --subdomain globex
```

When more than one workspace is logged in, passing `--subdomain` becomes mandatory on every command that talks to the API. This ensures each command runs against the workspace you intend. Skip it, and the CLI errors and asks you to specify a subdomain.

```bash theme={"system"}
neetocal bookings list --subdomain acme
neetocal bookings list --subdomain globex
```

While a single workspace is logged in it stays the implicit default, so `--subdomain` is optional until you add a second.

<Note>
  `login`, `logout`, and `whoami` always act on the subdomain you name (or
  prompt when it is ambiguous), so they work regardless of how many workspaces
  are logged in.
</Note>

## Troubleshooting

Run into problems? Start with `neetocal doctor`, which checks your credentials and connectivity. See [Troubleshooting](/cli/troubleshooting) for the common authentication errors and how to resolve each one.
