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

getaddress-au-api

v1.5.0

Published

Node.js client for the getAddress() Australian address API: autocomplete, full G-NAF address look-up, nearest addresses, suburb and postcode locations, typeahead, validate, distance, and usage. The same shape as the UK getaddress-api package.

Readme

getaddress-au-api

Node.js client for the getAddress() Australian address API — every address in Australia, from G-NAF. The same shape as the UK getaddress-api package. No dependencies; Node 18+.

npm install getaddress-au-api

Usage

import Client from 'getaddress-au-api';

const api = new Client('your-api-key');

const autocompleteResult = await api.autocomplete('200 george st');

if (autocompleteResult.isSuccess) {
    const success = autocompleteResult.toSuccess();

    for (const suggestion of success.suggestions) {
        const getResult = await api.get(suggestion.id);

        if (getResult.isSuccess) {
            const address = getResult.toSuccess();
            console.log(address.address_label, address.locality_name, address.state, address.postcode);
        }
    }
} else {
    const failed = autocompleteResult.toFailed();
    console.log(failed.status, failed.message);
}

CommonJS works too: const { Client } = require('getaddress-au-api');

Autocomplete is free and rate limited. Each successful get counts one look-up against your plan; a 404 costs nothing. A suggestion's id is the address's G-NAF address_detail_pid — store it and pass it to get later.

Keep your key on your server. Browser code uses a domain token with getaddress-au-autocomplete.

Filter

const result = await api.autocomplete('george st', { filter: { state: 'NSW', postcode: '2000' } });

Nearest

The addresses nearest a point, nearest first, each with its distance in metres. Counts one look-up when it finds an address; nothing within the radius costs nothing.

const nearest = await api.nearest(-33.8612, 151.2107, 3, 0.5);     // radius in km, at most 1
const closest = nearest.toSuccess().suggestions[0];
const metres = closest.distance;
const address = await api.get(closest);                              // one more look-up

Locations

Suburbs, states and postcodes — one place per suburb + state + postcode, each with its centre.

const locations = await api.locations('northb');              // free, rate limited
const suggestion = locations.toSuccess().suggestions[0];      // "NORTHBRIDGE NSW 2063"

const place = await api.getLocation(suggestion);              // one look-up
const { latitude, longitude } = place.toSuccess().coordinates;

const nearest = await api.nearestLocations(-33.8612, 151.2107, 3);   // one look-up
const metres = nearest.toSuccess().suggestions[0].distance;

A location id such as northbridge-wa-6003 is the same in every G-NAF release, so it is safe to store.

Typeahead

Completes a partly typed suburb, postcode, street or state as plain strings. Free and rate limited.

const suburbs = await api.typeahead('bon');     // ["BONDI JUNCTION", "BONDI BEACH", "BONDI", …]

const streets = await api.typeahead('pi', { search: ['street'], filter: { locality: 'SYDNEY' } });   // ["PIER STREET", "PITT STREET"]

Validate

Confirms a one-line address. One look-up only when it finds the address.

const result = await api.validate('3/12 Chapel St, Melbourne VIC 3000');
const { status, address, candidates } = result.toSuccess();   // 'found' | 'ambiguous' | 'not_found'

Distance

Straight-line metres between two addresses or locations (by id, in any mix) or two points. Free and rate limited.

const between = await api.distance('GANSW721316793', 'GAVIC419664638');        // { metres: 716312 }
const places = await api.distance('sydney-nsw-2000', 'melbourne-vic-3000');       // { metres: 713306 }
const points = await api.distanceBetweenPoints([-33.8612, 151.2107], [-33.8605, 151.2073]);

Failures

Errors the API reports and network failures are results, never thrown. status is the HTTP status (0 when no response arrived), message says what went wrong, and a 429 carries retryAfterSeconds.

if (!result.isSuccess && result.toFailed().isRateLimited) {
    const wait = result.toFailed().retryAfterSeconds ?? 60;
}

Usage reports

Pass your admin key as the second argument:

const api = new Client('your-api-key', 'your-admin-key');

const today = await api.usage();
const oneDay = await api.usage(1, 9, 2026);
const range = await api.usageRange(new Date('2026-09-01'), new Date('2026-09-14'));

Options

new Client('your-api-key', 'your-admin-key', {
    baseUrl: 'https://api.getaddress.io', // the API origin
    timeoutMs: 30000,                     // 0 for no timeout
    fetch: customFetch                    // defaults to the global fetch
});

Local development

Point baseUrl at a locally running API over plain HTTP:

const api = new Client('your-dev-api-key', 'your-dev-admin-key', { baseUrl: 'http://localhost:5255' });

Use HTTP, not https://localhost:7166: Node does not accept the ASP.NET development certificate (a self-signed end-entity certificate), even when your machine trusts it. The local API serves HTTP without redirecting in Development. Keys from a local run only work locally.

Development

npm install
npm test

Licence

MIT © getAddress()

The MIT licence covers the code only. Address data is G-NAF Core © Geoscape Australia, licensed under the Open G-NAF Core End User Licence Agreement, which forbids using it to generate or compile addresses for sending mail unless each is verified against another source. See the attribution page for the statement to show with it.