Для авторизации ключ API указывается в качестве значения параметра Api-Key заголовка запроса.
Ограничения устанавливаются для ключа: максимальное количество запросов в минуту, в день. Для построения одного маршрута можно указать до 100 точек.
Сервисы TSP API, DistanceMatrixAPI, IsochronesAP пока доступны только для карты Российской Федерации.
Для создания задачи на построение маршрута нужно отправить POST-запрос /calculateTSP.
URL: https://webmapapi.navitel.ru/api/v1/calculateTSP/
Координаты точек маршрута и другие параметры передаются в виде JSON в теле запроса.
| Параметр | Описание | Обязательно/ Опционально | Тип данных | Формат данных |
| language_id | Идентификатор языка в формате языкового тега из списка BCP 47. Ответ на запрос представлен на указанном языке. Если в карте, по которой строится маршрут, отсутствует указанный язык, то ответ будет представлен на английском языке. Возможные варианты: ar_SA – арабский (Саудовская Аравия), cs_CZ – чешский (Республика Чехия), da_DK – датский (Дания), de_DE – немецкий (Германия), el_GR – греческий (Греция), en_US – английский (США), en_AU – английский (Австралия), en_GB – английский (Великобритания), en_IE – английский (Ирландия), en_ZA – английский (Южная Африка), es_ES – испанский (Испания), es_MX – испанский (Мексика), fi_FI – финский (Финляндия), fr_FR – французский (Франция), fr_CA – французский (Канада), he_IL – иврит (Израиль), hi_IN – хинди (Индия), hu_HU – венгерский (Венгрия), id_ID – индонезийский (Индонезия), it_IT – итальянский (Италия), ja_JP – японский (Япония), ko_KR – корейский (Республика Корея), nl_BE – нидерландский (Бельгия), nl_NL – нидерландский (Нидерланды), no_NO – норвежский (Норвегия), pl_PL – польский (Польша), pt_PT – португальский (Португалия), pt_BR – португальский (Бразилия), ro_RO – румынский (Румыния), ru_RU – русский (Россия), sk_SK – словацкий (Словакия), sv_SE – шведский (Швеция), th_TH – тайский (Таиланд), tr_TR – турецкий (Турция), zh_CN – китайский (КНР), zh_HK – китайский (Гонконг), zh_TW – китайский (Тайвань) | required | string enum: [ar_SA, cs_CZ, da_DK, de_DE, el_GR, en_US, en_AU, en_GB, en_IE, en_ZA, es_ES, es_MX, fi_FI, fr_FR, fr_CA, he_IL, hi_IN, hu_HU, id_ID, it_IT, ja_JP, ko_KR, nl_BE, nl_NL, no_NO, pl_PL, pt_PT, pt_BR, ro_RO, ru_RU, sk_SK, sv_SE, th_TH, tr_TR, zh_CN, zh_HK, zh_TW] | |
| vehicle_type | Виды используемых транспортных средств. Возможные варианты: • car – машина, • truck – самосвал, • heavy_truck – фура, • van – фургон, • bicycle – велосипед, • pedestrian – пешеход | required | string enum: [car, truck, heavy_truck, van, bicycle, pedestrian] | |
| start_point | Начальная (стартовая) точка маршрута | required | object {TspStartPoint} – см. раздел Типы данных для TSP API | |
| via_points | Точки посещения на маршруте | optional | array [TspViaPoint] – см. раздел Типы данных для TSP API | |
| finish_point | Конечная (финишная) точка маршрута | required | object {TspFinish-Point} – см. раздел Типы данных для TSP API | |
| mz_pass | Наличие у водителей грузовых транспортных средств пропусков в зоны Московской кольцевой автомобильной дороги (МКАД), Третьего транспортного кольца (ТТК), Садового кольца (СК) | optional | object {MzPass} – см. Типы данных ниже | |
| jams | Учитывать ли при построении маршрута информацию о текущих дорожных пробках. Значение по умолчанию: false | optional | boolean | |
| optimization | Тип оптимизации маршрута: по времени: fastest – самый быстрый; по расстоянию: shortest – кратчайший. Значение по умолчанию: fastest | optional | string enum: [fastest, shortest] |
| Код ответа | Параметр | Тип данных | Описание |
| 200 | route | object {TspRoute} – см. раздел Типы данных для TSP API | Построенный маршрут между указанными точками |
| 400 | code | string enum: [bad_points, no_route, too_many_points, invalid_time] | Неверный запрос Возможные варианты code: • bad_points – точки находятся за пределами карты, • no_route – маршрут не может быть построен, • too_many_points – количество точек превышает допустимое значение, • invalid_time – неверное время отправления |
| 400 | message | string | Неверный запрос Возможные варианты code: • bad_points – точки находятся за пределами карты, • no_route – маршрут не может быть построен, • too_many_points – количество точек превышает допустимое значение, • invalid_time – неверное время отправления |
| 401 | Ключ API отсутствует или недействителен | ||
| 403 | Истёк срок действия ключа API, превышены пределы поиска | ||
| 500 | Внутренняя ошибка сервера |
Сoordinates – координаты точки
| Параметр | Описание | Обязательно/ Опционально | Тип данных | Формат данных |
| longitude | Долгота | required | number | double |
| latitude | Широта | required | number | double |
TspStartPoint – начальная (стартовая) точка
| Параметр | Описание | Обязательно/ Опционально | Тип данных | Формат данных |
| coordinates | Координаты начальной (стартовой) точки маршрута | required | object {Coordinates} | |
| departure_time | Время отправления со стартовой точки маршрута | optional | string | date-time |
TspViaPoint – точка посещения
| Параметр | Описание | Обязательно/ Опционально | Тип данных | Формат данных |
| coordinates | Координаты точки посещения на маршруте | required | object {Сoordinates} | |
| waiting_time | Время ожидания в точке посещения, в секундах | optional | integer | int32 |
TspFinishPoint – конечная (финишная) точка
| Параметр | Описание | Обязательно/ Опционально | Тип данных | Формат данных |
| coordinates | Координаты конечной (финишной) точки маршрута | required | object {Сoordinates} |
TspRoute – маршрут в рамках решения задачи коммивояжёра
| Параметр | Описание | Обязательно/ Опционально | Тип данных | Формат данных |
| points | Точки маршрута | optional | array [TspRoutePoint] | |
| via_points | Точки посещения | optional | array [TspRouteViaPoint] | |
| streets | Характеристики улиц, по которым проходит маршрут | optional | array [TspStreetInfo] | |
| maneuvers | Характеристики маневров маршрута | optional | array [TspManeuver-Info] |
TspRoutePoint – точка маршрута
| Параметр | Описание | Обязательно/ Опционально | Тип данных | Формат данных |
| coordinates | Координаты точки маршрута | required | object {coordinates} | |
| h_level | 3D-уровень дороги | optional | integer | int32 |
| street_index | Индекс улицы | optional | integer | int32 |
| maneuver_index | Индекс маневра | optional | Integer -1 == no | int32 |
| distance_to_finish | Дистанция (расстояние) до финиша | optional | integer | int32 |
| distance_from_start | Дистанция (расстояние) от начала маршрута | optional | integer | int32 |
| distance_to_via | Дистанция до ближайшей точки посещения маршрута | optional | integer | int32 |
| jam_level | Уровень загруженности дорог | optional | Integer [0-32], 0 – blocked, 32 – free | int32 |
TspRouteViaPoint – точка посещения на маршруте
| Параметр | Описание | Обязательно/ Опционально | Тип данных | Формат данных |
| via_index | Индекс точки посещения на маршруте | optional | integer (index in CalculateTspRe-quest.via_points) | int32 |
| arrival_time | Время прибытия | optional | integer | int32 |
| segment_time | Время прохождения сегмента маршрута, в секундах | optional | integer | int32 |
| segment_length | Длина сегмента маршрута, в метрах | optional | integer | int32 |
| point_index | Индекс точки маршрута | optional | integer | int32 |
TspStreetInfo – информация об улице
| Параметр | Описание | Обязательно/ Опционально | Тип данных | Формат данных |
| speed_limit_kph | Ограничение скорости, км/ч | optional | integer | int32 |
| actual_speed_kph | Текущая скорость, км/ч | optional | integer | int32 |
| street | Название улицы | optional | string | |
| city | Название города | optional | string | |
| ramp | Съезд | optional | boolean | |
| tunnel | Тоннель | optional | boolean | |
| roundabout | Кольцевое движение | optional | boolean | |
| highway_road | Автомагистраль | optional | boolean | |
| unpaved_road | Грунтовая дорога | optional | boolean | |
| toll_road | Платная дорога | optional | boolean | |
| ferry | Паром | optional | boolean | |
| no_through | Запрет транзитного проезда | optional | boolean | |
| road_class | Тип и класс дороги. Возможные значения (класс и тип дороги): • класс 0: аллея, тропа; переулок, внутриквартальный проезд; паром; грунтовая дорога; улучшенная грунтовая дорога; улица малая; • класс 1: улица крупная; круговое движение; • класс 2: городская магистраль; прочие загородные дороги; • класс 3: шоссе основное; • класс 4: соединительное шоссе; автомагистрали | optional | integer | int32 |
| lanes_count | Количество полос на дороге | optional | integer | int32 |
TSPManeuverInfo – информация о маневрах
| Параметр | Описание | Обязательно/ Опционально | Тип данных | Формат данных |
| type | Тип маневра. Возможные значения: • keep_left – держитесь левее; • keep_right – держитесь правее; • left – поверните налево; • right – поверните направо; • sharp_left – крутой поворот налево; • sharp_right – крутой поворот направо; • to_roundabout – круговое движение; • u_turn_right – разворот направо; • u_turn_left – разворот налево | optional | string enum: [keep_left, keep_right, left, right, sharp_left, sharp_right, to_roundabout, u_turn_right, u_turn_left] | string |
| coordinates | Координаты перекрестка | optional | object {Coordinates} | |
| next_angle | Угол поворота | optional | integer | int32 |
| point_index | Индекс точки | optional | integer | int32 |
| other_angles | Другие углы дорог перекрёстка | optional | integer | int64 |
| to_ramp | На развязку | optional | boolean | |
| tunnel | Тоннель | optional | boolean | |
| to_roundabout | К кольцу | optional | boolean | |
| on_roundabout | На кольце | optional | boolean | |
| from_roundabout | С кольца | optional | boolean | |
| bifurcation | Развилка | optional | boolean | |
| cross_road | Перекрёсток | optional | boolean | |
| street_changed | Изменение улицы | optional | boolean | |
| uturn | Разворот | optional | boolean |
TSPManeuverInfo – информация о маневрах
| Параметр | Описание | Обязательно/ Опционально | Тип данных | Формат данных |
| keep_left | Держитесь левее | optional | string | |
| keep_right | Держитесь правее | optional | string | |
| left | Поворот налево | optional | string | |
| right | Поворот направо | optional | string | |
| sharp_left | Резкий поворот налево | optional | string | |
| sharp_right | Резкий поворот направо | optional | string | |
| to_roundabout | К кольцу | optional | string | |
| u_turn_right | Разворот направо | optional | string | |
| u_turn_left | Разворот налево | optional | string |
MzPass – наличие пропуска в зоны МКАД, ТТК, СК
| Параметр | Описание | Обязательно/ Опционально | Тип данных | Формат данных |
| mkad | Наличие пропуска в зону Московской кольцевой автодороги (МКАД). Значение по умолчанию: false | optional | boolean | |
| ttk | Наличие пропуска в зону Третьего транпортного кольца (ТТК). Значение по умолчанию: false | optional | boolean | |
| sk | Наличие пропуска в зону Садового кольца (СК). Значение по умолчанию: false | optional | boolean |
Запрос
Тело ответа
The service is aimed at solving the Travelling Salesman Problem (TSP): it allows you to build a route to visit specified points, the shortest in time or distance.
When calculating the route, statistical information on traffic jams is taken into account – for each route segment between two visiting points, from the moment the vehicle enters the segment.
For authorization, the API key is specified as the value of the Api-Key parameter of the request header.
Limits are set for the key: the maximum number of requests per minute, per day. To build one route, you can specify up to 100 points.
TSP API, DistanceMatrixAPI, IsochronesAP services are currently available only for the Russian Federation.
To create a task to build a route, you need to send a POST request /calculateTSP.
URL: https://webmapapi.navitel.ru/api/v1/calculateTSP/
Waypoint coordinates and other parameters are sent as JSON in the request body.
| Parameter | Description | Required/ Optional | Data type | Data Format |
| language_id | Language ID in language tag format from the BCP 47 list. The response to the request is presented in the specified language. If the map on which the route is being built does not contain the specified language, then the answer will be presented in English. Possible options: ar_SA — Arabic (Saudi Arabia), cs_CZ — Czech (Czech Republic), da_DK — Danish (Denmark), de_DE — German (Germany), el_GR — Greek (Greece), en_US — English (USA), en_AU — English (Australia), en_GB — English (UK), en_IE — English (Ireland), en_ZA — English (South Africa), es_ES — Spanish (Spain), es_MX — Spanish (Mexico), fi_FI — Finnish (Finland), fr_FR — French (France), fr_CA — French (Canada), he_IL — Hebrew (Israel), hi_IN — Hindi (India), hu_HU — Hungarian (Hungary), id_ID — Indonesian (Indonesia), it_IT — Italian (Italy), ja_JP — Japanese (Japan), ko_KR — Korean (South Korea), nl_BE — Dutch (Belgium), nl_NL — Dutch (Netherlands), no_NO — Norwegian (Norway), pl_PL — Polish (Poland), pt_PT — Portuguese (Portugal), pt_BR — Portuguese (Brazil), ro_RO — Romanian (Romania), ru_RU — Russian (Russia), sk_SK — Slovak (Slovakia), sv_SE — Swedish (Sweden), th_TH — Thai (Thailand), tr_TR — Turkish (Turkey), zh_CN — Chinese (China), zh_HK — Chinese (Hong Kong), zh_TW — Chinese (Taiwan). | required | string enum: [ar_SA, cs_CZ, da_DK, de_DE, el_GR, en_US, en_AU, en_GB, en_IE, en_ZA, es_ES, es_MX, fi_FI, fr_FR, fr_CA, he_IL, hi_IN, hu_HU, id_ID, it_IT, ja_JP, ko_KR, nl_BE, nl_NL, no_NO, pl_PL, pt_PT, pt_BR, ro_RO, ru_RU, sk_SK, sv_SE, th_TH, tr_TR, zh_CN, zh_HK, zh_TW] | |
| vehicle_type | Types of vehicles used. Possible options:
| required | string enum: [car, truck, heavy_truck, van] | |
| start_point | Initial (starting) point of the route | required | object {TspStartPoint} — see Data types for TSP API | |
| via_points | Points of visit along the route | optional | array [TspViaPoint] — see Data types for TSP API | |
| finish_point | The final (finishing) point of the route | required | object {TspFinishPoint} — see Data types for TSP API | |
| mz_pass | Drivers of freight vehicles must have passes to the Moscow Ring Road (MKAD), Third Transport Ring (TTK), and Garden Ring (GR) zones | optional | object {MzPass} – see Data types below | |
| jams | To take into account or not when planning a route information about current traffic jams. Default value: false | optional | boolean | |
| optimization | Type of route optimization:
| optional | string enum: [fastest, shortest] |
| Response Code | Parameter | Data type | Description |
| 200 | route | object {TspRoute} — see Data types for TSP API | Constructed route between specified points |
| 400 | code | string enum: [bad_points, no_route, too_many_points, invalid_time] | Invalid request Possible code options: • bad_points — the points are outside the map, • no_route — the route cannot be created, • too_many_points — the number of points exceeds the allowed value, • invalid_time — incorrect departure time |
| 400 | message | string | Invalid request Possible code options: • bad_points — the points are outside the map, • no_route — the route cannot be created, • too_many_points — the number of points exceeds the allowed value, • invalid_time — incorrect departure time |
| 401 | The API key is missing or invalid | ||
| 403 | API key has expired and search limits have been exceeded | ||
| 500 | Internal server error |
Сoordinates – point coordinates
| Parameter | Description | Required/ Optional | Data type | Data Format |
| longitude | Longitude | required | number | double |
| latitude | Latitude | required | number | double |
TspStartPoint – initial (starting) point
| Parameter | Description | Required/ Optional | Data type | Data Format |
| coordinates | Coordinates of the initial (starting) point of the route | required | object {Coordinates} | |
| departure_time | Departure time from the starting point of the route | optional | string | date-time |
TspViaPoint – visiting point
| Parameter | Description | Required/ Optional | Data type | Data Format |
| coordinates | Coordinates of the visiting point on the route | required | object {Coordinates} | |
| waiting_time | Waiting time at the visiting point, in seconds | optional | integer | int32 |
TspFinishPoint — final (finish) point
| Parameter | Description | Required/ Optional | Data type | Data Format |
| coordinates | Coordinates of the final (finish) point of the route | required | object {Coordinates} |
TspRoute – route within the framework of solving the Traveling Salesman Problem
| Parameter | Description | Required/ Optional | Data type | Data Format |
| points | Waypoints | optional | array [TspRoutePoint] | |
| via_points | Visiting points | optional | array [TspRouteViaPoint] | |
| streets | Characteristics of the streets along which the route passes | optional | array [TspStreetInfo] | |
| maneuvers | Characteristics of route maneuvers | optional | array [TspManeuverInfo] |
TspRoutePoint – waypoint
| Parameter | Description | Required/ Optional | Data type | Data Format |
| coordinates | Waypoint coordinates | required | object {Coordinates} | |
| h_level | 3D road level | optional | integer | int32 |
| street_index | Street index | optional | integer | int32 |
| maneuver_index | Maneuver index | optional | Integer -1 == no | int32 |
| distance_to_finish | Distance to finish | optional | integer | int32 |
| distance_from_start | Distance from the start of the route | optional | integer | int32 |
| distance_to_via | Distance to the nearest visiting point on the route | optional | integer | int32 |
| jam_level | Road congestion level | optional | Integer [0-32], 0 – blocked, 32 – free | int32 |
TspRouteViaPoint — visiting point on the route
| Parameter | Description | Required/ Optional | Data type | Data Format |
| via_index | Index of the visiting point on the route | optional | integer | int32 |
| arrival_time | Arrival time | optional | integer | int32 |
| segment_time | Time to cover a route segment, in seconds | optional | integer | int32 |
| segment_length | The length of the route segment, in meters | optional | integer | int32 |
| point_index | The index of the route point | optional | integer | int32 |
TspStreetInfo — information about the street
| Parameter | Description | Required/ Optional | Data type | Data Format |
| speed_limit_kph | Speed limit, kmph | optional | integer | int32 |
| actual_speed_kph | Current speed, kmph | optional | integer | int32 |
| street | Street name | optional | string | |
| city | City name | optional | string | |
| ramp | Ramp | optional | boolean | |
| tunnel | Tunnel | optional | boolean | |
| roundabout | Roundabout | optional | boolean | |
| highway_road | Highway | optional | boolean | |
| unpaved_road | Unpaved road | optional | boolean | |
| toll_road | Toll road | optional | boolean | |
| ferry | Ferryboat | optional | boolean | |
| no_through | Transit ban | optional | boolean | |
| road_class | Road type and class. Possible values (road class and type):
| optional | integer | int32 |
| lanes_count | Number of lanes on the road | optional | integer | int32 |
TSPManeuverInfo – information about maneuvers
| Parameter | Description | Required/ Optional | Data type | Data Format |
| type | Maneuver type. Possible options: • keep left; • keep right; • left; • right; • sharp left; • sharp right; • to rounda-bout; • U-turn right; • U-turn left | optional | string enum: [keep_left, keep_right, left, right, sharp_left, sharp_right, to_roundabout, u_turn_right, u_turn_left] | string |
| coordinates | Intersection coordinates | optional | object {Coordinates} | |
| next_angle | Angle of rotation | optional | integer | int32 |
| point_index | Point index | optional | integer | int32 |
| other_angles | Other angles of the intersection roads | optional | integer | int64 |
| to_ramp | To the ramp | optional | boolean | |
| tunnel | Tunnel | optional | boolean | |
| to_roundabout | To the roundabout | optional | boolean | |
| on_roundabout | On the roundabout | optional | boolean | |
| from_roundabout | From the roundabout | optional | boolean | |
| bifurcation | Bifurcation | optional | boolean | |
| cross_road | Crossroad | optional | boolean | |
| street_changed | Changing the street | optional | boolean | |
| uturn | U-turn | optional | boolean |
TSPManeuverType — types of maneuvers
| Parameter | Description | Required/ Optional | Data type | Data Format |
| keep_left | Keep left | optional | string | |
| keep_right | Keep right | optional | string | |
| left | Turn left | optional | string | |
| right | Turn right | optional | string | |
| sharp_left | Sharp left turn | optional | string | |
| sharp_right | Sharp right turn | optional | string | |
| to_roundabout | To the roundabout | optional | string | |
| u_turn_right | U-turn to the right | optional | string | |
| u_turn_left | U-turn to the left | optional | string |
MzPass – availability of a pass to the MKAD, TTK, SK zones
| Parameter | Description | Required/ Optional | Data type | Data format |
|---|---|---|---|---|
| mkad | Availability of a pass to the Moscow Ring Road (MKAD) zone. Default value: false | optional | boolean | |
| ttk | Availability of a pass to the Third Transport Ring (TTK) zone. Default value: false | optional | boolean | |
| sk | Availability of a pass to the Garden Ring (GR) zone. Default value: false | optional | boolean |
Request
Response body: