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

# CLI

> Use the ChatterMate CLI to sign up, log in, mint access tokens, and configure agents, workflows, and knowledge from your terminal, built for automation and CI.

# ChatterMate CLI

The ChatterMate CLI (`chattermate`) lets you sign up, log in, mint access tokens, and configure
agents, workflows, and knowledge sources directly from your terminal — no browser required. It's
ideal for automation, CI pipelines, and scripting your ChatterMate setup.

> [!NOTE]
>
> The CLI and MCP server are part of the **enterprise/commercial edition**. They authenticate with
> [Personal Access Tokens](#personal-access-tokens), which require the enterprise backend.

> [!WARNING]
>
> **Not the tool you were looking for?** This page is the **account CLI** — it signs you up and
> manages agents, workflows, and knowledge against the ChatterMate API. If you want to **self-host
> ChatterMate with Docker**, you need the separate self-host CLI (`npm install -g chattermate-deploy`),
> documented in the [Quickstart → Self-host](https://docs.chattermate.chat/quickstart.md#option-b-self-host-with-docker). Both install
> a `chattermate` command, but they are different tools.

## Installation

The CLI installs two commands: `chattermate` (with the alias `cmate`) and
[`chattermate-mcp`](https://docs.chattermate.chat/features/mcp-server). Install it from **PyPI** (`chattermate-cli`) or **npm**
(`chattermate-cli`, a thin wrapper that runs the Python CLI via `uvx`/`pipx`).

```bash pipx (recommended) theme={null}
pipx install chattermate-cli
```

```bash pip theme={null}
pip install chattermate-cli
```

```bash npm theme={null}
npm install -g chattermate-cli
```

```bash uvx (no install) theme={null}
uvx --from chattermate-cli chattermate --help
```

> [!NOTE]
>
> The npm package requires `uv` or `pipx` on your PATH (it launches the Python CLI). Prefer pure
> Python? Use `pip`/`pipx` directly.

Verify the install:

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

## Pointing at your instance

By default the CLI talks to the hosted API at `https://api.chattermate.chat` — no
configuration needed. Only set the API URL when targeting a local or self-hosted backend.

```bash theme={null}
# Local / self-hosted backend, per-command
chattermate --api-url http://localhost:8000 whoami

# Or for the whole session
export CHATTERMATE_API_URL=http://localhost:8000
```

The URL resolves in this order: the `--api-url` flag, the `CHATTERMATE_API_URL` environment
variable, your saved config, then the default `https://api.chattermate.chat`.

## Authentication

You can authenticate three ways.

> [tab] Log in (interactive)
>
> Best for day-to-day terminal use. Stores JWT access + refresh tokens in
> `~/.chattermate/config.json` (mode `600`) and refreshes them automatically.
>
> ```bash theme={null}
> chattermate login --email you@acme.com
> # password is prompted securely
> ```

> [tab] Google or Microsoft sign-in
>
> Accounts that sign in with Google or Microsoft have no password. Create a token in the
> dashboard under **Settings → CLI & API tokens**, then paste it at the hidden prompt:
>
> ```bash theme={null}
> chattermate login --token
> ```
>
> The token is saved to `~/.chattermate/config.json` (mode `600`) and replaces any earlier login.

> [tab] Personal Access Token
>
> Best for automation, CI, and AI agents. Long-lived and revocable. Pass it via the
> `CHATTERMATE_TOKEN` environment variable.
>
> ```bash theme={null}
> export CHATTERMATE_TOKEN=cmat_xxxxxxxxxxxxxxxxxxxx
> chattermate whoami
> ```

### Sign up

Create a new organization and admin user without leaving the terminal. Signup emails a
**one-time code** to `--admin-email`; supply it with `--otp` or enter it at the prompt:

```bash theme={null}
chattermate signup \
  --name "Acme Inc" \
  --domain acme.com \
  --admin-email admin@acme.com \
  --admin-name "Ada Admin"
# a one-time code is emailed to admin@acme.com — enter it when prompted
# admin password is prompted securely
```

You're logged in automatically after signup.

> [!NOTE]
>
> Running a **single-org self-hosted** instance (no email delivery)? Add `--community` to create
> the org directly without OTP verification.

## Personal Access Tokens

Personal Access Tokens (PATs) are long-lived, revocable credentials prefixed with `cmat_`. They
are the recommended way to authenticate the [MCP server](https://docs.chattermate.chat/features/mcp-server.md), CI jobs, and any
headless automation.

> [!WARNING]
>
> A token's secret is shown **only once**, at creation time. Store it somewhere safe — it cannot be
> retrieved again.

You can also create, list and revoke tokens in the dashboard under **Settings → CLI & API tokens**. `token create` needs an email-and-password login, so if you logged in with `--token`, make new tokens in the dashboard.

**1. Create a token**

```bash theme={null}
chattermate token create laptop-cli
# optionally set an expiry:
chattermate token create ci --expires-in-days 90
```

The output includes the `cmat_...` secret and a ready-to-paste
[MCP client config](https://docs.chattermate.chat/features/mcp-server.md#configuration) snippet.

**2. List your tokens**

```bash theme={null}
chattermate token list
```

Only the non-secret prefix and metadata are shown.

**3. Revoke a token**

```bash theme={null}
chattermate token revoke <token-id>
```

PATs are also managed through the API at `/api/v1/enterprise/tokens` (`POST` create, `GET` list,
`DELETE /{id}` revoke).

## Managing resources

Every command supports a `--json` flag for machine-readable output, making the CLI easy to script.

> [accordion] Agents
>
> ```bash theme={null}
> # List agents
> chattermate agent list
>
> # Inspect one
> chattermate agent get <agent-id>
>
> # Create an agent (type: customer_support, sales, tech_support, general, custom)
> chattermate agent create \
>   --name "Support" \
>   --type customer_support \
>   -i "Be concise and friendly" \
>   -i "Escalate billing questions to a human"
>
> # Update instructions / state
> chattermate agent update <agent-id> -i "New instruction" --inactive
> ```

> [accordion] Workflows
>
> ```bash theme={null}
> # Get the workflow attached to an agent
> chattermate workflow get <agent-id>
>
> # Create a workflow
> chattermate workflow create --agent-id <agent-id> --name "Onboarding"
>
> # Update metadata (status: draft, published, archived)
> chattermate workflow update <workflow-id> --status published
>
> # Read or replace nodes & connections
> chattermate workflow nodes <workflow-id>
> chattermate workflow set-nodes <workflow-id> --file nodes.json
> ```

> [accordion] Knowledge
>
> ```bash theme={null}
> # Upload local PDF file(s) (optionally attach to an agent)
> chattermate knowledge add-file ./guide.pdf ./faq.pdf --agent-id <agent-id>
>
> # Add website and/or PDF URLs (optionally attach to an agent)
> chattermate knowledge add-url \
>   --website https://docs.acme.com \
>   --pdf-url https://acme.com/guide.pdf \
>   --agent-id <agent-id>
>
> # List sources linked to an agent
> chattermate knowledge list <agent-id>
>
> # Link / unlink an existing source
> chattermate knowledge link <knowledge-id> <agent-id>
> chattermate knowledge unlink <knowledge-id> <agent-id>
>
> # Check ingestion progress
> chattermate knowledge status <queue-id>
> ```

> [accordion] AI model
>
> ```bash theme={null}
> # New organizations already use the free ChatterMate model by default.
> # Switch to your own provider/key at any time:
> chattermate ai setup --model-type openai --model-name gpt-4o --api-key sk-...
>
> # Or (re)apply the free ChatterMate model:
> chattermate ai setup
>
> # Show the current AI configuration
> chattermate ai show
> ```
>
> Providers: `chattermate` (free managed), `openai`, `anthropic`, `google`, `groq`,
> `mistral`, `xai`, `deepseek`, and `openai_compatible`. Custom models require a Pro
> plan. `openai_compatible` also needs the base URL of your endpoint — see
> [Self-hosted and gateway models](https://docs.chattermate.chat/deployment/self-hosted-models.md).

> [accordion] Widgets
>
> ```bash theme={null}
> # Create an embeddable widget for an agent — prints the widget id + embed snippet
> chattermate widget create --agent-id <agent-id> --name "Website widget"
>
> # List an agent's widgets (their ids are what you embed)
> chattermate widget list <agent-id>
>
> # Show or set the sites the widget may run on (in-app actions only run on these)
> chattermate widget domains <widget-id>
> chattermate widget domains <widget-id> --set app.acme.com --set "*.acme.com"
> chattermate widget domains <widget-id> --clear        # asks first; add --yes to skip
> ```
>
> The widget id is what goes in `window.chattermateId` — see [Widget integration](https://docs.chattermate.chat/features/widget.md).
> `--set` replaces the whole list. An empty list lets the widget load on any site and turns
> in-app actions off.

> [accordion] In-app actions
>
> Declare what the agent can do inside your web app. Your page supplies the code with
> `ChatterMate.registerActions` — see [In-app actions](https://docs.chattermate.chat/features/in-app-actions.md).
>
> ```bash theme={null}
> # List actions, and whether a page has registered code for each
> chattermate action list <agent-id>
>
> # Declare one (confirm: never | always | when_overwriting)
> chattermate action create <agent-id> \
>   --name set_currency --label "Change currency" \
>   --description "Changes the account's default currency" \
>   --confirm when_overwriting \
>   --parameters '{"type":"object","properties":{"code":{"type":"string"}},"required":["code"]}'
>
> # Change only what you pass; name the action by its id or name
> chattermate action update <agent-id> set_currency --label "Switch currency" --timeout 30
> chattermate action update <agent-id> set_currency --parameters-file schema.json
>
> # Turn it off or on, see exactly what the model is told, or delete it
> chattermate action disable <agent-id> set_currency
> chattermate action enable <agent-id> set_currency
> chattermate action model-view <agent-id> set_currency
> chattermate action delete <agent-id> set_currency      # asks first; add --yes to skip
> ```

> [accordion] Journeys
>
> Step-by-step guides the widget walks users through (**Pro**) — see [Journeys](https://docs.chattermate.chat/features/journeys.md).
> A journey is named by its id or its key.
>
> ```bash theme={null}
> # Templates, and the page fields journeys can use
> chattermate journey templates <agent-id>
> chattermate journey context-keys <agent-id>
>
> # Create from a template (a draft), or from your own JSON
> chattermate journey from-template <agent-id> saas_onboarding --key setup
> chattermate journey create <agent-id> --file journey.json
>
> # Edit: print it, change the file, send it back
> chattermate journey show <agent-id> setup > setup.json
> chattermate journey update <agent-id> setup --file setup.json
> chattermate journey update <agent-id> setup --name "Get set up" --goal-event first_record_created
>
> # Go live, pause, and set which journey wins (first listed runs first)
> chattermate journey status <agent-id> setup live
> chattermate journey order <agent-id> setup trial_to_paid
>
> # How far users got, and who is waiting on a step
> chattermate journey funnel <agent-id> setup --days 7
> chattermate journey stuck <agent-id> setup <step-id>
>
> chattermate journey delete <agent-id> setup           # removes everyone's progress too
> ```
>
> `journey update --file` leaves `status` and `priority` as they are, so an old file can't
> undo a pause or a reorder made since. Change them with `journey status`, `journey order` or
> `--priority`. Fields the server sets (`id`, `version`, timestamps) are ignored, and an
> unknown field is refused.

> [accordion] Lead capture
>
> ```bash theme={null}
> # Show an agent's lead-capture configuration
> chattermate lead-capture show <agent-id>
>
> # Turn lead capture on and choose which details to collect
> chattermate lead-capture set <agent-id> --enable --fields email,name,company
>
> # Mark extra fields required and require GDPR consent
> chattermate lead-capture set <agent-id> --required email,company --consent
>
> # Turn it off
> chattermate lead-capture set <agent-id> --disable
> ```
>
> `set` fetches the current config, applies your flags, and saves the result
> (custom fields configured in the dashboard are preserved). Email is always
> collected and required. Lead capture is a **Pro** feature — see
> [Lead capture](https://docs.chattermate.chat/features/lead-capture.md).

> [accordion] Chat customization
>
> ```bash theme={null}
> # Show an agent's chat widget appearance
> chattermate customization show <agent-id>
>
> # Colors + design theme
> chattermate customization set <agent-id> --accent "#7c3aed" --style GLASS
>
> # Welcome message, quick actions, and toggles
> chattermate customization set <agent-id> \
>   --welcome-title "Hi there!" \
>   --quick-action "Pricing" --quick-action "Book a demo" \
>   --collect-email
> ```
>
> Options include colors (`--accent`, `--background`, `--bubble`, `--text`,
> `--icon-color`), design theme `--style` (`CHATBOT`, `ASK_ANYTHING`, `GLASS`,
> `TERMINAL`, `PLAYFUL`, `CALM_MINT`, `AURORA`, `SUNRISE`), `--position`
> (`FLOATING`/`FIXED`), `--font`, `--custom-css`, welcome title/subtitle/message,
> `--quick-action`, `--initiation-message`, `--show-citations` and
> `--collect-email`. Only the options you pass change — the rest keep their
> current values. See [Chat customization](https://docs.chattermate.chat/features/ai-customization.md).
>
> Text limits: welcome title ≤ 100, subtitle ≤ 250, message ≤ 500, and each
> initiation nudge ≤ 100 characters (nudges are also clamped to 4 lines in the
> launcher).

> [accordion] Behaviour: transfer to human & ratings
>
> ```bash theme={null}
> # Let the agent hand off to a human, and ask visitors to rate the chat
> chattermate agent update <agent-id> --transfer-to-human --ask-for-rating
>
> # Turn them off
> chattermate agent update <agent-id> --no-transfer-to-human --no-ask-for-rating
> ```

> [accordion] Help center & FAQs
>
> Manage the public [Help Center](https://docs.chattermate.chat/features/help-center.md) — FAQs, imports, branding, and
> custom domain. (Generating FAQs from the knowledge base stays in the dashboard.)
>
> ```bash theme={null}
> # Create, list and publish FAQs
> chattermate help-center faq create \
>   --question "How do I reset my password?" \
>   --answer "Open **Settings → Security**." --status published
> chattermate help-center faq list --status published
> chattermate help-center faq publish <faq-id> [<faq-id> ...]
>
> # Import from a URL (qa = AI extraction, articles = crawl as-is) or a PDF
> chattermate help-center import url https://help.acme.com --mode articles
> chattermate help-center import pdf ./faqs.pdf
>
> # Brand the site and set a logo
> chattermate help-center configure --title "Acme Help" --brand-color "#4338CA" --enable
> chattermate help-center logo set ./logo.png
>
> # Connect and verify a custom domain (prints the DNS records to add)
> chattermate help-center domain set help.acme.com
> chattermate help-center domain status
> chattermate help-center domain verify
>
> # Track a background import
> chattermate help-center jobs list
> ```
>
> The help center is a **Pro/Enterprise** feature. See [Help Center](https://docs.chattermate.chat/features/help-center.md).

## Command reference

| Command | Description |
| - | - |
| `chattermate signup` | Create an organization and admin user |
| `chattermate login` | Log in with email and password; `--token` logs in with a personal access token |
| `chattermate logout` | Remove stored credentials |
| `chattermate whoami` | Show the authenticated user |
| `chattermate token create <name>` | Create a Personal Access Token |
| `chattermate token list` | List your tokens |
| `chattermate token revoke <id>` | Revoke a token |
| `chattermate agent list\|get\|create\|update` | Manage AI agents (including `--transfer-to-human` / `--ask-for-rating`) |
| `chattermate customization show\|set` | Show/configure an agent's chat widget appearance |
| `chattermate workflow get\|create\|update\|nodes\|set-nodes` | Manage workflows |
| `chattermate knowledge add-file\|add-url\|list\|link\|unlink\|status` | Manage knowledge sources (local PDFs or URLs) |
| `chattermate widget create\|list\|domains` | Create/list embeddable widgets, and set the sites each may run on |
| `chattermate action list\|create\|update\|enable\|disable\|delete\|model-view` | Declare the [in-app actions](https://docs.chattermate.chat/features/in-app-actions.md) an agent can run in your app |
| `chattermate journey list\|templates\|context-keys\|show\|create\|from-template\|update\|status\|order\|delete\|funnel\|stuck` | Build and track [journeys](https://docs.chattermate.chat/features/journeys.md) (Pro) |
| `chattermate lead-capture show\|set` | Show/configure an agent's lead capture (Pro) |
| `chattermate ai setup\|show` | Set/show the org's AI model (defaults to the free ChatterMate model) |
| `chattermate help-center faq\|import\|configure\|logo\|domain\|jobs` | Manage the public [help center](https://docs.chattermate.chat/features/help-center.md) — FAQs, imports, branding, custom domain (Pro) |

## Configuration & environment

| Variable | Purpose |
| - | - |
| `CHATTERMATE_API_URL` | API base URL (default `https://api.chattermate.chat`; set to `http://localhost:8000` for local) |
| `CHATTERMATE_TOKEN` | A Personal Access Token (`cmat_...`) for non-interactive auth |
| `CHATTERMATE_CONFIG_DIR` | Override the config directory (default `~/.chattermate`) |

Credentials and the saved API URL live in `~/.chattermate/config.json` (written with `600`
permissions).

## Next steps

> [card] [MCP Server](https://docs.chattermate.chat/features/mcp-server.md)
>
> Let AI agents configure ChatterMate through the Model Context Protocol.

> [card] [Authentication](https://docs.chattermate.chat/features/authentication.md)
>
> Learn how ChatterMate handles users, sessions, and tokens.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.