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

# Chatbase CLI

> Install and use the official Chatbase CLI to manage agents, sources, conversations, helpdesk, and WhatsApp from your terminal or CI.

The Chatbase CLI is the official command-line client for the [Chatbase API v2](/docs/api-v2/overview). Use it to manage agents, knowledge sources, conversations, helpdesk tickets, and WhatsApp templates from your terminal or CI pipelines.

<Info>
  Requires **Node.js 20+**. Interactive login uses your Chatbase account in the browser (`chatbase auth login --browser`). API keys (Standard plan or higher) work for paste-login and CI — create them in **Workspace settings → API keys**.
</Info>

## Install

```bash theme={null}
npm install -g chatbase
```

Or run without installing:

```bash theme={null}
npx chatbase <command>
```

Check the version:

```bash theme={null}
chatbase --version
```

## Quick start

<Steps>
  <Step title="Authenticate in the browser">
    ```bash theme={null}
    chatbase auth login --browser
    ```

    This opens a browser window and shows a short code. Approve the code at [chatbase.co/activate](https://www.chatbase.co/activate). The CLI stores the credential for later commands.

    Prefer pasting an API key instead? Run `chatbase auth login` and paste a key from **Workspace settings → API keys**. See [CLI Auth](/docs/cli/auth) for all login options.
  </Step>

  <Step title="List your agents">
    ```bash theme={null}
    chatbase agents list
    ```
  </Step>

  <Step title="Send a message">
    ```bash theme={null}
    chatbase chat -a agt_123 -m "How do I reset my password?"
    ```
  </Step>
</Steps>

## Authenticate in CI

In non-interactive environments, set an API key in the environment instead of running `auth login`:

```bash theme={null}
export CHATBASE_API_KEY=cb_...
chatbase agents list
```

Optionally pin a default agent:

```bash theme={null}
export CHATBASE_AGENT_ID=agt_123
# or
chatbase config set agent agt_123
```

<Warning>
  Never commit API keys. Prefer secrets managers or CI secret stores.
</Warning>

## Global output flags

Most commands support:

| Flag             | Purpose                          |
| ---------------- | -------------------------------- |
| `--json`         | Raw API JSON                     |
| `--plain`        | Tab-separated output for scripts |
| `--quiet` / `-q` | Suppress non-essential output    |
| `--verbose`      | Verbose diagnostics              |
| `--no-input`     | Never prompt; fail instead       |
| `--no-color`     | Disable colored output           |

## Privacy

The CLI sends no telemetry. Requests include a `chatbase-cli/<version>` User-Agent so Chatbase can distinguish CLI traffic. The only network calls are the API calls you invoke.

## Commands

<CardGroup cols={2}>
  <Card title="Auth" icon="key" href="/docs/cli/auth">
    Log in, log out, and inspect credentials.
  </Card>

  <Card title="Agents" icon="robot" href="/docs/cli/agents">
    Create, update, train, clone, and delete agents.
  </Card>

  <Card title="Sources" icon="database" href="/docs/cli/sources">
    Manage knowledge sources (text, Q\&A, links, files).
  </Card>

  <Card title="Chat" icon="comments" href="/docs/cli/chat">
    Send messages and stream responses.
  </Card>

  <Card title="Conversations" icon="message" href="/docs/cli/conversations">
    List, inspect, and export conversations.
  </Card>

  <Card title="Tickets" icon="ticket" href="/docs/cli/tickets">
    Manage helpdesk tickets and lookups.
  </Card>

  <Card title="WhatsApp" icon="whatsapp" href="/docs/cli/whatsapp">
    List templates and send template messages.
  </Card>

  <Card title="Config" icon="gear" href="/docs/cli/config">
    Set default agent and timeout.
  </Card>

  <Card title="API" icon="code" href="/docs/cli/api">
    Call any API v2 endpoint directly.
  </Card>

  <Card title="Health" icon="heart-pulse" href="/docs/cli/health">
    Check that the API is reachable.
  </Card>
</CardGroup>

## Uninstall

```bash theme={null}
npm uninstall -g chatbase
rm -rf ~/.config/chatbase ~/.local/state/chatbase ~/.cache/chatbase
rm -rf ~/Library/Caches/chatbase   # macOS: update-check cache
```

<Tip>
  For every flag on a command, run `chatbase <command> --help`.
</Tip>
