Routing API
Current version: 1.0.0, View Release Notes
The Routing API is a powerful navigation service that computes optimal routes between two or more locations, delivering comprehensive route planning capabilities for a wide range of applications. Whether you're building a logistics platform, a delivery management system, a navigation app, or an electric vehicle route planner, this API provides the flexibility and precision needed to create intelligent routing solutions.
The API goes beyond simple point-to-point routing by offering advanced features such as multi-waypoint routes, vehicle-specific constraints, real-time traffic avoidance, and specialized support for electric vehicles with charging station integration. With support for multiple transport modes (car, truck, bike, pedestrian, and public transport), customizable route preferences (fastest, shortest, economic, scenic), and detailed route attributes including elevation profiles and road surface data, you can tailor routing calculations to match your exact requirements.
Key capabilities include turn-by-turn navigation instructions with street names, alternative route options, route sections with speed limits and road classifications, and the ability to specify custom waypoints to control the route path. The API also supports comprehensive vehicle specifications including physical dimensions, weight restrictions, and fuel/battery properties, making it ideal for commercial fleet management and specialized vehicle routing scenarios.
View the complete Routing API Reference for detailed request/response schemas, examples, and interactive documentation.
Endpoint: POST /routing
Base URL: https://api.magiclane.net/api/v1
Key Features:
- Find the most optimal route and estimated time of arrival (ETA) between origin and destination
- Get turn-by-turn directions for different transport modes including car, truck, bike, and pedestrian
- Calculate routes based on vehicle specifications such as dimensions, weight, and fuel type
- Add custom waypoints to follow a specific path geometry instead of the automatically calculated optimal route
- Support for multiple route types: fastest, shortest, economic, and scenic
- Electric vehicle routing with charging station integration
- Detailed route information including distance, time, elevation profiles, and road surface data
- Comprehensive turn-by-turn instructions with street names
- Route sections with speed limits, country codes, and road classifications
Required Parameters:
transport- Route transport mode (car, lorry, truck, pedestrian, bike, public)waypoints- Array of coordinates [[longitude, latitude], ...]
Optional Parameters:
type- Route type (fastest, shortest, economic, scenic) - see Common Parametersavoid- Features to avoid (highway, toll, ferry, unpaved, turnaround, traffic, roadblocks) - see Common Parametersvehicle- Detailed vehicle specifications including mass, dimensions, fuel type, battery capacity - see Common Parametersdetails- Level of detail in response (full, basic)alternatives- Number of alternative routes to returnlocale- ISO 3166-1 language code for instructionsterrain- Include elevation profile datatrack- Custom path geometry to follow
Example Request:
curl -X POST https://api.magiclane.net/api/v1/routing \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"transport": "car",
"type": "fastest",
"waypoints": [[13.388860, 52.517037], [13.397634, 52.529407]],
"avoid": ["toll", "highway"],
"details": "full",
"alternatives": 2,
"locale": "en"
}'
Response Structure:
The API returns a JSON object containing:
info- Copyright and attribution informationroutes- Array of route objects, each containing:distance- Total route distance in meterstime- Total route time in secondsbbox- Bounding box coordinates [east, south, west, north]path- Route path as coordinate array or encoded polylineinstructions- Turn-by-turn navigation instructionssections- Detailed road information (surface types, road classes, speed limits, countries)terrain- Elevation profile with uphill/downhill metrics (if requested)
Related Documentation
For information about common parameters shared across multiple APIs, including vehicle specifications, route types, and avoidance options, see Common Parameters.
For information about calculating reachable areas from a given location, see Isochrones API.