navitia.io is the open API for building cool stuff with mobility data. It provides the following services
* journeys computation
* line schedules
* next departures
* exploration of public transport data / search places
* and sexy things such as isochrones
navitia is a HATEOAS API that returns JSON formated results
Learn more at Sncf Connect.
Printed by @jmbernabotto (jmbernabotto).
Quick Start
1. Install
See Install above.
2. Set Up Credentials
Get your API key from your API provider's developer portal. The key typically looks like a long alphanumeric string.
export SNCF_API_KEY="<paste-your-key>"
You can also persist this in your config file at ~/.config/navitia-pp-cli/config.toml.
3. Verify Setup
sncf-connect-pp-cli doctor
This checks your configuration and credentials.
4. Try Your First Command
sncf-connect-pp-cli coverage get
Usage
Run sncf-connect-pp-cli --help for the full command reference and flag list.
Commands
coord
Manage coord
sncf-connect-pp-cli coord <lon> <lat> - Get lon lat
coords
Manage coords
sncf-connect-pp-cli coords <lon> <lat> - Get lon lat
coverage
Manage coverage
sncf-connect-pp-cli coverage get - Get
sncf-connect-pp-cli coverage get-lon-lat - Get lon lat
sncf-connect-pp-cli coverage get-region - Get region
elevations
Manage elevations
sncf-connect-pp-cli elevations - Get
journeys
Manage journeys
sncf-connect-pp-cli journeys - Get
line-groups
Manage line groups
sncf-connect-pp-cli line-groups - Get
lines
Manage lines
sncf-connect-pp-cli lines - Get
networks
Manage networks
sncf-connect-pp-cli networks - Get
places
Manage places
sncf-connect-pp-cli places get - Get
sncf-connect-pp-cli places get-id - Get id
route-schedules
Manage route schedules
sncf-connect-pp-cli route-schedules - Get
routes
Manage routes
sncf-connect-pp-cli routes - Get
stop-areas
Manage stop areas
sncf-connect-pp-cli stop-areas - Get
stop-points
Manage stop points
sncf-connect-pp-cli stop-points - Get
stop-schedules
Manage stop schedules
sncf-connect-pp-cli stop-schedules - Get
terminus-schedules
Manage terminus schedules
sncf-connect-pp-cli terminus-schedules - Get
vehicle-journeys
Manage vehicle journeys
sncf-connect-pp-cli vehicle-journeys - Get
Output Formats
# Human-readable table (default in terminal, JSON when piped)
sncf-connect-pp-cli coverage get
# JSON for scripting and agents
sncf-connect-pp-cli coverage get --json
# Filter to specific fields
sncf-connect-pp-cli coverage get --json --select id,name,status
# Dry run — show the request without sending
sncf-connect-pp-cli coverage get --dry-run
# Agent mode — JSON + compact + no prompts in one flag
sncf-connect-pp-cli coverage get --agent
Agent Usage
This CLI is designed for AI agent consumption:
- Non-interactive - never prompts, every input is a flag
- Pipeable -
--json output to stdout, errors to stderr
- Filterable -
--select id,name returns only fields you need
- Previewable -
--dry-run shows the request without sending
- Read-only by default - this CLI does not create, update, delete, publish, send, or mutate remote resources
- Offline-friendly - sync/search commands can use the local SQLite store when available
- Agent-safe by default - no colors or formatting unless
--human-friendly is set
Exit codes: 0 success, 2 usage error, 3 not found, 4 auth error, 5 API error, 7 rate limited, 10 config error.
Health Check
sncf-connect-pp-cli doctor
Verifies configuration, credentials, and connectivity to the API.
Configuration
Config file: ~/.config/navitia-pp-cli/config.toml
Static request headers can be configured under headers; per-command header overrides take precedence.
Environment variables:
| Name | Kind | Required | Description |
|---|
SNCF_API_KEY | per_call | Yes | |
Troubleshooting
Authentication errors (exit code 4)
- Run
sncf-connect-pp-cli doctor to check credentials
- Verify the environment variable is set:
echo $SNCF_API_KEY
Not found errors (exit code 3)
- Check the resource ID is correct
- Run the
list command to see available items
Generated by CLI Printing Press