Skip to content

Routing

Computes a route between two or more locations in the order provided. Accepts up to 150 locations per request.

POST https://dev-api.roadgis.dev/directions/v1
Authorization: Bearer YOUR_API_KEY
{
"profile": "auto",
"departureTime": "08:00",
"stopDuration": 120,
"locations": [
{
"latLng": {
"lat": 56.30294,
"lng": 22.34013
}
},
{
"id": "LT000000001",
"address_structured": {
"postcode": "87149",
"city": "Telšiai",
"street": "Luokės g. 82"
}
},
{
"id": "LT000000002",
"address_structured": {
"postcode": "89231",
"city": "Mažeikiai",
"street": "Gamyklos g.1, Mažeikiai 89231"
}
},
{
"id": "LT000000003",
"address_structured": {
"postcode": "90129",
"city": "Plungė",
"street": "V. Mačernio g. 61"
}
},
{
"id": "LT000000005",
"address_structured": {
"postcode": "90164",
"city": "Plungė",
"street": "Telšių g. 90"
}
},
{
"id": "LT000000006",
"address_structured": {
"postcode": "89200",
"city": "Mažeikiai",
"street": "Tvenkinių g. 37"
}
},
{
"id": "LT000000007",
"address_structured": {
"postcode": "89307",
"city": "Mazeikiai",
"street": "tylioji 22"
}
},
{
"id": "LT000000009",
"address_structured": {
"postcode": "89451",
"city": "Mazeikiu r.",
"street": "Kugiu km. Vitvariskes g. 17"
}
},
{
"latLng": {
"lat": 56.30294,
"lng": 22.34013
}
}
],
"routeModifiers": {
"excludeUnpaved": false,
"topSpeed": 80,
"shortest": false
},
"computeOptions": {
"steps": false
}
}
FieldTypeRequiredDescription
profilestringyesRouting profile: auto, truck, bicycle, pedestrian
locationsarrayyes2–150 locations. See Location Types
departureTimestringnoDeparture time in HH:MM. Enables arrivalTime on each waypoint
stopDurationintegernoSeconds spent at each intermediate stop. Default: 0
routeModifiersobjectnoSee below
computeOptionsobjectnoSee below
FieldTypeDefaultDescription
excludeUnpavedbooleanfalseAvoid unpaved roads
topSpeedintegerVehicle top speed in km/h (1–300). Affects travel time estimates
shortestbooleanfalsePrefer shortest distance over fastest time
FieldTypeDefaultDescription
stepsbooleanfalseInclude turn-by-turn maneuvers in each leg
{
"code": "Ok",
"waypoints": [
{
"id": null,
"originalIndex": 0,
"location": {
"lat": 56.30294,
"lng": 22.34013
},
"arrivalTime": "08:00"
},
{
"id": "LT000000001",
"originalIndex": 1,
"location": {
"lat": 55.973316,
"lng": 22.271395
},
"matchedAddress": "Luokės g. 82, LT-87149 Telšiai",
"relevance": 0.8833,
"arrivalTime": "08:41"
},
{
"id": "LT000000002",
"originalIndex": 2,
"location": {
"lat": 56.309669,
"lng": 22.339082
},
"matchedAddress": "Gamyklos g. 1, LT-89231 Mažeikiai",
"relevance": 0.4505,
"arrivalTime": "09:26"
},
{
"id": "LT000000003",
"originalIndex": 3,
"location": {
"lat": 55.909723,
"lng": 21.828937
},
"matchedAddress": "V. Mačernio g. 61, LT-90129 Plungė",
"relevance": 0.9091,
"arrivalTime": "10:18"
},
{
"id": "LT000000005",
"originalIndex": 4,
"location": {
"lat": 55.907568,
"lng": 21.868073
},
"matchedAddress": "Telšių g. 90, LT-90164 Plungė",
"relevance": 0.9091,
"arrivalTime": "10:25"
},
{
"id": "LT000000006",
"originalIndex": 5,
"location": {
"lat": 56.309431,
"lng": 22.286046
},
"matchedAddress": "Tvenkinių g. 37, LT-89200 Mažeikiai",
"relevance": 0.9077,
"arrivalTime": "11:19"
},
{
"id": "LT000000007",
"originalIndex": 6,
"location": {
"lat": 56.343105,
"lng": 22.330867
},
"matchedAddress": "Tylioji g. 22, LT-89307 Mažeikiai",
"relevance": 0.7846,
"arrivalTime": "11:29"
},
{
"id": "LT000000009",
"originalIndex": 7,
"location": {
"lat": 56.362109,
"lng": 22.107197
},
"matchedAddress": "Vitvariškės g. 17, LT-89451 Kugiai",
"relevance": 0.5558,
"arrivalTime": "12:00"
},
{
"id": null,
"originalIndex": 8,
"location": {
"lat": 56.30294,
"lng": 22.34013
},
"arrivalTime": "12:29"
}
],
"routes": [
{
"duration": 16163.405,
"distance": 278.782,
"legs": [
{
"duration": 2496.325,
"distance": 48.265,
"geometry": "wnmkjB..."
},
{
"duration": 2549.668,
"distance": 49.149,
"geometry": "{qjwiB..."
},
{
"duration": 3033.083,
"distance": 57.549,
"geometry": "ojzkjB..."
},
{
"duration": 286.13,
"distance": 3.156,
"geometry": "ybnsiB..."
},
{
"duration": 3110.439,
"distance": 61.426,
"geometry": "majsiB..."
},
{
"duration": 471.583,
"distance": 6.906,
"geometry": "{dzkjBc..."
},
{
"duration": 1742.15,
"distance": 27.406,
"geometry": "kd|mjB{..."
},
{
"duration": 1634.023,
"distance": 24.922,
"geometry": "yk`ojB_..."
}
]
}
]
}
FieldTypeDescription
idstring | nullEchoed from the input location
originalIndexintegerPosition in the caller’s input array
locationobjectSnapped coordinates { lat, lng }
matchedAddressstring | nullResolved address. Present for address and address_structured inputs, null for latLng
relevancenumber | nullGeocoding confidence score (0–1). Present alongside matchedAddress
arrivalTimestringEstimated arrival in HH:MM. Present only when departureTime is provided
FieldTypeDescription
durationnumberTotal trip duration in seconds, including stopDuration at each intermediate stop
distancenumberTotal trip distance in kilometres
legsarrayOne entry per segment between consecutive waypoints
FieldTypeDescription
durationnumberDriving time for this leg in seconds. Does not include stopDuration
distancenumberLeg distance in kilometres
geometrystringGoogle-encoded polyline
stepsarrayTurn-by-turn maneuvers. Present only when computeOptions.steps is true

When one or more addresses cannot be resolved above the confidence threshold, those locations are excluded from routing. The route is still computed for the remaining locations.

Excluded locations are returned in excluded_waypoints:

{
"code": "Ok",
"waypoints": [...],
"routes": [...],
"excluded_waypoints": [
{
"originalIndex": 2,
"id": "stop-2",
"input": "Nowhere St. 999, Vilnius",
"relevance": 0.08
}
]
}
FieldTypeDescription
originalIndexintegerPosition in the caller’s input array
idstring | nullEchoed from the input location
inputstringThe input address as provided
relevancenumberBest match score found — below the resolution threshold

If fewer than 2 locations remain after exclusions, the request returns 422 with code: GeocodingFailed and the full excluded_waypoints list.

CodeHTTPDescription
GeocodingFailed422Fewer than 2 locations could be geocoded
NoRoute422No route found between the locations
NoSegment422A location cannot be snapped to the road network
InvalidInput400Missing or invalid request parameters
Unauthorized401Missing or invalid API key
Forbidden403Account not verified
QuotaExceeded429Monthly quota reached
UpstreamError503Routing service unavailable