Agent API beta

Manage budgets and categorize transactions with your own agent.

Use a personal access token, a small CLI, or direct HTTP requests to inspect accounts, investments, and budgets, update planned amounts, manage which linked accounts fund your goals, manage goals and budget categories, read transactions, ask for partner context, and write category assignments. You stay in control of access, expiry, and revocation.

An assignment categorises an existing transaction e.g. assigning category Groceries to a transaction.

sloth-agent
npm install --global @slothmoney/agent-cli

sloth-agent auth login
sloth-agent auth status

sloth-agent accounts
sloth-agent investments
sloth-agent budget --scope personal
sloth-agent accounts update --account-ref sloth_account_v1_... \
  --institution-name "Hargreaves Lansdown" \
  --account-name "Stocks & Shares ISA" \
  --ownership individual --balance-amount 12500.75 \
  --account-type investments --goal-savings-source false --apply
sloth-agent accounts remove --account-ref sloth_account_v1_...
sloth-agent accounts remove --account-ref sloth_account_v1_... --apply
sloth-agent goals
sloth-agent goals create --name "Emergency fund" \
  --target-amount 12000 --target-month 2027-06 --type keep --apply
sloth-agent transactions --assignment-scope personal --uncategorized --limit 50
sloth-agent assign --input assignments.json
sloth-agent assign --input assignments.json --apply

Token controlled

New tokens are view-only by default. Turn on Allow changes only when your agent needs to categorise transactions, manage categories and line items, update planned budgets, manage accounts, request explanations, or manage goals.

Read before writing

Pull accounts, investments, budgets, goals, categories, and transactions first. Account, budget, goal, category, line-item, and assignment writes are previews until you add --apply. Assignment and budget previews validate files locally without contacting Sloth Money.

Your data only

Agent access is scoped to the signed-in user. Account reads show personal accounts and enabled shared joint accounts. Partner personal accounts are excluded.

Human context when needed

Agents can create a partner clarification link for a partner-shared or joint transaction. The CLI prints the message and link; it does not send WhatsApp messages.

Quickstart

Connect an agent

Install the public CLI from npm. Review the source on GitHub. Direct HTTP calls use the same API.

  1. 1

    Install the CLI

    Install CLI 0.10.0 or newer with Node.js 22 or newer. The sloth-agent command works from any directory.

  2. 2

    Create a token

    Open Settings, then Developer access. Choose an expiry and copy the token once.

  3. 3

    Save the token

    Use the hidden login prompt to save it in your operating system's secure credential store.

  4. 4

    Read before writing

    Inspect known accounts and categories, then check personal and joint categorisation separately. Copy the exact transaction, category, and line-item IDs into an assignment file.

  5. 5

    Preview locally

    Check the file without contacting Sloth Money or writing anything.

  6. 6

    Apply and check

    --apply applies the file. Inspect every result, then read the transaction again.

npm install --global @slothmoney/agent-cli
sloth-agent auth login
sloth-agent auth status
sloth-agent accounts
sloth-agent goals
sloth-agent goals create --name "Emergency fund" --target-amount 12000 --target-month 2027-06 --type keep
sloth-agent goals create --name "Emergency fund" --target-amount 12000 --target-month 2027-06 --type keep --apply
sloth-agent goals update --goal-id GOAL_ID --type spend
sloth-agent goals update --goal-id GOAL_ID --type spend --apply
sloth-agent goals update --goal-id GOAL_ID --priority 2
sloth-agent goals update --goal-id GOAL_ID --priority 2 --apply
sloth-agent goals mark-spent --goal-id GOAL_ID
sloth-agent goals mark-spent --goal-id GOAL_ID --apply
sloth-agent goals restore --goal-id GOAL_ID
sloth-agent goals restore --goal-id GOAL_ID --apply
sloth-agent goals delete --goal-id GOAL_ID
sloth-agent goals delete --goal-id GOAL_ID --apply

Goal creates require a positive target amount and an explicit Keep or Spend type. Goal results include goalType and nullable spentAt. Keep goals cannot be marked spent. Restore a spent goal before changing its type.

Goal priority is one-based, so 1 is highest. Set priority on its own. Moving one goal shifts the intervening goals automatically. Without --apply, the command only previews the move. Forecast assignments and shared progress refresh when the owner next opens Forecast.

sloth-agent budget --scope personal --period 2026-08
sloth-agent budget update --scope personal --period 2026-08 --input budget.json
sloth-agent budget update --scope personal --period 2026-08 --input budget.json --apply

A budget update file contains 1 to 100 unique allocations. Each one identifies an existing category and line item and sets its whole-number plannedPence.

{
  "allocations": [
    {
      "categoryId": "groceries",
      "lineItemId": "weekly",
      "plannedPence": 45000
    }
  ]
}

Budget previews validate the file locally without loading a token or contacting Sloth Money. Applying starts from the full selected-period budget and patches the listed amounts. Saving X overwrites X and every explicit future plan. A later save from Y overwrites Y and everything after it. Earlier and historical periods stay unchanged.

