---
metadata:
  - name: generator
    content: Diplodoc Platform v5.19.6
alternate:
  - https://docs.routeq.com/doc/en/delivery/quickstart/start-work.md
  - https://docs.routeq.com/doc/tr/delivery/quickstart/start-work.md
title: RouteQ — API implementation procedure — setting routes for the day
---
> **Documentation Index:** Fetch the complete configuration index at https://docs.routeq.com/doc/en/llms.txt


# Setting routes for the day

{% note info "" %}

You can see the diagram showing the process of importing planning results to Track & Trace [here](https://doc-static.yandex.net/src/dev/routing/schema/import-to-track-and-trace-en.pdf).

{% endnote %}

At the beginning of each work day, the delivery company must upload information about routes and orders to the Track & Trace database. The generated route is automatically sent to the [Yandex Courier](https://play.google.com/store/apps/details?id=com.yandex.courier) app. The order sequence in the route is optimized based on delivery windows and the traffic forecast.

{% note info %}

{% include [warehouse-poluchenie-ID](../_includes/poluchenie-ID-64cccc844b69.md) %}

{% endnote %}


## Building routes {#route}

In the API, routes are assigned to couriers for a specific date.

Send a request to the [routes-batch](https://yandex.ru/routing/doc/en/delivery/redoc/index.html#operation/editsMultipleRoutes) resource. The request must contain information about the orders.

{% include [postman-collection](../_includes/postman-collection-c7a3adefee03.md) %}


{% note alert %}

The specification contains required fields for existing objects, but there are more fields for new objects. When you add new objects by sending a request to the `routes-batch` resource, fill in all of the fields that are required for the [routes](https://yandex.ru/routing/doc/en/delivery/redoc/index.html#operation/addsARoute) resource.

{% endnote %}


**Request:**

{% list tabs %}

- Windows

  cURL

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

  File

  ```json
  [
    {
      "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"
    }
  ]
  ```

- MacOS/Linux

  cURL

  ```html
  curl -H "Content-Type: application/json" -H "Authorization: OAuth <your-OAuth-token>" -X POST -d '[{"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"}]' https://courier.yandex.ru/api/v1/companies/<your-company-id>/routes-batch
  ```

{% endlist %}

**Result:**

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

## Adding orders to the database {#order}

Orders in the API are assigned to a route. Orders on the route are arranged in the order they were added. If necessary, you can change their sequence by sending a request to the [orders-sequence](https://yandex.ru/routing/doc/en/delivery/redoc/index.html#operation/setsTheOrderOfDeliveriesInTheRoute) resource.

Send a request to the [orders-batch](https://yandex.ru/routing/doc/en/delivery/redoc/index.html#operation/editsMultipleOrders) resource. The request must contain information about the orders.

{% note alert %}

The specification contains required fields for existing objects, but there are more fields for new objects. When you add new objects by sending a request to the `orders-batch` resource, fill in all of the fields that are required for the [orders](https://yandex.ru/routing/doc/en/delivery/redoc/index.html#operation/addsAnOrder) resource.

{% endnote %}


**Request:**

{% list tabs %}

- Windows

  cURL

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

  File

    

  ```json
  [
    {
      "number":"222239",
      "route_number":"23423-2000",
      "address":"476 5th Avenue",
      "lat": 73.9823,
      "lon": 40.7532,
      "customer_name": "Mark",
      "phone": "+15551234567",
      "status":"new",
      "time_interval":"11-12"
    },
    {
      "number":"222241",
      "route_number":"23423-2001",
      "address":"477 5th Avenue",
      "lat": 73.9824,
      "lon": 40.7533,
      "customer_name": "Sarah",
      "phone": "+15551234568",
      "status":"new",
      "time_interval":"10:00 - 11:00"
    }
  ]
  ```

    


- MacOS/Linux

  cURL

    

  ```html
  curl -H "Content-Type: application/json" -H "Authorization: OAuth <your-OAuth-token>" -X POST -d '[{"number":"222239", "route_number":"23423-2000", "address":"476 5th Avenue", "lat": 73.9823, "lon": 40.7532, "customer_name": "Mark", "phone": "+15551234567", "status":"new", "time_interval":"11-12"}, {"number":"222241", "route_number":"23423-2001", "address":"477 5th Avenue", "lat": 73.9824, "lon": 40.7533, "customer_name": "Sarah", "phone": "+15551234568", "status":"new", "time_interval":"10:00 - 11:00"}]' https://courier.yandex.ru/api/v1/companies/<your-company-id>/orders-batch
  ```

    


{% endlist %}

**Result:**

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


## Assigning orders to a depot or to another order {#related-orders}

To specify where an order needs to be picked up or delivered, assign that order to a depot or to another order by sending a request to the [nodes](https://yandex.ru/routing/doc/en/delivery/redoc/index.html#operation/setsRouteNodesAndTheirSequenceInTheRoute) resource. You can assign orders only using the API.

{% include [postman-collection](../_includes/postman-collection-c7a3adefee03.md) %}

Specify the orders to be assigned in the `value.related_orders` array.

The following assignment types are possible:

* `pickup` orders will be delivered to the depot. For the depot, specify `number` = <`pickup` order number> and `action` = `delivery`.
* `delivery` orders will be picked up from the depot (for delivery to the `drop_off` point). For the depot, specify `number` = <`delivery` order number> and `action` = `pickup`.
* `delivery` orders will be picked up from the `pickup` point. For the `pickup` order, specify `number` = <`delivery` order number> and `action` = `pickup`.
* `Pickup` orders will be delivered to the `drop-off` point. For the `drop_off` order, specify `number` = <`pickup` order number> and `action` = `delivery`.

{% note warning %}

You can only assign orders with the specified `pickup`, `delivery` or `drop_off` type.
  
{% endnote %}

**Request:**

{% list tabs %}

- Windows

  cURL

    

  ```html
  curl -H "Content-Type: application/json" -H "Authorization: OAuth <your-OAuth-token>" -X POST "https://courier.yandex.ru/api/v1/companies/<your-company-id>/routes/<route-id>/nodes" 
  ```

    

  File

    

  ```json
  [
    {
        "type": "depot",
        "value": {
            "number": "200",
            "related_orders": [
                {
                    "number": "20 2024-03-26",
                    "action": "pickup"
                }
            ]
        }
    },
    {
        "type": "depot",
        "value": {
            "number": "100",
            "related_orders": [
                {
                    "number": "19 2024-03-26",
                    "action": "pickup"
                }
            ]
        }
    },
    {
        "type": "order",
        "value": {
            "address": "United States, Huntington Station, East Jericho Turnpike, 901",
            "lat": 40.836506,
            "lon": -73.385683,
            "number": "19 2024-03-26",
            "time_interval": "08:00:00-23:00:00"
        }
    },
    {
        "type": "order",
        "value": {
            "address": "United States of America, Connecticut, Fairfield County, Bridgeport",
            "lat": 41.177449,
            "lon": -73.230018,
            "number": "20 2024-03-26",
            "time_interval": "08:00:00-23:00:00"
        }
    },
    {
        "type": "order",
        "value": {
            "address": "United States, Brooklyn, 1225 Broadway",
            "lat": 40.691776,
            "lon": -73.926379,
            "number": "21 2024-03-26",
            "time_interval": "08:00:00-23:00:00",
            "type": "pickup",
            "related_orders": [
                {
                    "number": "22 2024-03-26",
                    "action": "pickup"
                }
            ]
        }
    },
    {
        "type": "order",
        "value": {
            "address": "United States of America, New York, New York, Fort-Gamilton-Parkuey",
            "lat": 40.633057,
            "lon": -74.005327,
            "number": "22 2024-03-26",
            "time_interval": "08:00:00-23:00:00",
            "type": "delivery"
        }
    }
  ]
  ```

    


- MacOS/Linux

  cURL

    

  ```html
  curl -H "Content-Type: application/json" -H "Authorization: OAuth <your-OAuth-token>" -X POST -d '[{"type":"depot","value":{"number":"200","related_orders":[{"number":"20 2024-03-26","action":"pickup"}]}},{"type":"depot","value":{"number":"100","related_orders":[{"number":"19 2024-03-26","action":"pickup"}]}},{"type":"order","value":{"address":"United States, Huntington Station, East Jericho Turnpike, 901","lat":40.836506,"lon":-73.385683,"number":"19 2024-03-26","time_interval":"08:00:00-23:00:00"}},{"type":"order","value":{"address":"United States of America, Connecticut, Fairfield County, Bridgeport","lat":41.177449,"lon":-73.230018,"number":"20 2024-03-26","time_interval":"08:00:00-23:00:00"}},{"type":"order","value":{"address":"United States, Brooklyn, 1225 Broadway","lat":40.691776,"lon":-73.926379,"number":"21 2024-03-26","time_interval":"08:00:00-23:00:00","type":"pickup","related_orders":[{"number":"22 2024-03-26","action":"pickup"}]}},{"type":"order","value":{"address":"United States of America, New York, New York, Fort-Gamilton-Parkuey","lat":40.633057,"lon":-74.005327,"number":"22 2024-03-26","time_interval":"08:00:00-23:00:00","type":"delivery"}}]' "https://courier.yandex.ru/api/v1/companies/<your-company-id>/routes/<route-id>/nodes" 
  ```

    

{% endlist %}
 

**Result:**

```json
{}
```

To see current assignments of orders to depots and other orders, send a request to the [route-info](https://yandex.ru/routing/doc/en/delivery/redoc/index.html#operation/getsRouteInfo) resource.

## Verifying uploaded data {#checkdata}

To check if data was uploaded successfully, send a request to the [verification](https://yandex.ru/routing/doc/en/delivery/redoc/index.html#operation/getsOrderInformation) 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's database.

**Request:**

```html
curl -H "Authorization: OAuth <your-OAuth-token>" -X GET https://courier.yandex.ru/api/v1/companies/<your-company-id>/verification?date=2018-01-01
```

**Result:**

    

```json
[
  {
    "order_id": "20170513-713",
    "time_interval": "12-23",
    "route_number": "23423-2000",
    "courier_id": "your-courier-number",
    "status": "finished",
    "phone": "+155512345678",
    "address":"476 5th Avenue",
    "lat": 73.9823,
    "lon": 40.7532
  },
  {
    "order_id": "20170513-329",
    "time_interval": "12-52",
    "route_number": "23423-2001",
    "courier_id": "8272",
    "status": "finished",
    "phone": "+155512345679",
    "address":"477 5th Avenue",
    "lat": 73.9824,
    "lon": 40.7533
  }
]
```

    

{% include [warehouse-feedback](../_includes/feedback-7b71896f9bc3.md) %}
