Guidance for AI agents helping a user set up and use sb1, the SpareBank 1
personal banking CLI. If you are an agent and the user pointed you at this
repository, start here.
sb1 is a command-line tool for the
SpareBank 1 personal banking API. It lists
accounts, browses and exports transactions, and makes transfers, authenticated
with BankID over OAuth 2.0. Every command supports --json for machine-readable
output. It is personal and unofficial; usage is governed by the bank's terms
(see TERMS.md).
Prefer the prebuilt binary. It needs no Rust toolchain and does not call the GitHub API (so it is not affected by API rate limits):
curl -fsSL https://raw.githubusercontent.com/magnusrodseth/sparebank1-cli/main/install.sh | bash- Installs to
~/.local/bin(override withSB1_INSTALL_DIR). - Pin a version with
SB1_VERSION=v1.1.0. - If the script reports that the install dir is not on
PATH, add it before continuing, then verify withsb1 --help. - macOS and Linux only. On other platforms, build from source:
cargo install --path ..
sb1 talks to the bank on the user's behalf, so it needs their own API client
and a BankID login. You cannot do these steps for them:
- The user registers a personal client at
developer.sparebank1.no and notes the
client_idandclient_secret. - The redirect URI on that app must be exactly
http://localhost:12345/callback. - Provide the credentials via a git-ignored
.env(cp .env.example .env, then fill inCLIENT_ID/CLIENT_SECRET). - Run
sb1 login— this opens a browser for the interactive BankID flow. After login, the token is saved to the secret store and.envcan be deleted.
Secret storage backend is chosen with SB1_STORE (keychain default, op for
1Password, file for headless automation). See README.md → "Secret storage".
The repo ships skills that teach an agent to drive sb1 safely:
npx skills add magnusrodseth/sparebank1-clisparebank1-shared— runtime contract (auth, storage, output, command map). Read this first.sparebank1-accounts— read accounts, balances, transactions, exports.sparebank1-transfers— money movement, with confirmation safeguards.sparebank1-context— interview the user once, then read a private, git-ignored finance context to reason over their money in later sessions.
- Use
--jsonfor anything you need to parse; tables are for humans. - Money-moving commands (
transfer ...) confirm before executing. Never pass-yto skip confirmation unless the user explicitly told you to in this session. sb1only sees what SpareBank 1 holds. Accounts at other institutions (e.g. DNB funds, Lånekassen) are not reachable even if the bank app aggregates them.- Check
sb1 statusif commands fail with auth errors; the token may needsb1 refreshor a freshsb1 login.