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": "realtime",
"route": {
"legs": [
{
"status": "OK",
"steps": [
{
"duration": 11.52513027,
"length": 44.85900116,
"polyline": {
"points": [
[25.229762, 55.289311],
...
[24.994437, 55.130251]
]
},
"feature_class": "road.8",
"mode": "driving",
"waiting_duration": 0
},
{
"duration": 206.4788513,
"length": 1116.158936,
"polyline": {
"points": [
[25.229762, 55.289311],
...
[24.994437, 55.130251]
]
},
"feature_class": "road.7",
"mode": "driving",
"waiting_duration": 0
},
{
"duration": 1143.630005,
"length": 6356.562988,
"polyline": {
"points": [
[25.229762, 55.289311],
...
[24.994437, 55.130251]
]
},
"feature_class": "road.4",
"mode": "driving",
"waiting_duration": 0
},
{
"duration": 239.3830109,
"length": 524.8220825,
"polyline": {
"points": [
[25.229762, 55.289311],
...
[24.994437, 55.130251]
]
},
"feature_class": "road.7",
"mode": "driving",
"waiting_duration": 0
}
]
}
],
"flags": {
"hasTolls": true,
"hasNonTransactionalTolls": false
}
}
}
Response params
traffic
-
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.
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.
feature_class
-
Class of the road section the route segment is built on. Possible values:
-
road.{integer}
— Road section passed by car or by foot.The number indicates the road class in the range from 1 to 7.Possible road classes- 1: Freeways.
- 2: National highways.
- 3: Interregional roads or major streets through a city.
- 4: Regional roads or roads that link parts of a city.
- 5: Local roads.
- 6: Roads of minimal significance (such as driveways).
- 7: Roads unsuitable for vehicles.
Warning
Information about road classes is no longer supported and will soon be removed from the API response.
-
transit.bus
— Road section to be passed by bus. Only possible when usingmode=transit
. -
transit.subway
— Road section to be passed by metro. Only possible when usingmode=transit
.
-
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"]}