Bookkeeping

Save a bank rule

books_save_bank_rule · Changes data · Markdown

Saves a bank rule, like Xero's: which new bank lines it matches and how they are booked, to one account or split by percent, each part with its own tax.

$0.001 a call

From your agent’s balance. A call that fails costs nothing.

An example

From now on book every Haspa fee to bank fees, and the Telekom bill 70% to phone with 19% VAT and 30% to my drawings.

Your agent callsbooks_save_bank_rule$0.001 a call

The example business is Hansen & Voss, a restaurant-equipment wholesaler in Hamburg with 60 staff. The reply is the one the tool really gives.

With these arguments
{
  "name": "Bank fees",
  "direction": "out",
  "account": "6100",
  "when": [
    {
      "field": "counterparty",
      "op": "contains",
      "value": "Haspa"
    }
  ]
}
What comes back
{
  "rule": {
    "name": "Bank fees",
    "direction": "out",
    "when": [
      {
        "field": "counterparty",
        "op": "contains",
        "value": "Haspa"
      }
    ],
    "match": "all",
    "amount_min": null,
    "amount_max": null,
    "bank_account": null,
    "parts": [
      {
        "account": "6100",
        "tax": null,
        "percent": "100"
      }
    ],
    "description": null,
    "position": 100,
    "times_used": 0,
    "last_used_at": null
  }
}

Use it when

The same kind of line comes every month (bank fees, rent, the phone bill, a card provider's payout) and should book itself.

What it does

A bank rule, like Xero's: which new bank lines it matches and how to book them, so lines that come every month (bank fees, rent, the phone bill) book themselves. when: conditions on the counterparty, description or reference (contains, equals, starts_with, ends_with; any case), all of them or any (match). Narrow it with direction (in, out), amount_min and amount_max (the line's size, no sign) and bank_account. Book to account with an optional tax split off, or split by percent across accounts (70% phone, 30% private), each part with its own tax. Rules are tried by position, lowest first; the first that matches is the line's first suggestion in books_bank_lines, and books_apply_bank_rules books every line a rule matches. Matched by name; only what you pass changes.

What comes back

rule: its name, direction, conditions (when, match), amount range, bank account, parts (account, tax, percent), description, position, how often it was used and when last. Every reply also carries cost_usd and balance_usd.

Inputs

NameTypeWhat it is
nameRequiredstringThe rule's name, e.g. "Bank fees". 1 to 80 characters.
new_namestringUp to 80 characters.
whenarray of objects1 to 10 items.
when[].fieldRequiredstringOne of: counterparty,description,reference.
when[].opstringOne of: contains,equals,starts_with,ends_with. Default: contains.
when[].valueRequiredstringThe words to look for, in any case. 1 to 120 characters.
matchstringOne of: all,any. Default: all.
directionstringOne of: any,in,out.
amount_minnumber or stringUp to 24 characters.
amount_maxnumber or stringUp to 24 characters.
bank_accountstringOnly lines on this bank account (its code); "" for any. Up to 20 characters.
accountstringAn account code from the chart, e.g. "6600". 1 to 20 characters.
taxstringA tax by name (books_get lists them), e.g. "VAT 19%". Up to 60 characters.
trackingobjectTracking options by category, e.g. {"Department": "Service"} (books_list_tracking).
splitarray of objects2 to 10 items.
split[].accountRequiredstringAn account code from the chart, e.g. "6600". 1 to 20 characters.
split[].taxstringA tax by name (books_get lists them), e.g. "VAT 19%". Up to 60 characters.
split[].percentRequirednumberAt most 100.
split[].trackingobjectTracking options by category, e.g. {"Department": "Service"} (books_list_tracking).
descriptionstringThe memo of the entries it books. Default: the line's own text. Up to 300 characters.
positioninteger0 to 10,000.

The call

Over MCP, call books_save_bank_rule on https://api.conecto.chat/mcp/books. Over REST:

Terminal
curl -X POST https://api.conecto.chat/v1/tools/books_save_bank_rule \
  -H "Authorization: Bearer $CONECTO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Bank fees","direction":"out","account":"6100","when":[{"field":"counterparty","op":"contains","value":"Haspa"}]}'

When it refuses

A refused call costs nothing and says what to do next.

CodeWhenWhat to do
no_books409The business keeps no books yet.Set them up with books_setup (base currency, start date).
not_found404No account, tax, entry or file of the books has that code, name or id.Check the codes with books_list_accounts and the taxes with books_get.
archived409The account or tax is archived.Use another one, or un-archive it with books_save_accounts.
invalid_input400A condition, the amounts, the direction or the parts are not valid: no condition, no account or split, the bank account itself as the target, or percentages that do not add up to 100.Fix what the message names.
name_taken409new_name is another rule's name.Pick another name.
limit_reached409The account has 200 bank rules.Delete rules that are no longer used.

Give this to your agent.

Set up Conecto from https://conecto.chat/SKILL.md