Multiple courier routing

  1. Step 1. Send a request to build a route
  2. Step 2. Get the processing result

A request to this resource distributes orders between the couriers based on the number of vehicles. After the orders are distributed, the optimal delivery route is built.

Step 1. Send a request to build a route

Request:

curl -X POST "https://courier.yandex.ru/vrs/api/v1/add/mvrp?apikey=<your API key>" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"depot\":{\"id\":0,\"point\":{\"lat\":55.734157,\"lon\":37.589346},\"time_window\":\"07:00-18:00\"},\"vehicles\":[{\"id\":1}],\"locations\":[{\"id\":1,\"point\":{\"lat\":55.708272,\"lon\":37.46826},\"time_window\":\"07:00-18:00\"}],\"options\":{\"time_zone\":3,\"quality\":\"normal\"}}"
Copied to clipboard

The request must contain the API key you obtained. If you don't have a key, submit a connection request.

Response:

The server response contains information about the request processing status.

{  
   "id":"f74a0efc-f9a1-4643-b834-9769fabaee7b",
   "status":{  
      "queued":1534160155.189995
   },
   "message":"Task queued"
}
Copied to clipboard

Save the resulting ID to use it in the next step.

Information about the request body is available on the service page.

Step 2. Get the processing result

You can obtain the built route by sending a GET request to the service.

Request:

curl -X GET "https://courier.yandex.ru/vrs/api/v1/result/mvrp/task_ID"
Copied to clipboard

Response:

If the route was built, the response will contain information about the route. Otherwise, the response will contain information about the request processing status.

Contact support