sloth-agent categories
sloth-agent categories create --name "Holidays" --icon-key plane --type Wants
sloth-agent categories create --name "Holidays" --icon-key plane --type Wants --apply
sloth-agent categories rename --category-id CATEGORY_ID --name "Travel fund" --apply
sloth-agent line-items create --scope personal --category-id CATEGORY_ID --name "Flights" --apply
sloth-agent line-items rename --scope personal --category-id CATEGORY_ID --line-item-id LINE_ITEM_ID --name "Travel" --apply
sloth-agent transactions --assignment-scope personal --uncategorized --limit 50
sloth-agent transactions --assignment-scope joint --uncategorized --limit 50

Copy the exact transactionRef for the transaction and the matching categoryId and lineItemId from these outputs into assignments.json. Choose the most specific suitable line item. If none fits, use that category's Other line item. Historical assignments without a line item are not a recommendation to omit one.

{
  "assignments": [
    {
      "transactionRef": "PASTE_THE_EXACT_TRANSACTION_REF_HERE",
      "assignmentScope": "personal",
      "categoryId": "PASTE_A_CATEGORY_ID_HERE",
      "lineItemId": "PASTE_A_LINE_ITEM_ID_HERE"
    }
  ]
}

These are placeholders. Do not submit the example values.

Preview the file

sloth-agent assign --input assignments.json

Without --apply, the CLI checks that the file is valid and returns the payload it would send. It does not contact Sloth Money, verify the transactionRef or category values, or write anything. A successful preview does not guarantee that applying the assignment will succeed.

Apply the assignment

sloth-agent assign --input assignments.json --apply

Inspect every item in the succeeded and failed arrays.

Check the result

Check the result in the same assignment scope that you changed. Successful assignments update the original transaction. See the category in Sloth Money → Transactions, or re-run the original transaction query without --uncategorized. The transaction should also disappear from the matching uncategorized query. Confirm that an existing assignment in the other scope was not changed. Assignments do not create a separate list.

sloth-agent transactions --assignment-scope personal --limit 50

Other commands

sloth-agent transactions --assignment-scope joint --line-item-id LINE_ITEM_ID
sloth-agent transactions --assignment-scope joint --uncategorized
sloth-agent ask-partner --transaction-ref PASTE_THE_EXACT_TRANSACTION_REF_HERE
sloth-agent auth logout

The transaction reference shown above is also a placeholder. Copy the exact value from sloth-agent transactions output.

For CI or headless systems, set SLOTH_AGENT_TOKEN in your secret manager. It overrides a stored credential. auth logout removes only the local copy; revoke the token in Developer access.

Prefer direct HTTP?

Every CLI command maps to the same versioned API. Send the token as a bearer header when another tool already handles HTTP.

curl "https://budget.slothmoney.app/api/agent/v1/accounts" \
  -H "Authorization: Bearer $SLOTH_AGENT_TOKEN"

API reference

Ten API resources

Every request uses Authorization: Bearer with a Sloth personal access token.

GET · PATCH · DELETE /api/agent/v1/accounts

Returns the existing personal accounts and enabled shared joint accounts visible to the signed-in user. Partner personal accounts are excluded. Each row has an opaque accountRef, saved account and institution labels, accountType, ownership, source, native balance and currency when known, lastBalanceUpdatedAt, and connectionState. isGoalSavingsSource shows whether the account contributes to goal savings.

Account reads are cache-only and do not contact a bank or refresh balances. asOf is the response time, not a balance timestamp. Balances are never converted or combined, and missing values are null. Provider account IDs, account numbers, sort codes, and IBANs are not returned.

/api/agent/v1/accounts/:accountRef accepts strict partial updates. Manual accounts can change institution, name, currency, and ownership. Balance-only accounts can also change balance, Savings/Investments type, and goal-savings membership. Connected accounts support goal-savings membership only.

DELETE archives an owned manual account without deleting its transaction, import, balance, or categorisation records. There is no restore command. Shared, disconnected, or inaccessible accounts return Account not found. The CLI previews PATCH and DELETE locally until you add --apply.

GET · PATCH /api/agent/v1/budgets

Reads one personal or joint budget period. The response includes periodStatus, currency, the effective plan, stored funding when available, categories, line items, and planned pence. Historical reads require their frozen snapshot. The API does not calculate spent or available balances from transactions.

PATCH accepts 1 to 100 existing category and line-item pairs with plannedPence. It builds a complete selected-period budget, then overwrites that period and every explicit future plan. A later update starts a new overwrite boundary. Historical periods cannot be changed.

GET /api/agent/v1/investments

Returns caller-owned linked investment accounts with Coinbase, Trading 212, and other SnapTrade holdings nested beneath each account. Filter with accountRef or sloth-agent investments --account-ref. Manual holdings, activities, and partner-owned accounts are excluded.

