Directions Tool
directions_toolFetches turn-by-turn directions between multiple coordinates using Mapbox routing. Supports driving, walking, cycling profiles with traffic, vehicle restrictions, and alternative routes.
Instructions
Fetches directions from Mapbox API based on provided coordinates and direction method. For route planning and distance calculations, use geometries="none" to get compact responses. Only request full geometry (geometries="geojson") when you need to visualize the route on a map or provide detailed turn-by-turn navigation instructions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exclude | No | Whether to exclude certain road types and custom locations from routing. Multiple values can be specified as a comma-separated list. Available options: - All profiles: ferry, cash_only_tolls - Driving/Driving-traffic profiles only: motorway, toll, unpaved, tunnel, country_border, state_border or point(<lng> <lat>) For custom locations you can use Point exclusions (note lng and lat are space separated and at most 50 points are allowed) Note: country_border excludes all controlled country borders; borders within the Schengen Area are not excluded. | |
| arrive_by | No | The desired arrival time in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ, YYYY-MM-DDThh:mmss±hh:mm, or YYYY-MM-DDThh:mm). This parameter is only available for the driving profile and is not supported by other profiles, not even driving-traffic. The travel time will be calculated based on historical and real-time traffic data. | |
| depart_at | No | The departure time in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ, YYYY-MM-DDThh:mmss±hh:mm, or YYYY-MM-DDThh:mm). This parameter is only available for the driving and driving-traffic profiles. The travel time will be calculated based on historical and real-time traffic data. | |
| max_width | No | The max vehicle width, in meters. The Directions API will compute a route that includes only roads with a width limit greater than or equal to the max vehicle width. Must be between 0 and 10 meters. The default value is 1.9 meters. Only available for driving and driving-traffic profiles. | |
| geometries | No | The format of the returned geometry. Options: - none (default): no geometry object is returned at all, use this if you do not need all of the intermediate coordinates. - geojson: as GeoJSON LineString (might be very long as there could be a lot of points) | none |
| max_height | No | The max vehicle height, in meters. The Directions API will compute a route that includes only roads with a height limit greater than or equal to the max vehicle height. Must be between 0 and 10 meters. The default value is 1.6 meters. Only available for driving and driving-traffic profiles. | |
| max_weight | No | The max vehicle weight, in metric tons (1000 kg). The Directions API will compute a route that includes only roads with a weight limit greater than or equal to the max vehicle weight. Must be between 0 and 100 metric tons. The default value is 2.5 metric tons. Only available for driving and driving-traffic profiles. | |
| coordinates | Yes | Array of coordinate objects with longitude and latitude properties to visit in order. Must include at least 2 coordinate pairs (starting and ending points). Up to 25 coordinates total are supported. | |
| alternatives | No | Whether to try to return alternative routes (true) or not (false, default). Up to two alternatives may be returned. | |
| routing_profile | No | Routing profile for different modes of transport. Options: - mapbox/driving-traffic (default): automotive with current traffic conditions - mapbox/driving: automotive based on typical traffic - mapbox/walking: pedestrian/hiking - mapbox/cycling: bicycle | mapbox/driving-traffic |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | ||
| uuid | No | ||
| routes | No | ||
| waypoints | No |