mapmap-client (Python)
A generated Python client for the full MapMap gateway API: routing, ADR
truck compliance, geocoding, matrices, isochrones, optimisation, tiles and
styles. Generated directly from the live OpenAPI document at
https://api.mapmap.ai/openapi.json
with OpenAPI Generator 7.16.0 (the
python generator). Full generated method-by-method reference:
API.md.
Regenerated on 25 November 2026 against the 0.3.0 document, which
declared 181 operations; this client carries a typed method for all 181.
That is a measurement with a date on it rather than a standing promise: the
API moves and a generated client does not move with it, so before relying on
an endpoint, check it is in mapmap_client/api and
regenerate if it is not. It sat at 69 of 128 for seven weeks under wording
that said "every endpoint".
For an agent framework instead of a raw HTTP client, see
langchain-mapmap or
crewai-mapmap, which wrap the MCP server's tools
directly.
60-second quickstart
pip install mapmap-client
Get a card-free key in one call, then make your first request:
curl -fsS -X POST "https://api.mapmap.ai/v1/keys" \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com", "accept_tos": true}'
import mapmap_client
config = mapmap_client.Configuration(
host="https://api.mapmap.ai",
access_token="snk_...", # the "key" field from the response above
)
with mapmap_client.ApiClient(config) as api_client:
routing = mapmap_client.RoutingApi(api_client)
# OSRM-compatible route: Dover to Birmingham, 44 t artic, 4.0 m tall,
# ADR tunnel restriction code C/E. The answer is an OsrmRouteResponse
# model; each entry of its `routes` is a plain dict.
result = routing.get_route(
profile="truck",
coordinates="1.3134,51.1279;-1.8904,52.4862",
height=4.0,
weight=44.0,
hazmat=True,
tunnel_code="C/E",
)
print(result.routes[0]["distance"], result.routes[0]["duration"])
No key yet and just want to check connectivity? mapmap_client.MetaApi(api_client).health()
hits the unauthenticated /health endpoint.
Place entrances
A place's entrances are the doors OpenStreetMap maps on it, tied to the place
on evidence (its own building outline, a station's stop area, a matching
address, or being the building's only occupant). None is estimated today:
every door served has source: "osm". An empty list means no door is tied to
the place, not that it has none.
The door data is on api.mapmap.ai (checked on 23 November 2026). On a
deployment without it, get_place_entrances raises a ServiceException with
status 501 and problem type entrances-not-enabled, and the include answers
below carry
entrances_index: "not-configured" with entrances: None on each place.
GeocodingApi.get_place_entrances(id=...)callsGET /v1/places/{id}/entrances(operationIdget_place_entrances) with a place id exactly as a place result reports it (properties.id, such asosm:w119438298:poi). The answer is aPlaceEntrancesResponse:id, name, lat, lon, entrances, entrances_index, note, where each entrance is a dict{lon, lat, kind, wheelchair, access, door, level, ref, name, osm_id, source, confidence, basis}.confidence(high,medium,low) grades how sure the tie between door and place is, andbasissays what tied them (own_outline,stop_area,address_match,sole_occupant). An unknown place raisesNotFoundException(404).include="entrances"onGeocodingApi.get_geocode,get_geocode_reverse,get_geocode_retrieveandDirectionalApi.get_places_in_viewadds the same entrance list to every place:features[i]["properties"]["entrances"]on the geocoding answers,results[i]["entrances"](with the place'sid) on in-view. Off by default, so answers without it are unchanged; any other value is a 400. A feature with no place id to look up getsentrances: None.entrances_indexonGeocodeFeatureCollectionandPlacesInViewResponse(loaded,not-configuredorfailed) says whether there was door data to read.RoutingApi.post_route(POST /route) ends at a place's door when its free-form body sendsplace_idon the last location, or top-levelarrive_at("entrance"or{place_id, entrance_kind, wheelchair}).RouteResponse.arrivalthen says which door and why (applied,place_id,entrance,reason,moved_m,original_destination), orapplied: Falsewith the reason; the route is never refused for it.
import mapmap_client
from mapmap_client.exceptions import ServiceException
config = mapmap_client.Configuration(host="https://api.mapmap.ai", access_token="snk_...")
with mapmap_client.ApiClient(config) as api_client:
geocoding = mapmap_client.GeocodingApi(api_client)
# Find the place, asking for its doors on the same call.
found = geocoding.get_geocode(q="Waitrose, Liverpool Road, London", include="entrances")
print("door data:", found.entrances_index) # "loaded" when the deployment has it
features = found.features or [{}]
place_id = features[0].get("properties", {}).get("id") or "osm:w119438298:poi"
# Or ask for one place's doors by its id.
try:
doors = geocoding.get_place_entrances(id=place_id)
except ServiceException as error:
if error.status != 501:
raise
print("no door data on this deployment:", error.data.detail)
else:
if not doors.entrances:
print(doors.note) # no door is tied to this place, which is not the same as none
for door in doors.entrances or []:
print(door["kind"], door["confidence"], door["lat"], door["lon"])
Navigation sessions
A navigation session is turn-by-turn guidance held by the gateway, for
clients that cannot run guidance themselves (voice assistants, wearables,
agents). Open one with an origin and a destination, post each position fix,
and every answer gives the state (on_route, off_route, rerouted,
arrived or lost_position), the next instruction and what is left to go.
Phone and in-car apps should use the mobile SDKs instead, which run guidance
on the device.
What a session keeps, and for how long:
- Gateway memory only. Sessions do not survive a gateway restart or a
deploy. A session that has gone raises
NotFoundException(404): open a new one from where the traveller is now. - Two hours idle. A session with no progress and no read for two hours
expires; every progress request and every read resets the clock
(
expires_at,idle_ttl_son the answers). - The route and the last accepted fix only. No trail of earlier positions is kept.
The four methods are on RoutingApi:
| Method | Route | operationId |
|---|---|---|
create_navigation_session(create_session_request) |
POST /v1/navigation/sessions (201) |
create_navigation_session |
send_navigation_progress(id, progress_request) |
POST /v1/navigation/sessions/{id}/progress |
send_navigation_progress |
get_navigation_session(id) |
GET /v1/navigation/sessions/{id} |
get_navigation_session |
delete_navigation_session(id) |
DELETE /v1/navigation/sessions/{id} (204) |
delete_navigation_session |
CreateSessionRequesttakesoriginanddestination({lat, lon}or{place_id}),costing(as onPOST /route),costing_options,truck,adrandoptions(landmarks,language,units). The answer, aCreateSessionResponse, carriessession_id,route,first_instruction,expires_at,idle_ttl_sandprivacy.arrive_atis"point"(the default, the destination's own coordinates),"entrance"(the best mapped door of the place at the destination), or{place_id?, entrance_kind?, wheelchair?}. When a door was asked for, the answer'sarrivalsays which one and why, orapplied: Falsewith the reason; the session still opens. See "Place entrances" above.ProgressRequesttakeslat,lonandtimestamp(an RFC 3339 string or milliseconds since the Unix epoch), and optionallyheading_deg,speed_mpsandaccuracy_m. The answer, aProgressResponse, hasstate,fix(accepted, andreasonwhen the fix was not used),next_instruction,instruction_changed,distance_to_next_m,remaining_m,remaining_s,eta,off_route(inoff_route) androute(the new route, inrerouted).arrive_atandtimestampare oneOf fields, so the generated models wrap them:from_dicttakes the plain values (as in the example below), and keyword construction takes the wrappers,arrive_at=SessionArriveAt("entrance"),arrive_at=SessionArriveAt(SessionArriveAtDoor(entrance_kind="main", wheelchair=True))andtimestamp=FixTime("2026-11-20T16:04:05Z")orFixTime(1763654645000).- On routes in Great Britain,
route.duration_s,remaining_sandetainclude the typical-delay calibration thatroute.eta_calibrationdescribes. - Opening a session and posting progress are metered; reading and ending are free. See https://mapmap.ai/pricing.
from datetime import datetime, timezone
import mapmap_client
from mapmap_client.exceptions import NotFoundException
config = mapmap_client.Configuration(host="https://api.mapmap.ai", access_token="snk_...")
with mapmap_client.ApiClient(config) as api_client:
routing = mapmap_client.RoutingApi(api_client)
session = routing.create_navigation_session(mapmap_client.CreateSessionRequest.from_dict({
"origin": {"lat": 52.2, "lon": 0.13},
"destination": {"lat": 52.204, "lon": 0.142},
"costing": "pedestrian",
"options": {"landmarks": True, "language": "en-GB"},
}))
print(session.first_instruction.text, "expires", session.expires_at)
try:
# One fix per update from the device's location source.
answer = routing.send_navigation_progress(session.session_id, mapmap_client.ProgressRequest.from_dict({
"lat": 52.2001, "lon": 0.1342, "heading_deg": 91,
"timestamp": datetime.now(timezone.utc).isoformat(timespec="seconds"),
}))
except NotFoundException:
print("the session has gone (expired or the gateway restarted): open a new one")
else:
if answer.next_instruction and (answer.instruction_changed or answer.state == "rerouted"):
print(answer.next_instruction.text) # read it out
print(answer.state, answer.remaining_m, "m to go, arriving", answer.eta)
routing.delete_navigation_session(session.session_id)
Self-hosted
Point host at your own gateway instead:
config = mapmap_client.Configuration(host="https://maps.internal.example")
Regenerating this client
The client is generated, not hand-written. To refresh it against a newer API version:
curl -fsS https://api.mapmap.ai/openapi.json -o openapi.json
docker run --rm -v "$(pwd)/..:/local" openapitools/openapi-generator-cli:v7.16.0 generate \
-i /local/openapi.json \
-g python \
-o /local/mapmap-client-python \
--package-name mapmap_client \
--skip-validate-spec \
--additional-properties=packageVersion=0.1.1,projectName=mapmap-client,licenseInfo=MIT
If Docker cannot bind-mount this directory (Colima without a home-directory
mount, for example), generate inside the container instead: docker create
the same command with -i /tmp/openapi.json -o /tmp/out, docker cp the
spec into /tmp, docker start -a it, and docker cp /tmp/out back.
Copy the result over this package without the files listed below, and keep
the existing generated tests. The generated README.md is the method-by-method
reference: copy it to API.md.
--skip-validate-spec is needed because openapi-generator's 3.1 validator
currently flags a missing info.license.identifier on the live spec as an
error; that is a spec metadata nit worth fixing upstream, not a real
incompatibility, and it does not affect the generated code. Re-apply the
metadata fixes and the security floors (Python 3.10 or newer, urllib3>=2.8.0,
python-dateutil>=2.9.0.post0) in pyproject.toml, setup.py, requirements.txt,
README.md and LICENSE after regenerating, since the generator overwrites them with its own
defaults. Keep test-requirements.txt too: the generator rewrites it with old floors
(pytest>=7.2.1, tox>=3.9.0, mypy>=1.5) and drops the filelock and virtualenv pins.
Publishing (maintainers)
Never from a laptop. .github/workflows/publish-python-packages.yml builds,
tests and twine checks this package on every pull request that touches it,
and publishes it to PyPI through trusted publishing (no stored token) when
dispatched on main with the version typed in full:
# Dry run: build, test and twine check only
gh workflow run publish-python-packages.yml -R Mapmapai/mapmap --ref main \
-f package=mapmap-client
# Publish: confirm_version must equal the version in pyproject.toml
gh workflow run publish-python-packages.yml -R Mapmapai/mapmap --ref main \
-f package=mapmap-client -f confirm_version=0.1.1
For a later release, bump version in pyproject.toml and setup.py (and
the CHANGELOG) first: PyPI never accepts the same version twice.
Licence
MIT for this generated client. The MapMap service itself is governed by https://mapmap.ai/terms.
Metadata
Release files for mapmap-client 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mapmap_client-0.1.1.tar.gz | 484.7 kB | With provenance | Details for mapmap_client-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mapmap_client-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for mapmap_client-0.1.1-py3-none-any.whl |
Total release size: 1.5 MB
Release files / mapmap_client-0.1.1.tar.gz
| Download URL | mapmap_client-0.1.1.tar.gz |
|---|---|
| Size | 484.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ea1e6e58b7cf59c3c6a6728413dec153d80ffc9c50a062f9e5aeb4634a4e078
|
|
BLAKE2b-256 checksum How to use checksums |
d95c58eaa70c7417e1ed06ce4ca7f29a2fe68c3586b4c5b2ddeb318679647934
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logRelease files / mapmap_client-0.1.1-py3-none-any.whl
| Download URL | mapmap_client-0.1.1-py3-none-any.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
293131594fde5735260d3247547a4228e8dbc5e6331f8e0bcb5eb170056dc520
|
|
BLAKE2b-256 checksum How to use checksums |
c1c72f6aab502e14dd98e177e275d82e919dde66ae0ab0146e3665d24852a3d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logSecurity for mapmap-client 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mapmap_client-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.