Investment reads are cache-only and do not contact SnapTrade. Holding values stay in their provider-native currencies and may not reconcile to a converted account total. Symbols can be missing, and non-zero cash appears as a cash holding.

GET · POST · PATCH · DELETE /api/agent/v1/goals

Lists goals or creates one. Creates require a positive target amount and goalType set to keep or spend. Results include goalType and nullable spentAt. Update and delete requests use /api/agent/v1/goals/:goalId. Goal writes are limited to the signed-in user's goals. Active shared pot target amounts stay app-managed so account balances can be reconciled across goals in priority order. A standalone priority PATCH uses a one-based position and shifts the intervening goals automatically. A Spend goal can be marked spent or restored with isSpent. Keep goals cannot be marked spent, and a spent goal must be restored before its type changes.

GET · POST · PATCH /api/agent/v1/categories

Returns visible categories and budget line-item options for personal and joint scopes. POST creates a custom category. PATCH requests use /api/agent/v1/categories/:categoryId and rename user-created categories; built-in categories are immutable.

A category is the broader parent. A line item is a child within one category. Names such as Other may repeat: Bills → Other and Subscriptions → Other are different choices. Use the map matching the transaction scope, and keep categoryId and lineItemId together.

POST · PATCH /api/agent/v1/line-items

Creates a zero-value line item in a personal or joint budget. Rename requests use /api/agent/v1/line-items/:lineItemId. Both require the parent categoryId and scope. Changes update the current period and explicit future plans; historical snapshots remain unchanged.

GET /api/agent/v1/transactions

Returns booked transactions with an opaque transactionRef. Filter by date range, search text, account, category, line item, or uncategorized state. Use --line-item-id in the CLI or lineItemId over HTTP. When combined with categoryId, both IDs must match the same assignment or split.

Personal and joint category assignments are separate. A personal assignment uses the transaction's top-level categoryId, lineItemId, and categorySplits. A joint-budget assignment uses the corresponding fields under jointBudgetContribution.

A transaction can be uncategorised personally while its joint-budget contribution is already categorised. To assess its categorisation, inspect both locations. Use assignmentScope=joint to select the joint fields on eligible shared personal-account transactions.

The first transaction read each UTC day may refresh linked bank data. The response includes structured refresh status and still returns readable cached transactions if refresh work continues or fails.

GET / PUT /api/agent/v1/joint-budget-settings

Reads or updates the linked setting that includes shared personal-account portions in the joint budget. PUT accepts exactly includeSharedPersonalTransactions and returns 409 when there is no active joint budget. The CLI does not wrap this setting.

POST /api/agent/v1/transaction-explanation-requests

Creates a 72-hour partner clarification link for one booked partner-shared or joint transaction. The response includes a shareable message and link.

POST /api/agent/v1/transaction-assignments

Applies 1 to 100 category assignments. The response may contain mixed successes and failures, so inspect every result.

Assignment shape

Write with transaction refs

Use the transactionRef from the transaction response. It is the stable reference the API needs for assignment writes.

These are placeholders. Replace each example value with the exact transactionRef and category IDs returned for your account.

Joint category and line item

{
  "assignments": [
    {
      "transactionRef": "PASTE_THE_EXACT_TRANSACTION_REF_HERE",
      "assignmentScope": "joint",
      "categoryId": "PASTE_A_CATEGORY_ID_HERE",
      "lineItemId": "PASTE_A_LINE_ITEM_ID_HERE"
    }
  ]
}

Split category

{
  "assignments": [
    {
      "transactionRef": "PASTE_THE_EXACT_TRANSACTION_REF_HERE",
      "assignmentScope": "personal",
      "categorySplits": [
        { "categoryId": "PASTE_FIRST_CATEGORY_ID_HERE", "amountPence": 1500 },
        { "categoryId": "PASTE_SECOND_CATEGORY_ID_HERE", "amountPence": 500 }
      ]
    }
  ]
}

Safety

Keep access tight

The Agent API is built for user-run automation. Treat your token like a password. Never put it in chat, source control, shared logs, or shell history. Revoke it when you are done testing.

Free beta included

Agent API access is included with full Sloth Money access. Join during the free beta and keep it free forever.

Tokens expire

Choose 7, 30, or 90 days when creating a personal access token in Developer access.

Choose less access

View-only tokens can read accounts, investment holdings, transactions, categories, budgets, and goals. Permissions cannot be edited later - revoke and reissue a token if its job changes.

Check freshness

Account reads never trigger bank refreshes. Transaction reads may refresh linked bank data once each UTC day and report the result.

Links expire

Partner clarification links last 72 hours and accept one answer. Agents receive the payload but do not send messages.

Beta surface

Endpoint paths are versioned, but the developer surface may change while agent workflows settle.

Start with Developer access.

Create a token in Sloth Money, connect your agent, and preview goal or assignment changes before applying them.

Open Sloth Money