autobahn-cli — Usage
Use-case-driven examples for the autobahn CLI, a client for the open
Autobahn App API (verkehr.autobahn.de):
live roadworks, traffic warnings, closures, lorry parking, webcams and electric
charging stations along the German motorway network. The CLI is read-only and
needs no API key. Every command prints pretty JSON to stdout.
Install
npm i -g @maschinenlesbar.org/autobahn-cli
This installs the autobahn bin. To run without a global install, use
node apps/cli/dist/src/cli/index.js (after npm run build) in place of autobahn in
any example below.
Use cases
1. Discover which motorways are covered
Find the valid <roadId> values (e.g. A1, A8, A99) you can pass to every
other command.
autobahn roads
Returns a JSON array of motorway ids. Pipe through jq to get a flat,
greppable list:
autobahn roads | jq -r '.[]'
2. See current roadworks on the A1
Check what construction sites are active before a trip down the A1.
autobahn roadworks list A1
The listing holds active and planned works: a planned item carries
"future": true (on the A1 in October 2026, 96 of 239). Each item includes an
identifier you can feed to roadworks get. Pull just the titles of the
active ones:
autobahn roadworks list A1 | jq -r '.[] | select(.future | not) | .title'
3. List open closures on a motorway
Closures are full or partial blockings — useful for spotting a route that is shut entirely.
autobahn closures list A3
Planned closures are listed too ("future": true), so keep only the open ones:
autobahn closures list A3 | jq '[.[] | select(.future | not)]'
A list that matches nothing is not an error: it prints an empty result
and exits 0. A road id the API does not know (a typo, or a3 for A3 — ids
are case-sensitive) exits 4 with Unknown road id … instead, so an empty
result always means a real road with nothing listed.
4. Read the full detail of one item by its identifier
The list output is a summary; get fetches the complete record for a single
item, addressed by the identifier field from a matching list.
# 1) grab an identifier from the list
autobahn roadworks list A1 | jq -r '.[0].identifier'
# 2) fetch its full detail (paste the identifier from step 1)
autobahn roadworks get <identifier>
get with an unknown id (or a 404 from the API) exits 4 (not found). Use the
service the identifier was listed under: the API resolves an identifier whatever
the service, so roadworks get on a parking id prints the parking area (exit 0,
display_type PARKING).
5. Find webcams along the A99 (Munich ring)
Pull live camera locations so you can eyeball traffic conditions.
autobahn webcams list A99
Upstream data gap. The webcam service currently returns
[]on every road checked (A1, A3, A7, A8, A99 in September 2026). That is the upstream data, not a CLI error: the commands work, there is just nothing listed.
Once the service lists webcams again, extract the linkable camera URLs with
jq (until then this prints nothing):
autobahn webcams list A99 | jq -r '.[].linkurl'
6. Locate lorry parking areas on the A8
Plan a rest stop by listing the parking areas along a route. Each item gives the
number of spaces (PKW Stellplätze: N, LKW Stellplätze: N in description), not live
occupancy.
autobahn parking list A8
7. Find EV charging stations along a road
List electric charging stations on the A9 to plan where to recharge.
autobahn charging list A9
Then drill into one station’s details:
autobahn charging get <identifier>
8. Check traffic warnings, compactly, for scripting
--compact prints single-line JSON — handy when piping into another tool or
logging. It is a global option and works before or after the command.
autobahn --compact warnings list A2
9. Count how many roadworks are active on a motorway
Combine list with jq for a quick metric. Drop the planned items
("future": true) first, or the count includes works that have not started:
autobahn roadworks list A7 | jq '[.[] | select(.future | not)] | length'
10. Run against a different host or with a longer timeout
Point the client at an alternate base URL, or relax the per-request timeout for slow networks. These are global options; they work before or after the command.
autobahn --timeout 60000 --user-agent "trip-planner/1.0" warnings list A1
autobahn --base-url https://verkehr.autobahn.de roads
Global options
Global options may be given before or after the command — both
autobahn --compact roads and autobahn roads --compact work.
| Option | Description |
|---|---|
-V, --version |
Print the version number — before the command only (-v works too); after a command it is a usage error |
--base-url <url> |
API base URL (default https://verkehr.autobahn.de, or the AUTOBAHN_BASE_URL environment variable; the flag wins); a user:password@ in it is sent as HTTP Basic auth |
--timeout <ms> |
Per-request timeout in milliseconds (default 30000, 0 disables). A timed-out request is not retried |
--user-agent <ua> |
User-Agent header value (default autobahn-cli/<version> (+https://github.com/maschinenlesbar-org/autobahn-cli)) |
--max-retries <n> |
Retries for transient 429/502/503/504 responses and reset connections (default 2, at most 10). Each retry logs one WARN record of autobahn.http before it waits (HTTP 503 from host: retry 1 of 3 in 2 s). |
--max-response-bytes <n> |
Cap response body size in bytes (0 = unlimited; default 100 MiB) |
--compact |
Print JSON on a single line instead of pretty-printed |
--log-format <format> |
How errors, warnings and notes are written to stderr: text (default; log4j style, 2026-10-09T14:03:12.481Z WARN [autobahn.http] …) or jsonl (one JSON object per line: ts, level, topic, msg). stdout is not affected |
-h, --help |
Display help for a command |
A base URL on plain http: to a host other than loopback (localhost, 127.0.0.0/8,
::1) works, but the CLI writes one warning record to stderr before the first request, e.g.
… WARN [autobahn.http] requests to mirror.example are sent unencrypted (http:, not https:), or
… WARN [autobahn.http] the base URL's credentials are sent unencrypted to mirror.example (http:, not https:)
when it carries a user:password@ (never printed). stdout and the exit code are unchanged.
Commands: roads, and the six service groups roadworks, webcams,
parking, warnings, closures, charging — each with list <roadId> and
get <identifier> subcommands. autobahn help <command path> (for example
autobahn help roadworks list) prints the help of any command, like --help after it.
Exit codes: 0 success (also help, including autobahn with no arguments), 4 not found (get matched nothing or answered 404 /
unknown road id in list),
2 usage error (a command, option or argument rejected before any request, or a command group without a subcommand),
1 any other API, network or parse error — including a 404 from roads or
a list, which means a wrong --base-url.