Skip to main content

Pairs Directions API

OpenAPI Specification

2GIS Navigation API (6.0.0)

Algorithms

Building multiple routes

Build multiple routes in a single call. Each route must consist of two points.

path Parameters
routing_type
required
string
Enum: "driving" "walking" "taxi" "bicycle" "motorcycle"

Routing type:

  • driving - car route
  • taxi - car route (including public transport lanes)
  • walking - pedestrian route
  • bicycle - bicycle route
  • motorcycle - motorcycle route
"

query Parameters
key
required
string

Developer API key

Request Body schema: */*
required

Request parameters

required
Array of objects (RequestPoints)

Array of routes. Can consist of up to 50 routes.

type
required
string (RequestType)
Enum: "jam" "statistics" "shortest"

Route type:

  • jam - shortest route in time using current traffic data,
  • statistics - shortest route in time using statistical traffic data,
  • shortest - shortest route in distance,

Array of RequestFilter (strings) or RequestFilter (string) or null
boolean or null

If true, the route may include driving on closed roads.

OutputType (string) or null
integer or null <long>

Date and time to use instead of the current date and time. Specified as Unix time.

Array of objects (ExcludeObject)

An array of areas to avoid when building a route. Not more than 25 areas.

Responses

Response Schema: application/json
Array
status
required
string (StatusType)
Enum: "OK" "FAIL" "POINT_EXCLUDED" "ROUTE_NOT_FOUND" "ROUTE_DOES_NOT_EXISTS" "ATTRACT_FAIL"

Request status:

  • OK - route was successfully calculated,
  • FAIL - an unknown error occurred when calculating the route,
  • POINT_EXCLUDED - one of the points was excluded by the excluded objects,
  • ROUTE_NOT_FOUND - the route could not be build on the current data of the road graph,
  • ROUTE_DOES_NOT_EXISTS - the route between points on the road graph doesn't exist,
  • ATTRACT_FAIL - an error occurred while attracting the points: one of the points is more than 10 km away from the road graph,

integer or null

Route length in meters.

integer or null

Estimated travel time in seconds.

lat1
required
number <double> >= 0

Latitude of the point of departure.

lon1
required
number <double> >= 0

Longitude of the point of departure.

lat2
required
number <double> >= 0

Longitude of the point of arrival.

lon2
required
number <double> >= 0

Longitude of the point.

number or null

Accuracy of the route as a number from 0 to 1 (if distance_direction was set).

boolean or null

If true, the route includes closed roads.

string or null

Error message

string or null

Route geometry in WKT format in case of full output. Empty string in case of simplified output.

Response samples

Content type
application/json
[
  • {
    • "distance": 10838,
    • "duration": 1505,
    • "lat1": 55.102268,
    • "lat2": 55.032594,
    • "lon1": 82.933328,
    • "lon2": 82.958722,
    • "status": "OK"
    },
  • {
    • "distance": 14586,
    • "duration": 1956,
    • "lat1": 55.079794,
    • "lat2": 54.981836,
    • "lon1": 82.92952,
    • "lon2": 82.907189,
    • "status": "OK"
    }
]