Walking-access API CLI and Python client
aportee is a command-line tool and Python client for the à portée /v1 API: every command
calls the API over HTTP. Each command has a --json mode that prints the raw payload, and an exit
code that maps to the HTTP status, so a script or coding agent can branch on the result.
Install
Section titled “Install”Needs Python 3.11 or later; it has no other dependencies.
pipx install aportee # the aportee commanduvx aportee access 43.25085 -79.81809 # run it without installingpip install aportee # the Python client, in a projectMost read endpoints answer without a key, 100 requests a day per IP. A free key unlocks batch
lookups, map images, walking routes, the name search near a point, and transit at other periods,
at p90 (the worst case) or by bike + transit. A key gets 1,000 requests a day, or 10,000 for
researchers and pro members (rate limits).
aportee login gets a key: it prints a link and a code and opens your browser, where you
sign in and approve. It then prints export APORTEE_API_KEY=… for you to run or add to
your shell profile. --name sets the name shown on the approval page.
eval "$(aportee login)" # or copy the export line it printsexport APORTEE_API_KEY=your-key # or pass --key <k>export APORTEE_BASE=https://aportee.ca # override for a preview deploy (or --base)Commands
Section titled “Commands”| Command | What it does |
|---|---|
aportee access <lat> <lon> |
Minutes to each amenity type from a point. --mode walk|bike|transit|combo (default walk; combo is bike + transit), --period and --statistic for transit, --include, --types, --lang, and --walk-minutes for walk_counts. |
aportee describe <lat> <lon> |
The walkability narrative alone. |
aportee where <lat> <lon> |
Nearest populated place. |
aportee find <name> |
Place search. Add --near <lat,lon> (keyed) to also search places reached on foot from there, and --walk-minutes (5–55, default 15) for how far. |
aportee compare <lat,lon> <lat,lon> |
The difference in minutes for each type between two points, by any --mode. |
aportee routes <lat> <lon> --types grocery,school |
The walked path to the nearest place of each of 1–5 types. Needs an API key; each type counts as one request. |
aportee compass <lat> <lon> |
Each everyday trip’s nearest place, its minutes, its direction and the next places. --types picks some trips only. |
aportee batch <file.csv|-> |
Batch lookups from lat,lon CSV rows (keyed). --format json|geojson, --mode, --period, --statistic. |
aportee image <lat> <lon> |
Branded map PNG (keyed). --out FILE; --markers-file FILE draws up to 500 of your own points from a CSV of lat,lon[,label] or a GeoJSON FeatureCollection. |
aportee embed <lat> <lon> |
iframe snippet. --markers-file FILE draws up to 20 points, without labels. |
aportee amenities |
Every amenity type with en/fr labels. |
aportee me |
The key’s tier, today’s limit and what is left. Not counted against the limit. |
aportee login |
Get a free API key by approving it in your browser. --name. |
aportee reference |
The reference datasets, Can-ALE and Spatial Access Measures, and their fields. |
aportee reference canale --id 10010165 |
Can-ALE record by 2021 DAUID. Also accepts a point or --place. |
aportee reference sam 43.25 -79.82 --mode walking |
SAM record by point; --id accepts an 11-digit DBUID. |
access, describe, where, routes, compass, image, embed and reference also accept
--place "<name>", which takes the centre of the first town matching that name; a street address
doesn’t match. Options and coordinates can come in any order. Global flags: --json,
--key <k>, --base <url>, --help.
aportee access 43.25085 -79.81809 --include allaportee access 45.5017 -73.5673 --mode transit --types grocery,pharmacyaportee access 45.5017 -73.5673 --mode transit --period weekday_night --statistic p90 --key $APORTEE_API_KEYaportee find "Fickle Fig" --near 48.43,-123.37 --key $APORTEE_API_KEYaportee compare 43.25,-79.82 43.65,-79.38 --types grocery,pharmacyaportee routes 43.25085 -79.81809 --types grocery,school --key $APORTEE_API_KEYaportee compass 43.25085 -79.81809aportee image --place Hamilton --out hamilton.png --key $APORTEE_API_KEYWithout a key, --mode transit gives what the free map shows: the weekday morning peak at
p50, the typical trip. Other periods, --statistic p90 (the worst case) and --mode combo need
a key; without one they exit 1 with the API’s 401. Where no transit reaches the point, the
transit time is the walk (the ride for combo), shown as 12 (walk, no transit here). The
response fields are described under cycling and transit.
Exit codes
Section titled “Exit codes”Each exit code stands for an HTTP status or a kind of failure:
| Code | Meaning |
|---|---|
0 |
success |
2 |
bad input (400 / 422, or bad arguments) |
3 |
no data (204) |
4 |
outside coverage (404) |
5 |
rate limited (429) |
1 |
anything else: no key (401), network, 5xx |
Recipes
Section titled “Recipes”Grid check – run a CSV of points through batch and keep the GeoJSON:
aportee batch points.csv --include minutes,population --format geojson \ --key $APORTEE_API_KEY > grid.geojson“Is X in the data, and as what type?”
aportee find "Save-On-Foods" --near 48.43,-123.37 --key $APORTEE_API_KEYGenerate a shareable PNG of an area:
aportee image --place "Kitchener" --types grocery,pharmacy,school \ --out kitchener.png --key $APORTEE_API_KEYPut your own sites on the map (a CSV of lat,lon with an optional label column):
aportee image 53.5465 -113.555 --zoom 15 --markers-file permits.csv \ --out permits.png --key $APORTEE_API_KEYPython
Section titled “Python”The same package is a Python client. Results are plain dicts and lists, and a failed call
raises aportee.ApiError with status, code and detail.
from aportee import Client, to_frame
client = Client() # reads APORTEE_API_KEY and APORTEE_BASE; or Client(key=..., base=...)
# One (lat, lon) needs no key and returns a dict.snapshot = client.access((43.25085, -79.81809), types=["grocery", "pharmacy"])snapshot["minutes"]["grocery"] # {'value': 6, 'reason': 'ok'}
# By transit at a period and statistic; any but weekday_peak p50 needs a key.client.access((45.5017, -73.5673), mode="transit", period="weekday_night", statistic="p90")
# A list of points is sent 100 at a time (keyed) and comes back in the same order.results = client.access([(43.25, -79.82), (43.65, -79.38)], include="minutes")
client.amenities()client.search("Hamilton")client.reference("sam", point=(43.25, -79.82), mode="walking")client.routes((43.25085, -79.81809), ["grocery", "school"]) # GeoJSON lines, keyedclient.compass((43.25085, -79.81809)) # each everyday trip's nearest placesclient.me()
# A map image with up to 500 of your own points (keyed): (lat, lon) or (lat, lon, label)# tuples, or a GeoJSON FeatureCollection.png = client.image(53.5465, -113.555, zoom=15, markers=[(53.5465, -113.555, "Permit 1")])
frame = to_frame(results) # a pandas DataFrame, if pandas is installedclient.login() runs the same browser sign-in as aportee login and keeps the new key on
the client.
Contributing
Section titled “Contributing”The package lives in cli/ of the à portée repository, as its own uv project. The repository’s
root venv has a different aportee command, which runs the data pipeline. Run this client with
uv run --project cli aportee, and its tests with uv run --project cli pytest cli.