Skip to main content
GuidesAPI ReferenceExamples

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.

Complete API Reference

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 Parameters
  • avoid - Features to avoid (highway, toll, ferry, unpaved, turnaround, traffic, roadblocks) - see Common Parameters
  • vehicle - Detailed vehicle specifications including mass, dimensions, fuel type, battery capacity - see Common Parameters
  • details - Level of detail in response (full, basic)
  • alternatives - Number of alternative routes to return
  • locale - ISO 3166-1 language code for instructions
  • terrain - Include elevation profile data
  • track - 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 information
  • routes - Array of route objects, each containing:
    • distance - Total route distance in meters
    • time - Total route time in seconds
    • bbox - Bounding box coordinates [east, south, west, north]
    • path - Route path as coordinate array or encoded polyline
    • instructions - Turn-by-turn navigation instructions
    • sections - Detailed road information (surface types, road classes, speed limits, countries)
    • terrain - Elevation profile with uphill/downhill metrics (if requested)

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.