Skip to Content
Rates API
API Reference

Rates API CLI

Get current and historical New Zealand mortgage, personal loan, car loan, and credit card rates as JSON from a shell or script.

Support this project

The Rates API CLI calls the public REST API and writes JSON to standard output. It uses Node.js 22 or later and needs no API key.

Run from source

Clone the Rates API repository and run the CLI from its root.

node packages/cli/bin/ratesapi.js mortgage-rates --term-in-months 12

The package is prepared for npm as ratesapi-nz. Once it is published, the same command will be available through npm.

npm exec --package=ratesapi-nz -- ratesapi mortgage-rates --term-in-months 12

Commands

CommandResult
mortgage-ratesFixed and floating mortgage rates
personal-loan-ratesPersonal loan rates
car-loan-ratesVehicle finance rates
credit-card-ratesCredit card rates and fees
healthAPI status and dataset freshness

Use --id institution:anz or --id issuer:amex to select an item from a list response. Add --history to list available dates, --history --date 2025-03-08 for one UTC snapshot, or --history --start-date 2025-03-08 --end-date 2025-03-31 for an inclusive range. Run the CLI with --help to see all options.

Errors go to standard error. Exit status 1 means the request failed, and 2 means the CLI rejected the arguments. If the API throttles a request, the CLI prints the Retry-After value so the calling script can wait before retrying.

Last updated on

On this page