Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

node-zaim

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-zaim

Node.js client library for Zaim API

latest
Source
npmnpm
Version
0.2.2
Version published
Maintainers
1
Created
Source

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

EndpointMethodDescription
zaim.user.verify()GETRepresentation of the requesting user if authentication was successful
zaim.money.list(params?)GETShowing the list of input data
zaim.payment.create(params)POSTInput payment data
zaim.payment.update(id, params)PUTUpdate payment data
zaim.payment.delete(id)DELETEDelete payment data
zaim.income.create(params)POSTInput income data
zaim.income.update(id, params)PUTUpdate income data
zaim.income.delete(id)DELETEDelete income data
zaim.transfer.create(params)POSTInput transfer data
zaim.transfer.update(id, params)PUTUpdate transfer data
zaim.transfer.delete(id)DELETEDelete transfer data
zaim.category.list()GETShowing the list of your categories
zaim.genre.list()GETShowing the list of your genres
zaim.account.list()GETShowing the list of your accounts
zaim.account.default(lang?)GETList default accounts
zaim.category.default(lang?)GETList default categories
zaim.genre.default(lang?)GETList default genres
zaim.currency.list()GETList available currencies

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

Contributing

Please see CONTRIBUTING.md for contribution guidelines.

License

MIT

FAQs

Package last updated on 20 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts