Query Belgian Flemish public transport (De Lijn) via the delijn CLI. Use when the user wants real-time bus/tram departures, stop lookups, line searches, or watch mode for live updates. Triggered by mentions of De Lijn, Flanders buses, trams, Belgian public transport, or stop schedules.
CLI for De Lijn - Flemish public transport (buses and trams).
# Verify auth
delijn auth status
# Get departures by stop number
delijn departures 200552
# Search stops
delijn stops search "Gent Sint-Pieters"
Requires De Lijn API key from data.delijn.be (free registration).
# Store API key in system keyring
delijn auth set-key
# Verify setup
delijn auth status
If not authenticated, user must run interactively. Do not attempt auth setup on behalf of the user.
delijn auth set-key--json when parsing output programmatically200552delijn departures @home--watch refreshes every 30s; avoid in scripts| Flag | Format | Use case |
|---|---|---|
| (default) | Table | User-facing display |
--json | JSON | Agent parsing, scripting |
--plain | TSV | Pipe to awk/cut |
# By stop number
delijn departures 200552
# By stop name (searches and picks)
delijn departures "Gent Sint-Pieters"
# Filter by line
delijn departures 200552 --line 1
# Limit results
delijn departures 200552 --limit 5
# JSON output for parsing
delijn departures 200552 --json
# Auto-refresh every 30 seconds
delijn departures 200552 --watch
Note: Watch mode is interactive and blocks - use for user display only, not scripting.
# Search by name
delijn stops search "Gent Sint-Pieters"
# Get stop details by number
delijn stops get 200552
# JSON for scripting
delijn stops search "Brugge" --json
# Search lines
delijn lines search "1"
# Get line details (entity + line number)
delijn lines get 1 1
# Save a favorite stop
delijn config set-favorite home 200552
delijn config set-favorite work 301234
# Use favorites with @ prefix
delijn departures @home
delijn departures @work
# List all favorites
delijn config list-favorites
# Get next departure time
delijn departures 200552 --limit 1 --json | jq -r '.[0].time'
# Find stop ID from name
delijn stops search "Gent" --json | jq -r '.[0].number'
# List all stops matching pattern
delijn stops search "station" --json | jq -r '.[] | "\(.number) \(.name)"'
| Variable | Description |
|---|---|
DELIJN_API_KEY | API key (overrides keyring) |
DELIJN_KEYRING_BACKEND | Keyring backend: keychain, file, pass |
NO_COLOR | Disable colored output |
De Lijn API has two rate limits:
The CLI handles rate limiting automatically with backoff.
Run delijn auth set-key to store the API key interactively.
Use 6-digit stop numbers. Search with delijn stops search "name" to find the correct number.
brew install dedene/tap/delijn