Response format
The API response contains the route divided into segments. Each segment consists of several steps displayed as polylines. Information about the road quality and estimated time of travel is provided for each segment.
https://router.api.mappable.world/v2/?waypoints=55.280222457968712,25.234369457896325|55.401544758961258,25.234369457896325&apikey=YOUR_API_KEY
In this case, the response will look like this:
{
"traffic_type": "realtime",
"route": {
"legs": [
{
"status": "OK",
"steps": [
{
"duration": 11.52513027,
"length": 44.85900116,
"polyline": {
"points": [
[25.229762, 55.289311],
...
[24.994437, 55.130251]
]
},
"mode": "driving",
"waiting_duration": 0
},
{
"duration": 206.4788513,
"length": 1116.158936,
"polyline": {
"points": [
[25.229762, 55.289311],
...
[24.994437, 55.130251]
]
},
"mode": "driving",
"waiting_duration": 0
},
{
"duration": 1143.630005,
"length": 6356.562988,
"polyline": {
"points": [
[25.229762, 55.289311],
...
[24.994437, 55.130251]
]
},
"mode": "driving",
"waiting_duration": 0
},
{
"duration": 239.3830109,
"length": 524.8220825,
"polyline": {
"points": [
[25.229762, 55.289311],
...
[24.994437, 55.130251]
]
},
"mode": "driving",
"waiting_duration": 0
}
]
}
],
"flags": {
"hasTolls": true,
"hasNonTransactionalTolls": false
}
}
}
Response params
traffic_type
-
Type of information about traffic used when building the route. Possible values:
realtime
: Uses information about traffic at the time of the request.forecast
: Uses the traffic forecast for the next hour.disabled
: Does not use any traffic information.
route
-
Information about the built route.
legs
-
Route segments between the points specified in the
waypoints
parameter.status
-
Route building status. Possible values:
OK
,FAIL
steps
-
Steps to complete the route segment.
length
-
Step length in meters.
duration
-
Time required to complete the step in seconds.
waiting_duration
-
Information about the waiting time is no longer supported and will soon be removed from the API response. Waiting time without moving at a route segment. For example, the delay time required to wait for a drawbridge to be closed.
mode
-
Routing mode. Possible values:
driving
: Passenger car route. Used by default.truck
: Truck route.walking
: Walking route.transit
: Public transit route.bicycle
: Bicycle route.scooter
: Electric scooter route.
polyline
-
Polyline making up a route.
points
- Points that make up a line. Specified in decimal degrees (WGS84 standard). Each point is defined as a coordinate pair in the format:
<longitude,latitude>
flags
-
Additional information about the built route.
hasTolls
- Indicates if the route includes toll roads.
hasNonTransactionalTolls
- Indicates if the route includes toll roads that are conditionally toll-free.
Error messages
Code | Description |
---|---|
400 | One or more required parameters are missing in the request. |
401 | The request doesn't contain the apikey parameter or an invalid key was specified. |
429 | Too many requests. |
500 or 504 | System server error. Repeat the request later. |
If an error occurs while processing a request, API returns a message with the error description in the errors
field:
{"errors": ["0: 0: parameter 'waypoints' is missing"]}
{"errors": ["Key not found"]}
{"errors": ["parameter 'apikey' is missing"]}
{"errors": ["Counter total limit exceeded. Limit: XXX, current value: YYY"]}