Skip to content

Repository files navigation

ausdata-cli

The Australian public data API, from your terminal.

A pipe-friendly CLI for ausdata.io — the unified API across 9 Australian public-data sources (ABS, RBA, ATO, APRA, AIHW, ASIC, Open-Meteo / BOM, AEMO, WGEA). JSON to stdout by default; CSV and table formats available.

Install

npm install -g ausdata-cli
# or one-shot
npx ausdata-cli wages --start 2019-Q1

Quick start

# 1. Authenticate (sign up at https://ausdata.io for a key)
ausdata login ak_xxxxxxxxxxxxxxxx

# 2. Inspect your account
ausdata whoami

# 3. Fetch real-wages — nominal wage growth minus inflation, quarterly
ausdata wages --start 2019-Q1 --format csv > real_wages.csv

Commands

ausdata login [api-key]            Save an API key to ~/.ausdata/config.json
ausdata logout                     Remove the saved API key
ausdata whoami                     Show the current key + tier + monthly usage

ausdata health                     GET /v1/health  (no auth)
ausdata search "<query>"           GET /v1/search-datasets
ausdata list <source>              GET /v1/datasets/<source>           — enumerate curated datasets
ausdata describe <source.id>       GET /v1/describe/<source>/<id>      — show schema, valid filters
ausdata wages                      GET /v1/real-wages
ausdata dashboard                  GET /v1/economic-dashboard
ausdata get <source.id>            GET /v1/data/<source>/<id>          — fetch any dataset

Global flags

--api-key <key>          Override AUSDATA_API_KEY env / config file
--base-url <url>         Override default https://ausdata-api.fly.dev
--format json|csv|table  Output format (default: json)
--no-color               Disable ANSI colour
--verbose                Print HTTP details to stderr
--help                   Show command help

Examples

# Real-wages CSV ready for Datawrapper
ausdata wages --start 2019-Q1 --format csv > real_wages.csv

# Economic dashboard, piped to jq
ausdata dashboard | jq '.data.cash_rate_pct'

# Search the catalogue
ausdata search "unemployment" --limit 5 --format table

# Generic dataset with filters
ausdata get abs.LF --filter region=nsw --start 2024-01 --end 2024-12

Configuration

The CLI stores config at ~/.ausdata/config.json:

{
  "api_key": "ak_xxxxxxxxxxxxxxxx",
  "base_url": "https://api.ausdata.io"
}

API-key resolution order

  1. --api-key flag
  2. AUSDATA_API_KEY environment variable
  3. ~/.ausdata/config.json (created by ausdata login)

If none of the above resolve to a key, the CLI exits with an instruction to run ausdata login.

Output formats

  • --format json (default): pretty-printed JSON to stdout
  • --format csv: CSV with header row, derived from the data array
  • --format table: ANSI-formatted table (plain text in non-TTY)

Errors always go to stderr; stdout is safe to pipe to jq, > file.csv, etc.

Exit codes

Code Meaning
0 Success
1 Generic error (HTTP 4xx / 5xx, network)
2 Auth error (no key, 401, 403)
3 Rate limited (HTTP 429)
4 Config error

Versioning

Semantic versioning. The CLI tracks the API at https://api.ausdata.io/v1/ — breaking API changes will bump the CLI major version.

License

MIT. See LICENSE.

Links

About

CLI for the Australian public data API (ausdata.io).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages