Developers

Automate Banky.cool

Banky.cool speaks a small HTTP contract on your own machine, so AppleScript, PowerShell, iOS Shortcuts and plain curl can all ask it things and, if you allow it, change them. Nothing leaves your computer.

It is off until you turn it on. A fresh install refuses every automation request. You pick a level, Banky.cool gives you a key, and your scripts send that key with each call.

Turn it on

In the app: Tools, then Automation. Pick a level and copy the key. From a terminal, the same thing:

bank automation enable read      # or: stats, full, off
bank automation key --show       # the key your scripts will send

There are four levels plus a custom one, and they are cumulative: read admits everything stats admits, and full admits everything read admits. The custom level inherits nothing and admits exactly what you name:

bank automation allow open spending   # these two, nothing else

Your first call

Banky.cool listens on 127.0.0.1:8787 while the app is running. Every request carries the key in an X-Banky-Key header. The key goes in a header and never in the address, because a query string ends up in your shell history and in logs.

curl -s -H "X-Banky-Key: $BANKY_KEY" \
  "http://127.0.0.1:8787/automation/v1/spending?period=last-month"
{
  "ok": true,
  "v": 1,
  "data": {
    "period": { "from": "2026-07-01", "to": "2026-07-31", "label": "2026-07" },
    "total": { "cents": -412050, "amount": "-4120.50", "currency": "CHF" },
    "categories": [
      { "category": "Groceries",
        "total": { "cents": -116294, "amount": "-1162.94", "currency": "CHF" },
        "share": 0.2822, "transactions": 14 }
    ]
  }
}

Every reply has that shape. On success ok is true and the payload sits under data. On failure ok is false and error.code is a stable string. Branch on the code, never on the message.

Three things worth knowing

Money arrives twice

Every amount carries both the exact integer and a string you can print. cents is the source of truth; amount exists so that no script has to divide by 100 to show a figure.

{ "cents": 123450, "amount": "1234.50", "currency": "CHF" }

Periods take words, not just dates

Anything taking a period accepts 2026-07, 2026, or one of this-month, last-month, this-year, last-year and ytd. You can also pass from and to as plain dates. Every reply echoes the range it actually used, so a log shows what was asked for.

summary, spending and budget aggregate a whole month or a whole year. They refuse a range covering part of a month rather than returning a figure that disagrees with what the app shows. search takes any range.

Ids are strings

Transaction and receipt ids come back as JSON strings. They are 64 bit numbers, and anything JavaScript based, which includes Shortcuts, would round the large ones.

Reference

Every action, grouped by the level that admits it.

Read statistics only

Totals per month and per category. No individual transactions and no account numbers ever cross the wire at this level.

ActionRequestWhat you get
statusGET /statusVersion, data range and which verbs the current tier admits. Carries no amounts.
summaryGET /summaryIncome, expense and net for a period. Transfers between your own accounts are excluded.
spendingGET /spendingTotal spending for a period, with a per-category breakdown.
budgetGET /budgetIncome, expense, net and every category line for a period.

Read everything

Everything above, plus individual transactions, accounts, receipts and bulk export.

ActionRequestWhat you get
accountsGET /accountsThe accounts Banky knows about, with masked IBANs.
balancesGET /balancesLatest balance per account, with the date it is as of.
searchGET /searchFull-text transaction search, paged.
transactionGET /transactions/{id}One transaction in full, including its source document.
receiptsGET /receiptsPurchase receipts, newest first.
receiptGET /receipts/{id}One receipt with its line items.
rules.readGET /rulesThe categorization rules currently in force.
exportGET /exportBulk export as CSV or JSON.

Everything

Everything above, plus importing files, running the categorizer, editing rules and opening views.

ActionRequestWhat you get
importPOST /importImport a statement or receipt file.
categorizePOST /categorizeSet one transaction's category, or run the categorizer over a scope.
rules.writePOST /rulesAdd a categorization rule.
rules.removeDELETE /rules/{id}Remove a categorization rule.
openPOST /openOpen a browser tab on a month, an account or a transaction.
quitPOST /quitStop the app. Available only when the desktop app started the server. (desktop app only)

AppleScript, on a Mac

Banky has an AppleScript dictionary, so the app answers directly. Open it in Script Editor with File, then Open Dictionary:

-- No install needed for this one: it is the app's own dictionary.
tell application "Banky"
  set spent to get spending for "last-month"
  set worst to get biggest expense for "last-month"
end tell
display dialog "Last month: " & spent & ", mostly " & worst

Amounts arrive as text Banky has already divided, so nothing in your script multiplies or rounds money. The application also has properties, and the other commands read the same way:

tell application "Banky"
  get automation level      --> "read"
  get server address        --> "http://127.0.0.1:8787/"
  find transactions "MIGROS"  --> JSON text
  show view "budget" for "last-month"
end tell

The dictionary is not a way around the levels. Every command goes through the same contract: at the statistics level find transactions is refused, at anything below full show view is refused, and with automation off every one of them says so.

