# QwryAI CLI > Install qwryai-cli and work with your agents, sources, conversations, tickets and WhatsApp templates from a terminal, a script or CI `qwryai-cli` is the official command-line client for the QwryAI tools: the same tools the QwryAI MCP server and Backstage use. Instead of one command per resource, it has three building blocks. `tools:list` shows the tools your credential may use, `tools:call` runs one, and `apply` confirms a change a tool prepared for you. Everything else on these pages, from listing agents to sending a test message, is a `tools:call`. > [!NOTE] > > Requires **Node.js 18** or newer and a workspace on a paid plan (**Starter**, **Growth**, **Pro** or **Enterprise**). You can sign in through your browser with `qwryai-cli auth:login`, or use an API key from **Workspace settings › API keys** for scripts and CI. ## Install ```bash npm install -g qwryai-cli ``` Or run it without installing: ```bash npx qwryai-cli tools:list ``` Check the version: ```bash qwryai-cli version ``` ```json {"success":true,"version":"1.0.0"} ``` ## Quick start **1. Sign in with your browser** ```bash qwryai-cli auth:login ``` The CLI opens the QwryAI approval page and prints a short device code. Check that the code matches, choose what the CLI may do, and select **Approve qwryai-cli**. The CLI stores the credential for later commands. See [CLI Auth](/docs/cli/auth) for every way to sign in. **2. List your agents** ```bash qwryai-cli tools:call list_agents ``` Each agent in the reply has an `id`. Agent tools take it as `chatbotId`, so keep it in a shell variable: ```bash AGENT=$(qwryai-cli tools:call list_agents | jq -r '.data.agents[] | select(.name=="QwryAI") | .id') ``` **3. Send a message** ```bash CONV=$(qwryai-cli tools:call create_conversation --args "{\"chatbotId\":\"$AGENT\"}" | jq -r '.data.conversationId') qwryai-cli tools:call send_message --args "{\"chatbotId\":\"$AGENT\",\"conversationId\":\"$CONV\",\"content\":\"How do I reset my password?\"}" ``` The reply comes back in full once the agent has answered. See [CLI Chat](/docs/cli/chat). ## Authenticate in CI Where nobody can approve a browser login, set an API key in the environment instead of running `auth:login`: ```bash export QWRYAI_API_KEY= qwryai-cli tools:call list_agents ``` The key can do what you chose when you created it, and never more than your own workspace role allows. > [!WARNING] > > Never commit API keys. Keep them in your CI provider's secret store or a secrets manager, and delete a key from **API keys** as soon as a machine or workflow no longer needs it. These environment variables change where the CLI connects: | Variable | Purpose | | - | - | | `QWRYAI_API_KEY` | API key used when no browser login is stored | | `QWRYAI_API_URL` | API origin or full public API URL. Defaults to `https://api.qwryai.com/public/v1` | | `QWRYAI_AUTH_SERVER` | Sign-in server origin. Defaults to the API origin | | `QWRYAI_MCP_URL` | MCP endpoint printed by `mcp:config`. Defaults to the API origin's `/mcp` path | Every address must use HTTPS. Plain HTTP is accepted only for `localhost`. ## Output Every command prints JSON, so there are no output flags to remember. Commands that report more than one event, such as `auth:login`, print one JSON object per line. | Field | Meaning | | - | - | | `success` | `true` when the command worked | | `data` | What the tool returned | | `error.message` | Why the command failed | | `error.code` | A machine-readable code, such as `INSUFFICIENT_PERMISSION` | | `error.httpStatus` | The HTTP status QwryAI answered with | Failed commands also exit with a non-zero code, so `set -e` scripts stop on the first error. Pipe the output to `jq` to pick out fields. ## Reviewed changes Tools that change settings, sources, actions or procedures never apply anything on their own. They answer with `"status": "review_required"`, the `before` and `after` of each change and a `reviewId`. Nothing changes until you run: ```bash qwryai-cli apply ``` A review lasts 15 minutes, can be applied once, and only by the credential that prepared it. See [CLI API](/docs/cli/api) for the full flow. ## Privacy The CLI sends no telemetry. It talks only to the QwryAI API and sign-in server you point it at, and only when you run a command. A browser login is stored in `~/.qwryai/credentials.json`, readable by your user alone. ## Commands > [card] Auth | /docs/cli/auth | Sign in with your browser or an API key, check status and sign out. > [card] Agents | /docs/cli/agents | List agents, read their settings, change instructions, model and styles. > [card] Sources | /docs/cli/sources | Add text, Q&A and websites, then train your agent. > [card] Chat | /docs/cli/chat | Start a conversation and talk to an agent as a customer. > [card] Conversations | /docs/cli/conversations | Find, read and handle conversations from every channel. > [card] Tickets | /docs/cli/tickets | List, search and read Helpdesk tickets, statuses and teams. > [card] WhatsApp | /docs/cli/whatsapp | List approved templates and send them to contacts. > [card] API | /docs/cli/api | List every tool and call any of them directly. To connect an MCP client such as Cursor instead, `qwryai-cli mcp:config` prints a ready-made server block that reads your key from `QWRYAI_API_KEY`. See [MCP Server](/docs/developer-guides/mcp). ## Uninstall ```bash qwryai-cli auth:logout npm uninstall -g qwryai-cli ``` `auth:logout` revokes your browser login and deletes `~/.qwryai/credentials.json`. Remove `QWRYAI_API_KEY` from your shell profile or CI secrets yourself. > [!TIP] > > Run `qwryai-cli help` for the commands, environment variables and examples, and `qwryai-cli tools:list` for every tool with its input schema.