Use the kirora CLI to manage contacts, events, campaigns and other API resources from your terminal. Commands use the Node.js library for authentication, retries and error handling. This page covers the common tasks; the README is the full reference, and CLI commands lists every command.
kirora login # paste an API key; it is checked, then saved
kirora lists create --name VIPs
kirora contacts list --limit 100 --paginate | jq -r .email
kirora contacts identify --external-id cust_1042 --email [email protected]
kirora webhooks deliveries listInstall
Install @kirora/cli globally from npm. It needs Node.js 22.13 or later and adds the kirora command:
npm install -g @kirora/cli
kirora doctor # check the install, your login and that the API accepts the keykirora completion bash, zsh or fish prints a script that completes commands and flags when you press Tab. Add it to your shell’s startup file, for example kirora completion zsh >> ~/.zshrc.
Sign in
kirora login asks for an API key (kirora_…) at a masked prompt. It checks the key against GET /v1/me before saving it, so a mistyped key fails straight away. In a script, pipe the key in instead:
kirora login -p staging # a second login, named staging
printf %s "$KIRORA_API_KEY" | kirora login
kirora whoami # which key, workspace and scopes a command would use, and where the key came fromThe key is never taken as a flag, where it would land in your shell history. kirora login saves it in your system’s keychain: the macOS Keychain, or the Secret Service (such as GNOME Keyring) on Linux. Where there is none, such as on Windows, the key is kept in $XDG_CONFIG_HOME/kirora/config.json (by default ~/.config/kirora/config.json), readable only by you. --insecure-storage, or KIRORA_CREDENTIAL_STORE=file, keeps it in that file anyway. At login, --base-url saves another API host with the login, and --workspace a partner key’s tenant; without them, KIRORA_API_URL and KIRORA_WORKSPACE are saved when set.
Profiles
Each login is a profile. The first is the active one, default unless you named it with -p, until you choose another:
kirora auth list # your saved logins (never their keys)
kirora auth switch staging # make staging the active login
kirora auth rename staging stage # rename a login
kirora logout # remove the active login; -p staging removes a named onekirora login and kirora logout without -p act on the active profile.
The key’s scopes decide what the CLI may do. See Authentication.
Where the key comes from
Each call takes the first of these that is set:
- The profile named by
-p(--profile), or by theKIRORA_PROFILEenvironment variable. - The
KIRORA_API_KEYenvironment variable, for CI and scripts, which need no login.KIRORA_API_URLsets another host (the default ishttps://api.kirora.io) andKIRORA_WORKSPACEa partner key’s tenant. - The active profile.
Commands
Every command is kirora <resource> <action>, and there is one for each operation in the API reference: CLI commands lists them all.
- The resource is the first part of the path:
/v1/sending-domains/…issending-domains. - The action is what the operation does:
kirora sending-domains check. - A sub-collection has a group of its own, whose actions are the verbs:
kirora webhooks deliveries list,kirora templates versions get,kirora lists contacts add. - A read of one part of a resource is named after that part:
kirora campaigns metrics <id>,kirora lists usage <id>. listis the default, sokirora listslists your lists.lsandrmare short forlistanddelete.
kirora lists
kirora lists get 3f1c2a9e-0000-4000-8000-000000000000
kirora sending-domains check 3f1c2a9e-0000-4000-8000-000000000000
kirora campaigns send 01a1c7e2-0000-4000-8000-000000000000The help goes three levels deep. kirora --help lists the resources, kirora lists --help a resource’s actions, and kirora lists create --help an action’s flags, the scope its key needs and a link to its API reference page. A mistyped command gets a suggestion. kirora commands prints every command and its flags as JSON.
Arguments and flags
- Ids in the path are arguments, in order:
kirora templates versions get <template-id> <template-version>. When there are two, each can also be given as a flag:kirora contacts topics set --contact-id <id> --topic-id <id>. - Query parameters and simple body fields are flags, named as in the API reference in kebab case:
externalIdis--external-id. The API’s own spelling (--externalId) works too. A flag’s help says what it takes, such as<email>,<date-time>or<url>. A flag with a fixed set of values lists them, and a number flag refuses anything else. - True or false fields are a pair:
--double-opt-inand--no-double-opt-in. Leave both out and the field isn’t sent. - Fields you can clear have a
--no-form that sendsnull:kirora workspaces update tenant-42 --no-websiteremoves a tenant workspace’s website. An action’s--helplists them. - Lists of text take several values:
--allowed-origins https://example.com https://www.example.com. - Anything nested goes in
-d(--data) as the whole body: inline JSON, a file (@file) or stdin (-). Flags set fields on top of it. An action’s--helplists the fields only-dcan carry, with their shapes, and examples to paste. - A file upload takes the file’s path:
kirora assets upload --file logo.png.
kirora transactional send -d @message.json --idempotency-key order-1001 --send-at 2026-11-02T09:00:00ZTry a command first
--dry-run prints the request a command would send, as { "dryRun": true, "request": … }, and sends nothing. It needs no login, so you can check a command before you have a key:
kirora segments update 3f1c2a9e-0000-4000-8000-000000000000 --tags vip --dry-runDeletes
A delete asks you to confirm at a terminal. In a script, CI or anywhere else without one, add -y (--yes), or the command fails with CONFIRMATION_REQUIRED and nothing is deleted. This covers every delete, contacts delete-many included.
kirora segments delete 3f1c2a9e-0000-4000-8000-000000000000 --yesSends and events
events track, transactional send and campaigns trigger require --idempotency-key. Tie the key to what you are sending, such as an order number, and reuse it if you run the command again. See Idempotency.
Lists
A list returns one page. On a list action, --paginate follows the cursors for you and prints each item as one line of JSON (JSON Lines), ready for jq. A larger --limit means fewer requests. See Pagination.
Flags on every command
| Flag | Effect |
|---|---|
-p, --profile <name> |
Use a saved login other than the active one. |
--workspace <externalId> |
A partner key’s tenant, sent as Kirora-Workspace: --workspace tenant-42. |
-i, --include |
Print the HTTP status and headers before the body. It can’t be combined with --paginate. |
--dry-run |
Print the request instead of sending it. |
Test webhooks locally
kirora webhooks listen receives your workspace’s webhooks on your machine while it runs. Start a tunnel to its port, such as ngrok http 4318, and give it the tunnel’s public URL:
kirora webhooks listen --url https://example.ngrok.app --forward-to localhost:3000/webhooksIt subscribes a webhook to that URL, checks each delivery’s signature and prints it as one line of JSON. With --forward-to, it also posts each delivery to your own handler, signature headers included, and answers with your handler’s status, without following redirects. It prints the webhook’s signing secret on stderr, for your handler to verify the deliveries with while it runs. --events limits it to some event types (every one by default), and --port changes the local port (4318 by default). Press Ctrl+C, or stop reading its output, and the webhook is deleted. If deleting it hangs, a second Ctrl+C stops waiting and prints the command to delete it yourself. A URL that already has a webhook is refused with ALREADY_SUBSCRIBED, naming that webhook.
Output and exit codes
A success prints the response body on stdout as the API sent it: pretty-printed, one line per item with --paginate, or, for messages exports download, the CSV as it arrives, however large. -i prints the status and headers on a failure too.
Every failure goes to stderr as { "error": { "code", "message", … } }, so a pipeline only sees the body of a success. An API error also carries its HTTP status, requestId, retryAfterSeconds and, for a 422, the fields that failed (errors). See Errors for the API’s codes. The CLI’s own failures use the same shape:
| Code | Meaning |
|---|---|
USAGE_ERROR |
The CLI couldn’t read the command, and nothing was sent. The error’s hint says how to fix it. |
NOT_LOGGED_IN |
No key to use: log in, or set KIRORA_API_KEY. |
PROFILE_NOT_FOUND |
No saved login has that name. |
NO_ACTIVE_PROFILE |
The active login isn’t saved any more. The message lists the saved ones. |
KEY_NOT_DELETED |
kirora logout removed the login, but couldn’t remove its key from the keychain. The CLI tries again at the next login or logout. |
CONFIRMATION_REQUIRED |
A delete without a terminal to confirm at, and without --yes. |
CONFIG_INVALID |
The config file can’t be read. |
KEYCHAIN_UNAVAILABLE |
The system keychain couldn’t be read or written, such as a locked keyring on Linux. |
ALREADY_SUBSCRIBED |
webhooks listen was given a URL that already has a webhook. |
WEBHOOK_NOT_DELETED |
webhooks listen couldn’t delete its webhook when it stopped. The message gives the command to delete it. |
INTERRUPTED |
webhooks listen was stopped while it was creating its webhook. |
INVALID_RESPONSE |
The API’s response wasn’t one the CLI could use, such as a download in the wrong format. |
DOWNLOAD_FAILED |
An export’s download broke off part-way. |
CONNECTION_ERROR |
No response from the API. |
TIMEOUT |
The API didn’t answer in time. |
| Exit code | Meaning |
|---|---|
0 |
The command succeeded. |
1 |
The command failed: an API error, a network failure, no key to use, or a delete that wasn’t confirmed. |
2 |
The CLI could not read the command (USAGE_ERROR), and nothing was sent: an unknown command or flag, a missing id, idempotency key or required flag, a value that is not a number, or a body that is not valid JSON. |
kirora doctor prints { ok, checks } and exits 1 if any check failed.
Retries
Retries follow the Node.js library: a 429 is always retried, and other failures only when the call is safe to repeat. The CLI doesn’t automatically retry a create without an idempotency key. After a timeout, check whether it succeeded before running the command again.
Use with an AI agent
The package includes an llms.txt that walks an AI coding agent through installing the CLI, logging in or setting up CI, and running commands safely, and an agent skill (skills/kirora-cli/) with the rules and a page for each resource. kirora --help prints where both are. To set it up, paste this into your agent, such as Claude Code or Cursor:
Set up the Kirora CLI for me: install @kirora/cli, then follow its llms.txt step by step
(`kirora --help` prints where it is). Ask me for the API key, and let me log in myself.The CLI works with any API key, including an agent key, which drafts but never sends: see Agents for what it may do. For an AI assistant that isn’t running commands on your machine, connect the hosted MCP server instead; it takes the same key.