For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.
Routing and directions API
The MapTiler Routing API calculates optimal routes and produces precise turn-by-turn navigation instructions between coordinates. Built on top of high-performance routing engines, it supports various modes of transport, advanced routing parameters, and localization.
Features
- Costing Profiles: Highly tailored routing algorithms for different modes of travel:
- 🚗 Car: Optimized for passenger vehicles with configurable costing modes (
fastest,shortest,balanced) and top-speed limits. - 🚛 Truck: Enterprise routing supporting physical restrictions (weight, height, length, axle load) and hazardous materials (
hazmat). - 🚲 Bicycle: Specialized cycling routes with selectable bicycle types (
road,gravel,mountain,city) and custom average speeds. - 🚶 Pedestrian: Safe walking paths with configurable walking speeds.
- 🚗 Car: Optimized for passenger vehicles with configurable costing modes (
- Alternative Routes: Calculate up to 3 alternate routes (
alternates) alongside the primary route for comparison. - Time-aware Routing: Specify planned departure (
departureTime) or arrival (arrivalTime) times for time-dependent routing. - Dynamic Avoidances: Avoid specific road categories (like
tolls,highways, orferries) or define geographicavoidLocationsusing GeoJSON polygons to steer clear of custom areas. - Multi-point Routing: Add intermediate waypoints to define complex routes with precise heading preferences for starting or passing through coordinates.
- Internationalization: Turn-by-turn maneuver instructions localized in over 25 languages (including English, Spanish, German, French, Czech, Polish, etc.).
- Efficient Geometries: Retrieve the route path as clean coordinate arrays or highly compressed Encoded Polylines for fast network transmission.
Key
You need a MapTiler API key to use this service. Get it here and learn how to secure it.
Units of measurement
Important
The units request parameter (km by default, or mi) directly alters the numeric values returned for distances, while all other dimensions and speeds remain metric.
- Route distances (
totalLength,length): Expressed in the requested unit (kmby default, ormi). Total distance is returned intotalLengthfor route and leg summaries, and inlengthfor individual maneuver steps. - Vehicle dimensions & restrictions: Always metric, regardless of the
unitsparameter:- Vehicle length and height: meters (m)
- Weight and axle load: metric tonnes (t)
- Speed limits and travel speeds (
topSpeed,walkingSpeed,cyclingSpeed): km/h
- Durations (
totalTime,time): Always returned in seconds.
Routing API reference
The MapTiler Routing API supports both HTTP POST and GET methods:
- POST (primary): The recommended method for invoking the API. It uses a JSON request body and supports the full range of advanced routing parameters, costing profiles, dynamic avoidances, and waypoints.
- GET: A simpler alternative where parameters are passed as URL query parameters. It does not support some advanced options, such as starting headings or complex avoid zones.
Configure your environment settings below to update code samples and live API tests:
- Server – select where your requests go. Keep the default
api.maptiler.comor use the EU-based endpoint. - Authentication – enter your API key. It will automatically populate code snippets and test requests (otherwise, placeholders are shown).
- Client Libraries – select your preferred programming language of the code examples.