Setting routes for the day

Before the start of the working day, the delivery company should upload information about routes and orders to the Delivery database. The generated route is automatically sent to the Yandex.Courier app. The order of delivery addresses in the route is automatically optimized using data about delivery times and the traffic forecast.

Note. Use your company ID to access the Track & Trace API. If you don't have an ID, contact us.
  1. Building routes
  2. Adding orders to the database
  3. Checking uploaded data

Building routes

In the API, routes are assigned to courier on a specific date.

Request

cURL

curl -H "Content-Type: application/json" -H "Authorization: Auth your token" -X POST -d @<File_path_in_UTF-8_encoding> https://courier.yandex.ru/api/v1/companies/your-company-id/routes-batch
Copied to clipboard

File

[{"courier_number":"222", "number":"23423-2000", "date": "2017-08-08", "depot_number":"111"}, {"courier_number":"224", "number":"23423-2001", "date": "2017-08-08", "depot_number":"112"}]

Result:

{
  "inserted": 2,
  "updated": 0
}

Adding orders to the database

Orders in the API are assigned to a route. Route orders are arranged in the order they were added. If necessary, you can change the order by sending a request to the orders-sequence resource.

Request

cURL

curl -H "Content-Type: application/json" -H "Authorization: Auth your-token" -X POST -d @<File_path_in_UTF-8_encoding> https://courier.yandex.ru/api/v1/companies/{your-company-id}/orders-batch
Copied to clipboard

File

[{"number":"222239", "route_number":"23423-2000", "address":"Ulitsa Lva Tolstogo 16", "lat": 55.7447, "lon": 37.6728, "customer_name": "Igor", "phone": "+712345678", "status":"new", "time_interval":"11-12"}, {"number":"222241", "route_number":"23423-2001", "address":"Ulitsa Lva Tolstogo 17", "lat": 55.7448, "lon": 37.6729, "customer_name": "Olga", "phone": "+712345679", "status":"new", "time_interval":"10:00 - 11:00"}]

Result:

{
  "inserted": 2,
  "updated": 0
}

Checking uploaded data

To see if the data was uploaded successfully, send a request to the verification resource. The server response contains information about all orders for the specified date. You can compare the information you receive with the information in the delivery company database.

curl -H "Authorization: Auth your-OAuth-token" -X GET https://courier.yandex.ru/api/v1/companies/your-company-id/verification?date=2018-01-01
Copied to clipboard

Result:

[
  {
    "order_id": "20170513-713",
    "time_interval": "12-23",
    "route_number": "23423-2000",
    "courier_id": "your-courier-number",
    "status": "finished",
    "phone": "+712345678",
    "address": "Ulitsa Lva Tolstogo 16",
    "lat": 55.7448,
    "lon": 37.6729
  },
  {
    "order_id": "20170513-329",
    "time_interval": "12-52",
    "route_number": "23423-2001",
    "courier_id": "8272",
    "status": "finished",
    "phone": "+712345679",
    "address": "Ulitsa Lva Tolstogo 17",
    "lat": 55.7448,
    "lon": 37.6729
  }
]

Contact support