Skip to main content

Routing API

OpenAPI Specification

2GIS Navigation API (6.0.0)

Route by car

Building a route by car and on foot

Building a route of multiple points for different types of transport.

query Parameters
key
required
string

Developer API key

Request Body schema: */*
required

Request parameters

One of
required
Array of objects (RequestPoint)
RouteMode (string) or null
TrafficMode (string) or null
TransportType (string) or null
OutputType (string) or null
integer or null <long>

Date and time for which the route is calculated. Specified as Unix time. If not specified, the date and time of sending a request is used.

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

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

Array of objects (ExcludeObject)

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

Locale (string) or null
Params (object) or null
integer or null
Default: 1

Number of alternative routes to be built in addition to the main route

boolean or null

If true, altitude information will be included in the response.

Responses

Response Schema: application/json
One of
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,

required
object (RoutingRequestModel)

Routing API query.

type
required
string (ResponseType)
Enum: "result" "error"

Response type:

  • result - Success result,
  • error - Error,

string or null

Error message

Array of ResultItem (objects) or null

Response samples

Content type
application/json
Example
{
  • "status": "OK",
  • "query": {
    • "exclude": [
      ],
    • "locale": "ru",
    • "need_altitudes": true,
    • "points": [
      ],
    • "route_mode": "fastest",
    • "traffic_mode": "jam",
    • "transport": "driving"
    },
  • "type": "result",
  • "message": "string",
  • "result": [
    • {
      }
    ]
}