> For the complete documentation index, see [llms.txt](https://docs.kick.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kick.co/ai/cli/cli-quickstart/authenticate-and-select-workspace.md).

# Authenticate and Select Workspace

Log in to the Kick CLI, use personal access tokens safely, and confirm the workspace before running client commands.

Before running client commands, confirm who the CLI is acting as and which workspace the command will use.

### Log in interactively

For interactive use, run:

```bash
kick login
```

The browser flow lets you approve a personal access token. The CLI stores the token in your OS keychain when available. If a keychain is unavailable, it falls back to `~/.config/kick/credentials` with restricted file permissions.

Confirm the active user:

```bash
kick whoami
```

### Use a token for scripts

For scripts, CI, or agent jobs, provide a PAT explicitly:

```bash
export KICK_PAT=kick_pat_...
kick whoami
```

Token lookup order is:

1. `--token <value>`
2. `KICK_PAT`
3. `KICK_API_TOKEN` for the older environment variable name
4. OS keychain from `kick login`
5. `~/.config/kick/credentials`

Do not commit PATs, paste them into shared docs, or store them in scripts without a secrets manager.

### Find workspace and entity IDs

Commands and API calls take a workspace ID and often an entity ID. Get both from the CLI. Both commands are **Read**.

To list every workspace you can access, with its **ID** (a UUID), **NAME**, **PLAN**, and **ORGANIZATIONS** (how many organizations it belongs to), run:

```bash
kick workspaces list
```

To get the entity IDs in one workspace, run `kick workspaces context` with that workspace's ID. Entity IDs are whole numbers, listed under `reportableEntities` with each entity's name. Only business entities are listed, not personal ones:

```bash
kick workspaces context 3fa85f64-5717-4562-b3fc-2c963f66afa6 --output json
```

In an MCP connection, ask your assistant for the IDs ("What's the workspace ID and entity ID for Acme?"). It looks them up with `context_browse` or `context_resolve`.

### Select a workspace

Run a command in a workspace:

```bash
kick --workspace <workspace-id> transactions find --limit 10
```

To avoid repeating `--workspace` on every command, set a local default:

```bash
kick workspaces use <workspace-id>
```

If you work across multiple clients, pass `--workspace` explicitly. This is safer than relying on a remembered default.

### Use profiles for repeated work

Profiles can store environment and workspace defaults. These commands write local settings and sign in for the new profile:

```bash
kick config set profiles.acme.defaultWorkspaceId <workspace-id>
kick config set defaultProfile acme
kick --profile acme login
kick --profile acme whoami
```

Each profile has its own login. `kick login` stores its token under the active profile, so a new profile needs its own `kick login` unless you set `KICK_PAT`.

The CLI stores profiles in `~/.config/kick/config.json`, next to the `credentials` fallback file. To use another folder, set `KICK_CONFIG_DIR` (the file becomes `$KICK_CONFIG_DIR/config.json`), or set `XDG_CONFIG_HOME` to replace `~/.config`. `KICK_CONFIG_DIR` wins when both are set. Inspect the config with:

```bash
kick config get
```

Use named profiles only when the team understands what each profile points to.

### Sign out

When you are done on a shared machine:

```bash
kick logout
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.kick.co/ai/cli/cli-quickstart/authenticate-and-select-workspace.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
