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

# CLI commands

> Every totebot command

Run `totebot <command> --help` for the full list of flags. Every command takes `--json`, `--profile`, `--api-key` and `--api-url`, before or after the command (`totebot --json agents list` works). `--api-url` must be `https://`, or `http://` to this machine (`localhost`, `127.0.0.1`); any other `http://` URL is refused unless you add `--insecure`, since the key would travel unencrypted. Commands that change data also take `--dry-run`, and destructive and confirm-required ones take `--yes`.

Wherever a command takes `<agent>`, you can pass the agent's id or its exact name (case does not matter), use `--agent <id|name>` instead, or set `TOTEBOT_AGENT` once for a session. A name that matches several agents is rejected; pass the id then.

## Sign-in

| Command | What it does |
| - | - |
| `totebot login [--api-key <key\|->] [--no-browser]` | Sign in through the browser, or save an existing key |
| `totebot logout [--keep-key]` | Revoke the key and forget it |
| `totebot whoami` | The team, scopes and agents of the current key |

## Agents

| Command | What it does |
| - | - |
| `totebot agents list` | Agents the key can access |
| `totebot agents get <agent>` | One agent with all settings |
| `totebot agents create --name <name> \| --website <url>` | Create an agent |
| `totebot agents update <agent> [--prompt \| --prompt-file] [--model] [--temperature] [--language] [--set key=value] [--from-file]` | Change any setting; `--dry-run` shows each field before and after |
| `totebot agents revisions <agent>` | Every change to the instructions and settings, newest first (last 50) |
| `totebot agents diff <agent> <revision>` | What a revision changed |
| `totebot agents rollback <agent> <revision>` | Put the settings back as they were just before a revision; shows the changes and asks first (`--yes` without a terminal) |
| `totebot agents delete <agent>` | Delete an agent |
| `totebot agents duplicate <agent> [--name]` | Copy an agent |
| `totebot agents models <agent>` | Models with credit multipliers |
| `totebot widget get <agent>` / `widget set <agent> [--welcome] [--suggested] [--set]` | Widget look and messages |
| `totebot skills list\|add\|enable\|delete\|library\|add-from-library` | Skills |
| `totebot templates list\|apply` | Agent templates |
| `totebot actions list\|add\|enable\|delete` | Email, lead capture, API call and handover actions |
| `totebot mcp list\|connect\|enable\|resync\|delete` | MCP server connections |
| `totebot integrations list\|enable` | Integration status and on/off |

