Installation
logout --all, native credential storage, and --api-key require CLI 0.21.0 or later.
On Windows, use CLI 0.21.2 or later to save and reuse OAuth credentials with a standard user account.
Authentication
Browser login
--project restricts project selection. --scopes requests fewer permissions, with cli:project projects:read always included.
Authorizing the same user and project replaces the previous CLI connection, including another device.
SSH and headless login
--browser forces the local callback flow.
--no-browser prints a URL for that callback flow without opening it.
API keys
--api-key:
KAPSO_API_KEY, then saved OAuth. Do not combine an API key with --project.
The flag value is not saved. Environment variables keep the key out of shell history and process arguments.
Credentials
The CLI uses macOS Keychain, Windows Credential Manager, or Linux Secret Service to protect OAuth credentials. It stores an encrypted file under~/.kapso/cli/oauth/ and migrates existing credentials on their next save or refresh.
If native storage is unavailable, the CLI warns and uses a protected file. POSIX files use mode 0600. Windows uses a private ACL.
The CLI does not replace an existing encrypted file with plaintext when its keychain is locked or unavailable.
KAPSO_CREDENTIAL_STORE=file explicitly selects file storage for new credentials. Existing encrypted credentials still require their keychain. KAPSO_CLI_HOME isolates local state for tests or separate installations.
Disconnect
--all requires a saved OAuth connection that can still authenticate. With multiple saved accounts, select a project first.
Other accounts, servers, MCP/native apps, and API keys are unaffected.
If remote revocation fails, the CLI clears matching local credentials and reports that it cannot confirm remote success.
In Integrate → OAuth, click a connection to inspect permissions and its Reported device.
Owners and admins can revoke any member’s connection. Members can revoke their own connections.
The device name comes from the client. It does not identify a separate session for each physical device.
Migrate an older login
Runkapso login to replace a pre-OAuth login with an OAuth connection. Older logins still work; interactive commands remind you to migrate at most once every 24 hours. No retirement date has been announced.
Project API keys remain supported for scripts and CI. They do not need to migrate to OAuth.
Project context
The CLI remembers your active project.projects list shows connections saved locally. Authorize each additional project with kapso login --project <project-id>.
organization remains null.
Setup
Connect a WhatsApp number to your project:Numbers
--phone-number or --phone-number-id to specify which number to act on. You can also pass the number as a positional argument where supported.
Messages
Send a text message
Send to a BSUID
Use--recipient for a business-scoped user ID (BSUID):
--to and --recipient when both identifiers belong to the same customer.
Send with a JSON payload
For media, interactive, or any advanced message type, pass a JSON payload:Select a messaging account or endpoint
--messaging-account-id selects the WhatsApp Business Account used for the send. It must match the account configured for the phone number and overrides the same field in a JSON payload.
For Meta’s Marketing Messages endpoint, use an eligible account and an approved marketing template payload:
messages. The CLI sends raw JSON payloads through the Graph v24 proxy; Meta’s account and template requirements still apply.
List and get messages
Conversations
passive and origin attribution for messages handled by another app.
Conversation routing
On numbers shared with another app or Meta’s AI agent, regular messages require Kapso to handle the conversation. Templates remain available, subject to the usual WhatsApp rules. See Conversation routing.--to, --recipient, or both. Optional --metadata passes up to 2,000 characters to the receiving app. The roles for pass are escalation, ai_agent, customer_service, marketing, utility, and ctwa; Meta must enable the action and role on the account.
To explicitly take control while sending, add --take-control:
Calls
Read-only. Requires CLI 0.19.1 or later.calls artifact needs KAPSO_API_KEY or --api-key. Recording inspection prints metadata only. Transcript inspection adds a short text preview; use --download for Meta’s original JSON. Existing files aren’t replaced unless you pass --force. See Recordings and transcripts.
Templates
Webhooks
Create a webhook
whatsapp.thread.ownership_changedwhatsapp.thread.standbywhatsapp.meta_business_agent.handover
kapso whatsapp webhooks new --help for the complete event list. Subscribe to routing events on the number webhook; account enforcement and phone lifecycle events use a project webhook. See Message events.
Manage webhooks
Message buffering
Buffer multiplewhatsapp.message.received events into a single delivery:
Project webhooks
Create a webhook without a number selector for project events, including account enforcement and phone connection changes. Those WhatsApp events require payload versionv2.
list includes number webhooks across the project. test queues a sample for a subscribed event; check your receiver to confirm delivery. Omit --event to let the server choose a subscribed event.
Webhook creation prints the signing secret. Both webhook scopes accept repeated --header Name=value flags; custom header names keep their original spelling. See Project webhooks for event payloads.
Customers
Logs
--source is all, external_api_log, whatsapp_webhook_event, flow_event, or webhook_delivery. --period is 24h, 7d, or 30d. Repeat --filter key=value to narrow results.
Local workflow development
Use these commands when you want to keep Kapso workflows and functions in a local repository.kapso pull writes local source files for workflows and functions. If you edit workflows with @kapso/workflows, build the generated JSON before pushing:
Output formats
All commands support--output json or --output human. Most default to json — pipe into jq for scripting:
API errors
Message, thread-control, and webhook commands exit with a nonzero status on failure. With--output json, they write an error object to stderr with the HTTP status, error code, provider details when available, and a hint for routing refusals.
A 409 ownership refusal means Kapso cannot send a regular message in that conversation. Meta code 2494191 means Kapso cannot take control; code 100 with “not supported” means the action or target role is unavailable on the account.
After a 502 with an unknown thread-control result, the CLI reports outcome: "unknown", retryable: false, and retry.action: "verify_ownership". Check ownership through conversation state or a routing webhook before another action. The CLI does not retry thread-control actions automatically.

