Skip to content

50,000 free calls a month, card-free. Get an API key →

Documentation menu
docs / examples
Examples

Copy it, run it

16 worked examples covering the platform end to end, each one with the code for the way you actually work: the Web SDK, a plain curl against the hosted gateway, and the MCP tool call an agent sends. Every sample is checked against the contract it claims, so what you paste is what the API takes.

What you need to run these

Nothing you have to buy. The MCP examples need no key at all: point a client at https://mcp.mapmap.ai/mcp and call the tools under fair use. The static map endpoint takes no key either. Everything else runs on a free key you mint in one call, with no card, no console and no wait:

bash
curl -fsS -X POST "https://api.mapmap.ai/v1/keys" \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.co.uk", "accept_tos": true}'

The key works immediately for 1,000 calls. Clicking the emailed verification link lifts it to 50,000 calls a month, free, commercial use allowed. Full detail on the quickstart.

Add a map

A branded vector map in five lines: MapMap tiles, the MapLibre renderer and the pmtiles protocol already wired up. The container needs a real height or MapLibre draws into a zero-pixel canvas.

Web SDKcurl

Custom markers

Your own pins on the map: 21 built-in glyphs, three size presets, any colour, optional labels, or a data URI image of your own. The same schema Studio's markers panel writes and the gateway validates.

Web SDK

3D terrain

One flag drapes the map over real elevation and shades the relief. The default DEM is the same dataset the gateway samples for POST /elevation, so a rendered mountain and a queried one agree.

Web SDKcurl

Globe projection

The map on a sphere rather than a plane, for the zoomed-out view. Globe is a MapLibre projection, so it is set on the underlying map; the navigation chase camera is mercator only and says so.

Web SDK

Static map image

A rendered PNG of a view, a route or a GeoJSON overlay, from one URL and no API key. Built for agents, which can look at a map but cannot run a renderer.

curl

Truck route with dimensions and ADR

A 44 tonne artic, 4.0 m high, carrying dangerous goods under ADR tunnel restriction code C/E. The dimensions and the tunnel code go into costing, so the route comes back already refusing what the vehicle cannot legally take.

Web SDKcurlMCP

Turn instructions anchored to landmarks

"Turn right just after the Shell garage", beside the engine's own street-name instruction rather than instead of it. Nothing is named unless it is recognisable from the road, within 40 m of the junction and not tagged as closed, so many routes come back with none.

Web SDKcurlMCP

Why this route

Ask a route to explain itself. The gateway re-routes with each declared constraint relaxed and reports the ones that provably changed the geometry, with the place the routes part ways. Derived by the engine, not written by a language model.

curlMCP

Optimise a mixed fleet

Two lorries, two drops, one of them dangerous goods, and only one vehicle is ADR licensed. The ADR profile constrains the roads; skills constrain the assignment, so the hazmat job can only land on the licensed lorry.

curlMCP

Reachable area (isochrones)

How far a vehicle gets from a point inside a time budget, as GeoJSON you can drop straight onto a map. Pass a truck profile and the contour respects the dimensions the vehicle actually has.

Web SDKcurlMCP

Distance and duration matrix

Many-to-many travel times and distances: the workhorse behind "which of my drivers is genuinely closest, by road, in a lorry". Unreachable pairs come back as honest nulls, never a sentinel cost.

Web SDKcurlMCP

Cheapest fuel along a route

Forecourts on the way, ranked cheapest first, each priced with its real engine-computed detour. A station 3p cheaper is not cheaper if reaching it costs eight minutes, which is why the detour is measured rather than assumed.

curlMCP

Geocode with a location bias

Free text to coordinates, with a bias point that reorders candidates and a bounding box that excludes anything outside it outright. Reverse lookups add a distance and, on POI hits, a details object straight from OpenStreetMap.

Web SDKcurlMCP

Search along a route, with real detour costs

"Coffee, adds 4 min." Every candidate is costed leave-route, stop, rejoin against staying on the route, under your own costing, so a truck's detour is a truck's detour. Note the two surfaces search different data.

curlMCP

Nearby places, described from where you are standing

Give the search a compass heading and every result is phrased from the user's point of view: "ahead and slightly to your right, about 80 metres". That is what a voice or wearable client reads out, instead of coordinates.

MCP

Call the route tool over MCP

Point any MCP client at the hosted endpoint and routing becomes a tool the model can call. No key is needed to connect for evaluation; present your own snk_ key and the metered calls bill to you instead of us.

curlMCP

Want to run a request without writing any code first? The playground makes the same calls from your browser, and the video library shows several of these being built.