`--set` takes any field of the [agent settings](https://docs.totebot.ai/api/public-api.md#agents), for example `--set isPublic=false --set allowedDomains='["example.com"]'`.

`agents update`, `agents rollback`, `widget set` and `bulk update` change how agents answer or what visitors see, so they ask first on a terminal and need `--yes` otherwise. With `--dry-run` they also print `changes`: `{ field: { before, after } }` for `agents update` and `widget set`, the same per agent id for `bulk update`, and `{ field: { from, to } }` plus `skippedFields` for `agents rollback`. `agents delete` is a soft delete and needs a key that covers all agents.

Every change to an agent's instructions, model, temperature, language, AI flags, security, email capture or widget is kept as a revision, whichever way it was made: dashboard, API, Sidekick or a template. A rollback is a revision too, so it can be undone.

## Knowledge and training

| Command | What it does |
| - | - |
| `totebot knowledge list <agent> [--status] [--type]` | Sources with status, errors and validity dates |
| `totebot knowledge get <agent> <source>` | One source with its content |
| `totebot knowledge add-text <agent> --title <t> (--text <t> \| --file <path\|->) [--valid-from] [--valid-until]` | Add text (markdown is fine) |
| `totebot knowledge add-qa <agent> --question <q> --answer <a> [--valid-from] [--valid-until]` | Add a Q\&A pair |
| `totebot knowledge add-link <agent> <url>` | Add a web page |
| `totebot knowledge add-sitemap <agent> <url> [--include] [--exclude]` | Add a sitemap |
| `totebot knowledge add-doc <agent> <file>` | Upload a PDF, TXT, MD or DOCX |
| `totebot knowledge update <agent> <source> ...` | Edit text or Q\&A, and its dates |
| `totebot knowledge set-dates <agent> <source> [--valid-from] [--valid-until]` | Set when the agent uses a source. Applies at once, no training |
| `totebot knowledge delete <agent> <source>` | Remove a source |
| `totebot knowledge retry-failed <agent>` | Re-crawl failed links and retrain |
| `totebot train start <agent> [--wait]` / `train status` / `train wait` | Training; waiting exits with code 11 if knowledge sources failed or the knowledge budget held changes back |

`--valid-from` and `--valid-until` take an ISO date or time, best with your time zone (`2026-11-30T23:59:59+01:00`), or `none` to clear the date. Outside those dates the agent does not use the source. A date you leave out keeps its current value. For example, a Black Friday text that stops on Sunday night:

```bash theme={null}
totebot knowledge add-text <agent> --title "Black Friday" --file black-friday.md \
  --valid-from 2026-11-24T00:00:00+01:00 --valid-until 2026-11-30T23:59:59+01:00
totebot train start <agent> --wait

# The sale runs one more day
totebot knowledge set-dates <agent> <source> --valid-until 2026-12-01T23:59:59+01:00
```

## Analyse and improve

Reads need `knowledge:read`; answers, searches and stats also need `conversations:read`. Test questions need `quality:read` (opt-in: an owner turns it on), and `quality:write` to change them or start a run. See [Analyse your agent with Claude Code](https://docs.totebot.ai/api/analyse-with-claude-code.md) and [Optimize your agents with Claude Code](https://docs.totebot.ai/cli/optimize-agents.md).

| Command | What it does |
| - | - |
| `totebot analyse snapshot <agent>` | Start here: settings, knowledge, gaps, 30-day answer stats and the latest test run |
| `totebot analyse stats <agent> [--from] [--to]` | Search share, empty searches, top and never-returned sources. Searches are kept 90 days; older ranges show the search metrics as not available, not 0% |
| `totebot analyse retrieval <agent> [--empty] [--failed] [--origin] [--from] [--to]` | Knowledge searches and what they returned |
| `totebot analyse answers <agent> <conversation>` | The knowledge and tools behind each reply |
| `totebot gaps list <agent> [--verification] [--include-retrieval-misses]` | Gaps with label, signals, sample questions and draft answer |
| `totebot gaps show <agent> <gap>` | One gap with its evidence |
| `totebot gaps resolve <agent> <gap> (--question --answer \| --title --text)` | Answer a gap with a Q\&A pair or text |
| `totebot gaps dismiss <agent> <gap>` | Dismiss a gap |
| `totebot tests list\|add\|update\|delete <agent> ...` | Test questions (`--question`, repeatable `--fact`, `--sources id,id`) |
| `totebot tests run <agent> [--wait] [--prompt-file] [--model] [--fail-under <percent>] [--format junit]` | Run every test question; preview unsaved instructions or a model. `--fail-under` exits with code 10 below the threshold; a failed run exits with code 11 |
| `totebot tests export <agent>` / `tests import <agent> <file> [--dry-run]` | Test questions as JSON; import adds or replaces by question text and never deletes. `--dry-run` lists the `created`, `updated` and `unchanged` questions |
| `totebot tests runs <agent>` / `tests results <agent> <run>` | Runs, and pass or fail per question |
| `totebot agents readiness <agent>` | Setup checklist and model advice |
| `totebot agents check-prompt <agent> [--prompt-file] [--model] [--refresh]` | AI review of the instructions (or a draft) with exact edits; needs `quality:write` |
| `totebot analyse outcomes <agent> [--interval day\|week\|month] [--timezone] [--from] [--to]` | Handover, thumbs, no-search and empty-search rate, tickets, conversion and revenue over time |
| `totebot report <agent>\|--all-agents [--from] [--to] [--interval] [--timezone] [--format md\|json]` | One readable report: snapshot, outcomes, revenue, usage and top gaps. `--all-agents` needs a key that covers all agents. |
| `totebot usage show [--by agent\|day\|model] [--agents id,id] [--from] [--to]` | Credits and tokens, and the credit balance; provider cost only with `billing:read` |
| `totebot experiments list\|start\|stop\|report <agent> ...` | Live experiments (see [Experiments](https://docs.totebot.ai/dashboard/experiments.md)): `start --name --percent [--model] [--prompt-file]` sends a share of new conversations to a candidate. `start` and `stop` show a summary (split, model change, instruction diff) and ask first; without a terminal they need `--yes`. Starting needs `experiments:write` and `agents:write` (at most 50%); live experiments must be turned on. |

Emails and phone numbers in customer text are masked unless the key has `customers:read`.

## Spot checks and events

| Command | What it does |
| - | - |
| `totebot chat <agent> "<question>" [--prompt-file] [--model]` | One reply with the steps behind it. Nothing is saved and no customer sees it; `--prompt-file` and `--model` apply to this reply only. Needs `chat:write`; billed like a dashboard preview; 200 per key per day |
| `totebot events [--since <cursor\|date>] [--types a,b] [--follow]` | Handovers, tickets created and resolved, gaps detected and verified, knowledge trained or failed, test runs and experiments finished. Needs `events:read` |
| `totebot insights sentiment\|intents\|products\|questions <agent> [--from] [--to]` | Conversation insights |

In CI:

```bash theme={null}
totebot tests run agt_1 --fail-under 90 --format junit > junit.xml
```

## Bulk (several agents at once)

Each bulk command takes `--all-agents` or `--agents id,id` (ids or exact names). When a bulk write fails on some agents, the CLI exits with code 9 and puts every per-agent result in `error.details`. `bulk qa --from-file … --train` trains, once at the end, every agent any of the FAQs changed.

| Command | What it does |
| - | - |
| `totebot bulk qa (--question --answer \| --from-file faq.json) [--valid-from] [--valid-until] [--train]` | Create or replace Q\&A pairs, matched by question |
| `totebot bulk text --title <t> (--text \| --file) [--valid-from] [--valid-until] [--train]` | Create or replace a text source, matched by title |
| `totebot bulk link <url> [--train]` | Add a web page |
| `totebot bulk delete --question \| --title \| --url [--train]` | Remove a matching source |
| `totebot bulk update [agent flags]` | Change settings; `--dry-run` shows the changes per agent |
| `totebot bulk train` | Start training |

`faq.json` is an array: `[{"question": "...", "answer": "..."}]`.

## Help desk

| Command | What it does |
| - | - |
| `totebot tickets list [--view] [--status] [--priority] [--agent] [--search]` | Tickets |
| `totebot tickets show <ticket>` | A ticket with messages and notes |
| `totebot tickets reply <ticket> (--message \| --file)` | Email the customer (asks first; `--yes` without a terminal) |
| `totebot tickets note <ticket> --message <text>` | Internal note |
| `totebot tickets assign <ticket> (--to <email\|userId> \| --none)` | Assign |
| `totebot tickets status <ticket> [STATUS] [--priority]` | Status and priority |

## Data

| Command | What it does |
| - | - |
| `totebot conversations list <agent> [--messages] [--page] [--limit]` / `conversations show <agent> <id>` | Conversations; lists leave out messages unless you pass `--messages` |
| `totebot leads list <agent> [--page] [--limit]` | Captured leads, 50 per page (at most 100) |
| `totebot emails list <agent> [--page] [--limit]` | Emails collected by the chat widget, 50 per page (`customers:read`) |
| `totebot customers list <agent> [--page] [--limit] [--sort]` / `customers show\|erase` | Customers, 50 per page; `erase` needs the `customers:delete` scope |
| `totebot analytics show\|revenue <agent> [--from] [--to] [--timezone]` | Analytics |
| `totebot orders list <agent>` | Attributed orders |
| `totebot knowledge notion <agent>` | The Notion connection |
| `totebot cart-recovery show\|checkouts <agent>` | WhatsApp cart recovery settings, results and abandoned checkouts (phones masked without `customers:read`) |
| `totebot cart-recovery set <agent> [--enabled] [--delay] [--discount] [--discount-days]` | Change cart recovery; needs the opt-in `sales:write` scope |

List commands print the API's pagination (`pagination`, or `meta.pagination` for conversations) with the items. Without the `customers:read` scope, emails and phone numbers in conversation and ticket text come back as `[email]` and `[phone]`.

## Team

| Command | What it does |
| - | - |
| `totebot team show` / `team usage` | Plan, features, usage and limits |
| `totebot members list\|invite\|remove\|cancel-invite` | Members. The CLI can invite and remove members, but never change or remove owners. |
| `totebot helpdesk settings` / `helpdesk update --set key=value` | Help desk settings |
| `totebot email-domains list\|verify` | Sending domains for help desk email |

## Other

| Command | What it does |
| - | - |
| `totebot openapi [--print] [--yaml]` | The OpenAPI spec URL, or the spec |
| `totebot ai-guide` | The guide for coding agents |


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