Skip to content

Quick Wins

Start building with Bkper in minutes using three approaches of increasing complexity: a one-line CLI pipe, a 20-line Node.js script, and a direct REST API call with curl.

You’ve set up your environment. Here are three ways to start building immediately — from a 1-line shell command to a 20-line script.

CLI piping

Copy all accounts from one book to another in a single line:

Terminal window
bkper account list -b $SOURCE_BOOK --format json | bkper account create -b $DEST_BOOK

The CLI outputs JSON that feeds directly into the next command. No code, no setup beyond the CLI itself.

Add a property to every matching transaction:

Terminal window
bkper transaction list -b $BOOK -q "account:Expenses" --format json | \
bkper transaction update -b $BOOK -p "reviewed=true"

See CLI Scripting & Piping for more patterns.

Node.js script

A short script that lists all accounts with their current balances:

import { Bkper } from 'bkper-js';
import { getOAuthToken } from 'bkper';
Bkper.setConfig({
oauthTokenProvider: async () => getOAuthToken(),
});
const bkper = new Bkper();
const book = await bkper.getBook('your-book-id');
const report = await book.getBalancesReport('');
const containers = report.getBalancesContainers();
for (const container of containers) {
console.log(`${container.getName()}: ${container.getCumulativeBalance()}`);
}

Run it:

Terminal window
npm install bkper-js bkper
node script.mjs

See Node.js Scripts for more examples.

Direct API call

Call the REST API from any language. Here’s a curl example:

Terminal window
# Get your OAuth token (after running bkper auth login)
TOKEN=$(bkper auth token)
# List your books
curl -s -H "Authorization: Bearer $TOKEN" \
https://api.bkper.app/v5/books | jq '.items[].name'

See Direct API Usage for the full guide.

What next?

These quick wins are just the beginning. Depending on what you want to build: