Advisory and Deliverables
Kick CLI scripts for client analysis: summarize expenses by category for a quarter and export monthly cash flow statement data.
Use these scripts to pull numbers you'll analyze or share with a client. Both only read from Kick.
Top expense categories for a quarter (read)
To see where spend concentrated last quarter, pull transactions and group negative amounts by category. The script reads every page of transactions with find_all_transactions, 100 rows per request.
The Script
#!/bin/bash
# top-expense-categories.sh
set -euo pipefail
WORKSPACE_ID="<workspace-id>"
SINCE="2026-01-01"
UNTIL="2026-03-31"
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"
}
echo "Top expense categories: $SINCE to $UNTIL"
echo ""
find_all_transactions \
--since "$SINCE" \
--until "$UNTIL" \
--fields amount,category | \
jq -r '
[.[] | select(.amount < 0)] |
group_by(.category) |
map({
category: (.[0].category // "Uncategorized"),
total: (map(.amount) | add),
count: length
}) |
sort_by(.total) |
.[] |
"\(.category): $\(.total | fabs) (\(.count) transactions)"
'How to Customize
Narrow
SINCEandUNTILper clientGroup by counterparty instead: add
counterpartyto--fieldsand usegroup_by(.counterparty)Add a percentage of total with an extra
jqpass
transactions find has no entity filter. To total one entity only, replace the find_all_transactions call with kick tools run transactions_find, which accepts entity ids in filters.entityIds (read). It returns up to 100 rows per call under rows; while hasMore is true, run it again with "cursor" set to the returned nextCursor:
kick --workspace "$WORKSPACE_ID" tools run transactions_find \
--input-json '{"since": "2026-01-01", "until": "2026-03-31", "limit": 100, "fields": ["amount", "category"], "filters": {"entityIds": [123]}}' \
--output json | jq '.rows'What It Outputs
Cloud Infrastructure: $12500.00 (36 transactions)
Payroll: $75000.00 (3 transactions)Cash flow statement by month (read)
To analyze operating, investing, and financing totals by month, use the cash flow statement report instead of rolling up raw transactions.
The Script
#!/bin/bash
# cash-flow-by-month.sh
WORKSPACE_ID="<workspace-id>"
ENTITY_ID=123
START_DATE="2026-01-01"
END_DATE="2026-03-31"
ledger_id=$(kick --workspace "$WORKSPACE_ID" accounting ledgers get --entity-id "$ENTITY_ID" --output json | jq -r '.ledgers[] | select(.basis == "cash") | .id')
kick --workspace "$WORKSPACE_ID" reports cash-flow-statement \
--entity "$ENTITY_ID" \
--ledger-id "$ledger_id" \
--start-date "$START_DATE" \
--end-date "$END_DATE" \
--cycle month \
--output json | jq .How to Customize
Add
--comparison previous-yearfor year-over-year context, or--comparison previous-periodfor the prior periodFor an accrual-basis statement, pass the entity's Accrual ledger id instead.
kick workspaces context <workspace-id> --output json | jq '.ledgers'lists every ledger with itsbasisExport vendor-level detail with
kick reports expenses-by-vendor, which takes the same--entity,--ledger-id,--start-date, and--end-dateflags. It returns 100 vendor rows per call by default; pass--limit(up to 500) and--cursorwith the returnednextCursorfor more
What It Outputs
JSON cash flow statement with monthly columns for the entity and period
Last updated
Was this helpful?
