Use your own agent to read and categorise transactions through the Sloth Money Agent API.
The CLI requires Node.js 22 or newer.
npm install --global @slothmoney/agent-cli
sloth-agent --versionFor a one-off pinned run:
npm exec --yes --package=@slothmoney/agent-cli@0.2.0 -- sloth-agent --helpCreate a personal access token in Sloth Money under Settings > Developer access, then save it in your operating system's secure credential store:
sloth-agent auth loginThe prompt hides the token. The CLI validates it before replacing any credential already stored for the selected API origin.
For a non-interactive import, pass the token through stdin or import it from the environment:
printf '%s' "$SLOTH_AGENT_TOKEN" | sloth-agent auth login --token-stdin
sloth-agent auth login --from-envNever put a token in a command argument. For CI and headless systems, keep using an environment secret:
export SLOTH_AGENT_TOKEN="sloth_pat_v1_..."SLOTH_AGENT_TOKEN always overrides a stored credential.
To migrate from an existing environment-only setup:
sloth-agent auth login --from-env
unset SLOTH_AGENT_TOKEN
sloth-agent auth status
sloth-agent categoriesCheck the active credential with a live API request:
sloth-agent auth statusThis updates the PAT's lastUsedAt value. To remove the local credential:
sloth-agent auth logoutLogout does not unset SLOTH_AGENT_TOKEN or revoke the PAT. Revoke a PAT
remotely in Sloth Money Settings > Developer access.
Read categories and available budget line items:
sloth-agent categoriesRead uncategorised transactions:
sloth-agent transactions --uncategorized --limit 50Search a date range:
sloth-agent transactions \
--q "tesco" \
--start-date 2026-05-01 \
--end-date 2026-05-31Preview an assignment file without writing:
sloth-agent assign --input assignments.jsonApply the same file:
sloth-agent assign --input assignments.json --applyCreate a partner clarification link:
sloth-agent ask-partner --transaction-ref sloth_txn_...Assignment files use the Agent API request shape:
{
"assignments": [
{
"transactionRef": "sloth_txn_...",
"categoryId": "groceries",
"lineItemId": "weekly"
}
]
}The CLI defaults to https://budget.slothmoney.app. For local development,
set SLOTH_AGENT_API_BASE_URL=http://localhost:4000 or pass
--base-url http://localhost:4000. Non-local HTTP origins are rejected so a
token cannot be sent over an unencrypted connection.
Stored credentials are separated by normalized API origin. One credential is stored per origin; log out and log in again to switch accounts on the same origin.
Command results are JSON on stdout. Diagnostics are written to stderr.
| Exit code | Meaning |
|---|---|
0 |
Success |
1 |
API, network, credential-store, response-validation, or partial assignment failure |
2 |
Invalid command, option, URL, date, auth input, or assignment input |
3 |
No credential or native secure storage is unavailable |
Assignment writes are best-effort. A response containing any failed assignment
returns exit code 1 while preserving the complete API response on stdout.
npm ci
npm run verifynpm run test:package packs the exact npm artifact, installs it into a clean
temporary project, and runs the installed binary.