CLI
The Bkper CLI covers two roles: data management (books, accounts, transactions, balances from the terminal) and app development (init, dev, build, sync, deploy). Supports table, JSON, and CSV output formats for scripting and piping.
The Bkper CLI is the command-line interface for everything you build on Bkper. It serves two roles:
- Data management — Work with books, accounts, transactions, and balances from the terminal
- App development — Initialize, develop, build, and deploy Bkper apps
Installation
npm i -g bkperbun add -g bkperpnpm add -g bkperyarn global add bkperAuthentication
bkper auth login # authenticate via Google OAuthbkper auth logout # revoke stored credentialsbkper auth token # print the current access tokenbkper auth login authenticates via Google OAuth and stores credentials locally. The same credentials are used by:
- All CLI commands
- The
getOAuthToken()function in scripts - The
bkper app devlocal development server
bkper auth token is useful for direct API calls — pipe the output into a variable:
TOKEN=$(bkper auth token)Developer workflows
App lifecycle
# Create a new app from the templatebkper app init my-app
# Start worker runtime (Miniflare + tunnel + file watching)bkper app dev
# Build worker bundlesbkper app build
# Sync app metadata to Bkperbkper app sync
# Deploy to the Bkper Platformbkper app deploy
# Remove app from the Bkper Platformbkper app undeploy
# Check deployment statusbkper app statusNote: The project template composes the full workflow via
npm run dev(runs Vite +bkper app devconcurrently) andnpm run build(runsvite build+bkper app build). Use the template scripts for the complete development experience.
Secrets management
# Set a secret for productionbkper app secrets put BKPER_API_KEY
# Set a secret for preview environmentbkper app secrets put BKPER_API_KEY --preview
# List secretsbkper app secrets list
# Delete a secretbkper app secrets delete BKPER_API_KEYApp installation
# Install app on a bookbkper app install <appId> -b <bookId>
# Uninstall app from a bookbkper app uninstall <appId> -b <bookId>Auth provider for scripts
The CLI package exports getOAuthToken() for use in Node.js scripts:
import { Bkper } from 'bkper-js';import { getOAuthToken } from 'bkper';
Bkper.setConfig({ oauthTokenProvider: async () => getOAuthToken(),});Data management commands
The CLI provides full data management capabilities:
# Booksbkper book listbkper book get <bookId>bkper book create --name "My Company"
# Accountsbkper account list -b <bookId>bkper account create -b <bookId> --name "Sales" --type INCOMING
# Transactionsbkper transaction list -b <bookId> -q "account:Sales after:2025-01-01"bkper transaction create -b <bookId> --description "Office supplies 123.78"
# Balancesbkper balance list -b <bookId> -q "on:2025-12-31"All data commands use -b, --book <bookId> to specify the book context.
Query semantics (transactions and balances)
Use the same query language across Bkper web app, CLI, and Google Sheets integrations.
on:supports different granularities:on:2025→ full yearon:2025-01→ full monthon:2025-01-31→ specific day
after:is inclusive andbefore:is exclusive.- Full year 2025:
after:2025-01-01 before:2026-01-01
- Full year 2025:
- For point-in-time statements (typically permanent accounts:
ASSET,LIABILITY), preferon:orbefore:. - For activity statements over a period (typically non-permanent accounts:
INCOMING,OUTGOING), preferafter:+before:. - For statement-level analysis, prefer report root groups (for example
group:'Balance Sheet'orgroup:'Profit & Loss') over isolated child groups.
# Transactions in full year 2025bkper transaction list -b <bookId> -q "on:2025"
# Transactions in January 2025bkper transaction list -b <bookId> -q "on:2025-01"
# Balance Sheet snapshot (point-in-time)bkper balance list -b <bookId> -q "group:'Balance Sheet' before:2026-01-01"
# P&L activity over 2025bkper balance list -b <bookId> -q "group:'Profit & Loss' after:2025-01-01 before:2026-01-01"Output formats
The CLI supports multiple output formats for scripting and piping:
# Table (default, human-readable)bkper book list
# JSON (for programmatic use)bkper book list --format json
# CSV (for spreadsheets and data tools)bkper transaction list -b <bookId> --format csvSee CLI Scripting & Piping for scripting patterns.
Full reference
Run bkper --help or bkper <command> --help for built-in documentation on any command.
The complete CLI documentation, including all commands and options, is available on the bkper-cli app page.