Stadiq CLI
The stadiq command wraps the four API endpoints for a terminal, a shell script or a cron job. Readable output by default, JSON when something downstream parses it.
Contents
Set it up
Install
Node 20 or newer. The package has no dependencies.
Terminalnpm install -g stadiqGet and store a key
signupuses the same endpoint as the web form; you only open a browser to click the emailed link.Terminalstadiq signup you@company.be # emails a link that creates the key stadiq login sq_live_… # stores it in ~/.stadiq/config.json (0600)Verify
whoami shows the key prefix and host in use. One real request confirms that the key works.
Terminalstadiq whoami stadiq disruptions --lat 51.2194 --lng 4.4025
Commands
stadiq signup <email>- Email yourself a link that creates an API key.
stadiq login <key>- Store a key in ~/.stadiq/config.json.
stadiq whoami- Show the key prefix and base URL in use.
stadiq locations- The locations on your account, with their ids.
stadiq disruptions- Road works within 2 km, and transit disruptions affecting the point.
stadiq air-quality- Nearest station reading, WHO and EU comparison, LEZ status.
stadiq briefing- Risk level, key facts, best and worst windows in the next 24 hours.
stadiq version- Print the version.
stadiq air-quality --location <id>
stadiq briefing --lat 51.2194 --lng 4.4025 --json | jq '.briefing.risk'Flags
--lat <n> --lng <n>- Any point in Flanders. Required by the location commands unless --location is given.
--location <id>- One of your saved locations, from
stadiq locations. It cannot be combined with lat/lng. --json- Raw JSON instead of the readable summary.
--key <key>- Use this key for one call instead of the stored one.
--base <url>- Another host. Also settable as
STADIQ_BASE_URL. -h, --help- Usage.
A missing or non-numeric --lat fails locally, before a call is spent against your quota.
Where the CLI looks for the key
First match wins: --key, then the STADIQ_API_KEY environment variable, then ~/.stadiq/config.json. Use the environment variable in CI and cron; use the config file on your own machine, where a 0600 file is a better place for a secret than your shell history.
Output, errors and quota
Without --json the CLI prints a short summary and the calls left today, read from the X-RateLimit-Remaining header. With --json it prints the response body and nothing else.
On an API error it writes the status, error code and message to stderr and exits non-zero. In scripts that matters: a 401 and a quiet street both print very little, and only the exit code tells them apart. Response fields are in the API reference.
In a cron job
#!/bin/sh
# Alert when a high-severity transit disruption appears near the shop.
set -e
export STADIQ_API_KEY="sq_live_…"
count=$(stadiq disruptions --lat 51.2194 --lng 4.4025 --json \
| jq '.summary.highSeverityTransit')
[ "$count" -gt 0 ] && echo "transit disruption near the shop: $count"Mind the daily quota when you pick an interval. Responses are cacheable for 60 seconds, and the sources do not change faster than every few minutes. Polling more often than every fifteen minutes mostly fetches the same bytes.