The script library

For scripts that run without Banky in front of you, or that want handlers rather than an application to talk to, one command installs a library and puts your key in the Keychain:

bank automation install
# -> ~/Library/Script Libraries/Banky.scptd, key stored in your Keychain
use Banky : script "Banky"
use scripting additions

set s to Banky's summary("last-month")
display dialog "Last month you spent " & (expense of s) & " " & (currency of s)

Amounts arrive as text Banky has already divided, so nothing in your script multiplies or rounds money. topCategory is there for the most common question, and request plus valueOf reach anything the library does not wrap:

use Banky : script "Banky"
use scripting additions

set c to Banky's topCategory("last-month")
say "Your biggest expense was " & (category of c)

-- Anything the library does not wrap is one call away.
set json to Banky's request("/search?q=MIGROS&limit=5")
return Banky's valueOf(json, "data.total")

A folder action that imports whatever your bank just dropped in Downloads:

-- Save as a Folder Action on ~/Downloads: every statement your bank
-- drops in there is imported the moment it lands.
use Banky : script "Banky"
use scripting additions

on adding folder items to thisFolder after receiving droppedItems
  repeat with anItem in droppedItems
    try
      Banky's importFile(POSIX path of anItem)
    on error m
      display notification m with title "Banky import failed"
    end try
  end repeat
end adding folder items to

Importing needs the full level, or a custom level with import ticked. A refused call raises a normal AppleScript error carrying Banky's own code, so try ... on error works, and a closed app says so rather than failing with a curl exit code.

PowerShell, on Windows

The same command installs a PowerShell module and stores the key encrypted for your Windows account:

bank automation install
# -> Documents\PowerShell\Modules\Banky, key encrypted for your account

Every cmdlet returns objects, never text, so Where-Object, Sort-Object and Export-Csv work with no parsing at all. Get-Command -Module Banky lists them.

Import-Module Banky

# Last month, biggest categories first.
(Get-BankySpending -Period last-month).categories |
  Sort-Object { $_.total.cents } |
  Select-Object @{n="Category"; e={$_.category}},
                @{n="Amount";   e={$_.total.amount}},
                @{n="Share";    e={"{0:P0}" -f $_.share}} |
  Format-Table
# Everything over 500 francs this year, into a spreadsheet.
Find-BankyTransaction -Period this-year -Limit 500 |
  Where-Object { [int]$_.amount.cents -lt -50000 } |
  Export-Csv "$HOME\Desktop\big-2026.csv" -NoTypeInformation

# Or let Banky write the file itself, exactly as the app exports it.
Export-BankyTransaction -Path "$HOME\Desktop\banky-2026.csv" -Year 2026

# Import whatever your bank just downloaded.
Get-ChildItem "$HOME\Downloads\*.camt.xml" | Import-BankyStatement

The PowerShell module is new. It is built from the same contract the AppleScript library uses, and its cmdlets are checked against that contract on every build, but it has not yet been exercised on a Windows machine. If something misbehaves, please say so, and the raw HTTP below always works.

Anything else

The contract is plain HTTP, so any language reaches it. This is the same call the examples above make:

curl -s -H "X-Banky-Key: $BANKY_KEY" \
  "http://127.0.0.1:8787/automation/v1/spending?period=last-month"

Shortcuts, on iPhone and Mac

Build it around Get Contents of URL:

  1. URL: http://127.0.0.1:8787/automation/v1/summary?period=this-month
  2. Method: GET
  3. Headers: X-Banky-Key, set to your key
  4. Get Dictionary Value for data.expense.amount
  5. Show Result

The relative periods such as this-month exist for exactly this: building a date string inside Shortcuts is painful out of proportion to the task.

About bank notifications. A shortcut cannot run because your banking app showed a push notification. No iOS app can read another app's notifications, and Shortcuts has no notification trigger. What does work is a personal automation on a time of day, or on opening your banking app, which then calls Banky.cool.

When something is refused

CodeStatusMeaning
automation_disabled403Automation is off. Turn it on under Tools, then Automation.
bad_key401The X-Banky-Key header is missing or wrong.
verb_not_allowed403The action exists, but your level does not admit it.
forbidden_origin403The request looked like it came from a web page.
bad_request400A parameter is wrong. The message names it.
not_found404No transaction, receipt or rule with that id.
unknown_verb404No such action at that address.
internal500Something failed inside the app; the detail is in its log.

What the levels do, and what they do not

Requests carrying a browser Origin are always refused, so a web page you happen to visit cannot reach this contract even though it listens on your own machine.

On a desktop, the levels control what Banky.cool's scripting interface hands out. They are not a lock, and it would be dishonest to present them as one: any program running under your own account can already read the database file directly. What they do stop is a careless script, another application, and any web page. On an iPhone they are a real boundary, because shortcuts run inside the app and there is no way around them.

Turning automation off revokes the key, so anything still holding it stops working immediately.

Data protection ยท Imprint