Skip to main content

Examples

Route types

Shortest route in time

By default, the server returns the shortest car route in time using current traffic data. To build a specific type of route, specify the type parameter in the request:

{
"points": [...],
"type": "jam" // car route using current traffic data
}

Instead of current traffic data, you can build a route using statistical traffic data. To do this, specify the statistics route type and the required date and time in RFC 3339 format as the start_time parameter:

{
"points": [...],
"type": "statistics", // car route using statistical traffic data...
"start_time": "2020-05-15T15:52:01Z" // ...as of 15 May 2020, 15:52:01 UTC
}

Shortest route in distance

To build the shortest route in distance, even if it is not the fastest one, specify the shortest route type:

{
"points": [...],
"type": "shortest"
}

Transportation types

By car

A car route is built by default. To specify this transport type explicitly, add the transport parameter with the value driving:

{
"points": [...],
"transport": "driving" // car route
}

By public transport

To build a public transport route, send a request with the following parameters:

  • "transport": "public_transport" - transportation type: public transport.

  • "public_transport_params" - public transport parameters:

    • "transport" - an array of public transport types. For example, bus and trolleybus. For the full list of public transport types, see the public_transport_params parameter description in the API Reference.
    • "enable_schedule" - enables considering public transport schedule when building the route.
{
"points": [...],
"transport": "public_transport", // public transport route
"start_time": "2025-10-23T14:00:00Z",
"public_transport_params": {
"transport": [
"bus",
"trolleybus"
],
"enable_schedule": true
}
}

By truck

To build a truck route, specify the transport parameter with the value truck:

{
"points": [...],
"transport": "truck" // cargo transport
}

By motorcycle

To build a motorcycle route, specify the transport parameter with the value motorcycle:

{
"points": [...],
"transport": "motorcycle" // motorcycle route
}

By bicycle

To build a bicycle route, specify the transport parameter with the value bicycle:

{
"points": [...],
"transport": "bicycle" // bicycle route
}

By scooter

To build a scooter route, specify the transport parameter with the value scooter:

{
"points": [...],
"transport": "scooter" // scooter route
}

On foot

To build a pedestrian route, specify the transport parameter with the value walking:

{
"points": [...],
"transport": "walking" // pedestrian route
}

Special features

Speed limit

By default, routes are built considering the speed limits set by the driving regulations. You can set a speed value, which the vehicle must not exceed on any road part.

For example, the speed limits set by the driving regulations for trucks are 80 km/h on highways and 40 km/h in residential areas. If you set the 75 km/h speed limit, the route time is calculated for the following speeds: no more than 75 km/h on highways and no more than 40 km/h in residential areas.

To set a limit, specify the speed limit in km/h in the vehicle_speed_limit field:

{
"points": [...],
"transport": "truck",
"vehicle_speed_limit": 75
}

Public transport lanes

You can also include public transport lanes when building a car route, which can be useful for taxi and bus routes. To do this, specify the transport parameter with the value taxi in the request:

{
"points": [...],
"transport": "taxi", // car route including public transport lanes
"type": "shortest" // shortest in distance
}

Avoiding areas and road types

When building a route, you can exclude certain types of roads, such as toll roads or dirt roads, using the filters parameter, and exclude specific areas using the exclude parameter. For more information on using these parameters, see the corresponding sections of Routing API.

Route altitude

To get the altitude information for a pedestrian or bicycle route in the response, specify the need_altitudes parameter with the value true in the request:

{
"points": [...],
"transport": "walking", //or "transport": "bicycle"
"need_altitudes": true
}

Response example with the information on a route altitude:

{
"routes": [
{
...
"altitudes_info": {
"elevation_gain": 0,
"elevation_loss": 0,
"max_altitude": 0,
"min_altitude": 0,
"max_road_angle": 0
}
},
...
]
}

Where:

  • elevation_gain - total elevation gain in cm.
  • elevation_loss - total elevation loss in cm.
  • max_altitude - maximum height above mean sea level in cm.
  • min_altitude - minimum height above mean sea level in cm.
  • max_road_angle - maximum tilt angle.