npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-zaim

v0.2.2

Published

Node.js client library for Zaim API

Readme

node-zaim

NPM Version Built with Bun CI License

Node.js client library for Zaim API

Installation

npm i node-zaim

Usage

Initialization

If you already have an access token, you can initialize the client directly:

import { Zaim } from 'node-zaim';

const zaim = new Zaim({
	consumerKey: 'your-consumer-key',
	consumerSecret: 'your-consumer-secret',
	accessToken: 'your-access-token',
	accessTokenSecret: 'your-access-token-secret',
});

OAuth Authorization Flow

If you need to obtain an access token via OAuth, use the following flow:

import Zaim from 'node-zaim';

const zaim = new Zaim({
	consumerKey: 'your-consumer-key',
	consumerSecret: 'your-consumer-secret',
});

// 1. Get a request token
const { token, tokenSecret } = await zaim.getRequestToken();

// 2. Redirect the user to the authorization URL
const authorizeUrl = zaim.getAuthorizeUrl(token);
console.log('Redirect user to:', authorizeUrl);

// 3. After the user authorizes, exchange for an access token
//    using the oauth_verifier from the callback
const { accessToken, accessTokenSecret } = await zaim.getAccessToken(
	token,
	tokenSecret,
	'oauth-verifier-from-callback'
);

// 4. Store the access token for future use
console.log('Access Token:', accessToken);
console.log('Access Token Secret:', accessTokenSecret);

You can also set the access token later on an existing instance:

zaim.setAccessToken(accessToken, accessTokenSecret);

User

verify()

Representation of the requesting user if authentication was successful.

const user = await zaim.user.verify();
console.log(user.name); // 'MyName'
console.log(user.inputCount); // 100
console.log(user.currencyCode); // 'JPY'

Money

list()

Showing the list of input data

// Get all records
const allMoney = await zaim.money.list();
console.log(allMoney[0].amount); // 10000
console.log(allMoney[0].mode); // 'income'

// Filter by date range and type
const payments = await zaim.money.list({
	mode: 'payment',
	startDate: '2024-01-01',
	endDate: '2024-12-31',
	limit: 50,
});

Payment

create()

Input payment data

const payment = await zaim.payment.create({
	categoryId: 101,
	genreId: 10101,
	amount: 1,
	date: '2026-02-04',
	comment: 'test',
	name: 'test',
	place: 'test',
});
console.log(payment);

update()

Update payment data

const payment = await zaim.payment.update({
	amount: 1,
	date: '2026-02-04',
	genreId: 10101,
	categoryId: 101,
	placeUid: 'zm-12345',
	comment: 'test',
});
console.log(payment);

delete()

Delete payment data

const payment = await zaim.payment.delete(11820767);
console.log(payment);

Income

create()

Input income data

const income = await zaim.income.create({
	categoryId: 101,
	amount: 1,
	date: '2026-02-04',
	place: 'test',
	comment: 'test',
});
console.log(income);

update()

Update income data

const income = await zaim.income.update({
	categoryId: 101,
	amount: 1,
	date: '2026-02-04',
	placeUid: 'zm-12345',
	comment: 'test',
});
console.log(income);

delete()

Delete income data

const income = await zaim.income.delete(11820767);
console.log(income);

Transfer

create()

Input transfer data

const transfer = await zaim.transfer.create({
	amount: 1,
	date: '2026-02-04',
	fromAccountId: 1,
	toAccountId: 1,
	comment: 'test',
});
console.log(transfer);

update()

Update transfer data

const transfer = await zaim.transfer.update({
	amount: 1,
	date: '2026-02-04',
	comment: 'test',
});
console.log(transfer);

delete()

Delete transfer data

const transfer = await zaim.transfer.delete(11820767);
console.log(transfer);

Category

list()

Showing the list of your categories

const categories = await zaim.category.list();
console.log(categories[0].name); // 'Food'

default()

Get default category list

const categories = await zaim.category.default('en');
console.log(categories[0].name); // 'Food'

Genre

list()

Showing the list of your genres

const genres = await zaim.genre.list();
console.log(genres[0].name); // 'Geocery'

default()

Get default genre list

const genres = await zaim.genre.default('en');
console.log(genres[0].name); // 'Geocery'

Account

list()

Showing the list of your accounts

const accounts = await zaim.account.list();
console.log(accounts[0].name); // 'Credit card'

default()

Get default account list

const accounts = await zaim.account.default('en');
console.log(accounts[0].name); // 'Wallet'

Currency

list()

const currencies = await zaim.currency.list();
console.log(currencies[0].currencyCode); // 'AUD'
console.log(currencies[0].name); // 'Australian dollar'

API Reference

| Endpoint | Method | Description | | ---------------------------------- | ------ | ---------------------------------------------------------------------- | | zaim.user.verify() | GET | Representation of the requesting user if authentication was successful | | zaim.money.list(params?) | GET | Showing the list of input data | | zaim.payment.create(params) | POST | Input payment data | | zaim.payment.update(id, params) | PUT | Update payment data | | zaim.payment.delete(id) | DELETE | Delete payment data | | zaim.income.create(params) | POST | Input income data | | zaim.income.update(id, params) | PUT | Update income data | | zaim.income.delete(id) | DELETE | Delete income data | | zaim.transfer.create(params) | POST | Input transfer data | | zaim.transfer.update(id, params) | PUT | Update transfer data | | zaim.transfer.delete(id) | DELETE | Delete transfer data | | zaim.category.list() | GET | Showing the list of your categories | | zaim.genre.list() | GET | Showing the list of your genres | | zaim.account.list() | GET | Showing the list of your accounts | | zaim.account.default(lang?) | GET | List default accounts | | zaim.category.default(lang?) | GET | List default categories | | zaim.genre.default(lang?) | GET | List default genres | | zaim.currency.list() | GET | List available currencies |

For full details on each endpoint, refer to the Zaim API documentation.

Contributing

Please see CONTRIBUTING.md for contribution guidelines.

License

MIT