> For the complete documentation index, see [llms.txt](https://docs.kick.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kick.co/ai/cli/cli-reference.md).

# Reference

Technical reference for Kick CLI credentials, workspace selection, command discovery, output modes, JSON parsing, scheduling, and exit codes.

Use this page when you need exact CLI behavior for credentials, workspace selection, output formats, exit codes, or finding current commands.

### Find all commands

The CLI's built-in help is the source of truth for the current command list and flags.

Start at the root:

```bash
kick --help
```

Then inspect a command group:

```bash
kick transactions --help
kick reports --help
```

For command-specific flags, run `--help` on the command:

```bash
kick reports profit-loss --help
kick transactions find --help
```

This avoids stale docs when commands or flags change.

### Credential lookup order

The CLI resolves credentials in this order:

1. `--token <value>`
2. `KICK_PAT`
3. `KICK_API_TOKEN`
4. OS keychain from `kick login`
5. `~/.config/kick/credentials`

`KICK_API_TOKEN` is the older environment variable name. Prefer `KICK_PAT`.

### Workspace selection

List workspaces:

```bash
kick workspaces list
```

Run a command in a workspace:

```bash
kick --workspace <workspace-id> transactions find --limit 10
```

If you work across multiple clients, pass `--workspace` explicitly. This is safer than relying on a remembered default.

### Common command examples

These examples are not a complete command list. Use `kick --help` and command-specific `--help` output for the current list.

Authentication and context. `kick login` stores a token and `kick logout` removes it (write); `kick whoami` and `kick auth status` only read:

```bash
kick login
kick whoami
kick auth status
kick logout
```

Workspace lookup (read):

```bash
kick workspaces list
kick workspaces get <id>
```

Transaction lookup (read):

```bash
kick --workspace <workspace-id> transactions find --limit 10
kick --workspace <workspace-id> transactions get <id>
```

Reports (read). Each report needs `--entity`, `--ledger-id`, `--start-date`, and `--end-date`:

```bash
kick --workspace <workspace-id> reports profit-loss --entity 123 --ledger-id <ledger-uuid> --start-date 2026-01-01 --end-date 2026-01-31
kick --workspace <workspace-id> reports balance-sheet --entity 123 --ledger-id <ledger-uuid> --start-date 2026-01-01 --end-date 2026-01-31
kick --workspace <workspace-id> reports trial-balance --entity 123 --ledger-id <ledger-uuid> --start-date 2026-01-01 --end-date 2026-01-31
```

A report uses the basis of the ledger you pass: a Cash ledger id gives a cash-basis report, and an Accrual ledger id gives an accrual-basis report. To get an entity's Cash ledger id (read):

```bash
kick --workspace <workspace-id> accounting ledgers get --entity-id 123 --output json | jq -r '.ledgers[] | select(.basis == "cash") | .id'
```

To list every ledger in a workspace, Cash and Accrual, with its `entityId` and `basis` (read):

```bash
kick workspaces context <workspace-id> --output json | jq '.ledgers[] | {entityId, entityName, basis, id}'
```

Activity (read):

```bash
kick --workspace <workspace-id> activity list
kick --workspace <workspace-id> activity logs
```

### Output modes

* `--output auto` - table in a terminal, structured output when piped.
* `--output table` - human-readable table.
* `--output json` - formatted JSON.
* `--output json-compact` - compact JSON for scripts and agent contexts.
* `--output yaml` - YAML.

Data goes to stdout. Diagnostics, progress messages, and errors go to stderr.

For examples, see [Kick CLI use case library](https://docs.kick.co/ai/cli/cli-use-case-library.md).

### Page through results

`kick transactions find` returns 25 rows by default and at most 100 per call. When more rows match, it writes a next-page hint to stderr, for example `More results available (240 total). Next page: kick transactions find --cursor 2`. The cursor is a page number that starts at 1. A script that counts, totals, or exports transactions must read every page, or its results cover only the first page.

To collect every matching transaction as one JSON array (read), add this function to your script after setting `WORKSPACE_ID`. It requests 100 rows at a time and stops after a page with fewer than 100 rows:

```bash
WORKSPACE_ID="<workspace-id>"

find_all_transactions() {
  local page=1 rows all="[]"
  while true; do
    rows=$(kick --workspace "$WORKSPACE_ID" transactions find "$@" \
      --limit 100 --cursor "$page" --output json) || return 1
    all=$(printf '%s\n%s\n' "$all" "$rows" | jq -s 'add')
    if [ "$(printf '%s' "$rows" | jq 'length')" -lt 100 ]; then
      break
    fi
    page=$((page + 1))
  done
  printf '%s\n' "$all"
}

find_all_transactions --since 2026-01-01 --until 2026-01-31 --fields id,date,amount,counterparty,category > transactions.json
```

Pass any `transactions find` flags; the function sets `--limit`, `--cursor`, and `--output` itself. It ignores the next-page hint that `transactions find` still prints to stderr for each full page.

`kick workspaces list` and `kick activity list` also return 25 rows by default and print a next-page hint to stderr. Rerun the command with the same flags plus the `--cursor` value from the hint.

### Parse JSON output

Most lookup commands accept `--output json` or `--output json-compact` for parsing with `jq`. With `--output json`, `transactions find` returns only the fields you list in `--fields`. Without `--fields`, it returns `date`, `amount`, `counterparty`, `description`, `bank_description`, and `id`.

These examples use `find_all_transactions` from [Page through results](#page-through-results), so they cover every matching transaction:

**Get transaction count by category** (read):

```bash
find_all_transactions --since 2026-01-01 --until 2026-01-31 --fields id,category | \
  jq 'group_by(.category) | map({category: .[0].category, count: length})'
```

**Find largest transactions** (read):

```bash
find_all_transactions --since 2026-01-01 --until 2026-01-31 --fields id,date,amount,counterparty | \
  jq 'sort_by(.amount) | reverse | .[0:10]'
```

**Calculate average amount by counterparty** (read):

```bash
find_all_transactions --since 2026-01-01 --until 2026-01-31 --fields amount,counterparty | \
  jq 'group_by(.counterparty) | map({counterparty: .[0].counterparty, avg: (map(.amount) | add / length)})'
```

Diagnostics and errors go to stderr, so you can pipe stdout safely:

```bash
kick --workspace <workspace-id> transactions find --limit 10 --output json | jq '.[0].id'
```

### Schedule scripts

Run read-only lookup scripts with cron (Linux/Mac):

```bash
# Edit crontab
crontab -e

# Daily at 9am: Uncategorized transaction alert
0 9 * * * /path/to/daily-uncategorized-alert.sh

# First day of month: Generate monthly P&L JSON
0 8 1 * * /path/to/monthly-pl-reports.sh

# Every Monday: Export to warehouse
0 10 * * 1 /path/to/export-to-warehouse.sh
```

For Windows, use Task Scheduler.

Review write commands manually before scheduling them. Commands that change data require preview confirmation and should not run unattended unless your firm has approved that workflow.

### Exit codes

* `0` - success
* `1` - generic failure
* `2` - usage error
* `3` - network error
* `4` - authentication or authorization error
* `5` - not found
* `6` - rate limited
* `130` - interrupted

### Confirm write commands

Write commands are preview-first. The first run changes nothing and prints a preview with a confirmation token:

```json
{
  "preview": {
    "action": "transactions_update",
    "summary": "Update transaction 12345.",
    "confirmationToken": "v1...."
  }
}
```

Review the preview, then run the same command again with `--confirmation-token` to apply the change (write):

```bash
kick transactions update --transaction-id 12345 --payload-file transaction.json --confirmation-token <token>
```

* The token expires 45 minutes after the preview.
* The token only confirms the exact input it was issued for. If you change the payload, an id, or any other value, the CLI rejects the token. Run the preview again to get a new one.
* Most write commands have no flag that skips the preview. The exceptions are `kick activity revert` and `kick organization-clients create`: they take `--confirm <token>` instead of `--confirmation-token`, and `--yes` confirms the preview in the same run.

Do not automate confirmation unless the workflow has been reviewed and approved by your firm.

### Safety reminders

* Use read-only commands for lookup and reporting.
* Use write commands only when the workflow needs them.
* Keep PATs out of source control and shared docs.
* Confirm workspace and entity IDs before running commands on client data.
* Treat generated output as a draft until an accountant reviews it.

For more detail, see [Permissions and Security](https://docs.kick.co/ai/permissions-and-security.md) and [CLI Troubleshooting](https://docs.kick.co/ai/troubleshooting/cli-troubleshooting.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.kick.co/ai/cli/cli-reference.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
