Adds a route

  1. HTTP Request
  2. Path Parameters
  3. Request Body
    1. Representation
    2. Fields
  4. Responses
    1. Code 200
      1. Representation
      2. Fields
    2. Code 401
    3. Code 403
    4. Code 422
    5. Code 504

Adds route information to the database.

HTTP Request

POST https://courier.yandex.ru/api/v1/companies/{company_id}/routes

Path Parameters

company_id *

integer

Company ID used in requests to the Track & Trace API.

company_id *

integer

Company ID used in requests to the Track & Trace API.

Request Body

{
  "courier_id": integer,
  "courier_number": string,
  "custom_fields": [
    {
      "key": string,
      "value": string
    }
  ],
  "date": string,
  "depot_id": integer,
  "depot_number": string,
  "id": integer,
  "imei": integer,
  "imei_str": string,
  "number": string,
  "rented_courier_id": string,
  "route_finish": string,
  "route_start": string,
  "routing_mode": string,
  "tracking_start_h": integer
}
Copied to clipboard

Representation

Collapse all
Expand all

Fields

custom_fields[]

array

List of route custom fields. Max number of custom fields is 10.

custom_fields[].key

string

Key of custom field. Must correspond to one of route custom fields in company settings.

custom_fields[].value

string

Value of custom field.

date *

string

The date of the route in YYYY-MM-DD format. Cannot be changed if there are orders on route.

id

integer

Route ID used in requests to the Track & Trace API.

imei

integer

The number of the GPS tracker installed on the vehicle on the route.

imei_str

string

String representation of numeric number of a GPS tracker. Should be used in case integer overflow of numeric number of a GPS tracker value in the programming language used. If defined in request, this takes precedence over the value of integer number of a GPS tracker field.

number *

string

Route number. Used for syncing with the delivery company's system.

rented_courier_id

string

Rented courier ID used in requests to the Track & Trace API.

route_finish

string

Route finish time relative to the date value, in the [d.]HH:MM:SS format. If specified, positions sent by GPS trackers and the app will be recorded only before the specified time.

route_start

string

Route start time relative to the date value, in the [d.]HH:MM:SS format. If specified:

  • Positions sent by GPS trackers and the app will be recorded only after route_start - tracking_start_h.
  • Order history START event will be added to order history only after the specified time.
  • Order status change SMS notification messages, if enabled, will be sent to clients only after the specified time.

routing_mode

string

Transportation method. Possible values:

  • driving - courier drives a car.
  • truck - courier drives a truck.
  • transit - courier uses public transport and walks.
  • walking - courier walks.

tracking_start_h

integer

Route tracking will start tracking_start_h hours before route start. If route.route_start is specified, positions sent by GPS trackers and the app will be recorded only after route.route_start - route.tracking_start_h if route.tracking_start_h is specified, otherwise after route.route_start - company.tracking_start_h.

Minimum value: 0.
Maximum value: 24.

courier_id

integer

ID of the courier who delivers items on the route. The request must specify the courier_id or courier_number. If both courier_id or courier_number are specified courier_number is used.

courier_number

string

Mobile employee number. Used for syncing with the delivery company's system. The request must specify the courier_id or courier_number. If both courier_id or courier_number are specified courier_number is used.

depot_id

integer

ID of the depot where the route starts. The request must specify the depot_id or depot_number parameter. If both depot_id or depot_number are specified depot_number is used.

depot_number

string

Depot number. Used for syncing with the delivery company's system. The request must specify the depot_id or depot_number parameter. If both depot_id or depot_number are specified depot_number is used.

custom_fields[]

array

List of route custom fields. Max number of custom fields is 10.

custom_fields[].key

string

Key of custom field. Must correspond to one of route custom fields in company settings.

custom_fields[].value

string

Value of custom field.

date *

string

The date of the route in YYYY-MM-DD format. Cannot be changed if there are orders on route.

id

integer

Route ID used in requests to the Track & Trace API.

imei

integer

The number of the GPS tracker installed on the vehicle on the route.

imei_str

string

String representation of numeric number of a GPS tracker. Should be used in case integer overflow of numeric number of a GPS tracker value in the programming language used. If defined in request, this takes precedence over the value of integer number of a GPS tracker field.

number *

string

Route number. Used for syncing with the delivery company's system.

rented_courier_id

string

Rented courier ID used in requests to the Track & Trace API.

route_finish

string

Route finish time relative to the date value, in the [d.]HH:MM:SS format. If specified, positions sent by GPS trackers and the app will be recorded only before the specified time.

route_start

string

Route start time relative to the date value, in the [d.]HH:MM:SS format. If specified:

  • Positions sent by GPS trackers and the app will be recorded only after route_start - tracking_start_h.
  • Order history START event will be added to order history only after the specified time.
  • Order status change SMS notification messages, if enabled, will be sent to clients only after the specified time.

routing_mode

string

Transportation method. Possible values:

  • driving - courier drives a car.
  • truck - courier drives a truck.
  • transit - courier uses public transport and walks.
  • walking - courier walks.

tracking_start_h

integer

Route tracking will start tracking_start_h hours before route start. If route.route_start is specified, positions sent by GPS trackers and the app will be recorded only after route.route_start - route.tracking_start_h if route.tracking_start_h is specified, otherwise after route.route_start - company.tracking_start_h.

Minimum value: 0.
Maximum value: 24.

courier_id

integer

ID of the courier who delivers items on the route. The request must specify the courier_id or courier_number. If both courier_id or courier_number are specified courier_number is used.

courier_number

string

Mobile employee number. Used for syncing with the delivery company's system. The request must specify the courier_id or courier_number. If both courier_id or courier_number are specified courier_number is used.

depot_id

integer

ID of the depot where the route starts. The request must specify the depot_id or depot_number parameter. If both depot_id or depot_number are specified depot_number is used.

depot_number

string

Depot number. Used for syncing with the delivery company's system. The request must specify the depot_id or depot_number parameter. If both depot_id or depot_number are specified depot_number is used.

Responses

Code 200

The route information was registered in the database.

{
  "company_id": integer,
  "courier_id": integer,
  "courier_violated_route": boolean,
  "custom_fields": [
    {
      "key": string,
      "value": string
    }
  ],
  "date": string,
  "depot_id": integer,
  "id": integer,
  "imei": integer,
  "imei_str": string,
  "number": string,
  "rented_courier_id": string,
  "route_finish": string,
  "route_start": string,
  "routing_mode": string,
  "tracking_start_h": integer
}
Copied to clipboard

Representation

Collapse all
Expand all

Fields

custom_fields[]

array

List of route custom fields. Max number of custom fields is 10.

custom_fields[].key

string

Key of custom field. Must correspond to one of route custom fields in company settings.

custom_fields[].value

string

Value of custom field.

date *

string

The date of the route in YYYY-MM-DD format. Cannot be changed if there are orders on route.

id

integer

Route ID used in requests to the Track & Trace API.

imei

integer

The number of the GPS tracker installed on the vehicle on the route.

imei_str

string

String representation of numeric number of a GPS tracker. Should be used in case integer overflow of numeric number of a GPS tracker value in the programming language used. If defined in request, this takes precedence over the value of integer number of a GPS tracker field.

number *

string

Route number. Used for syncing with the delivery company's system.

rented_courier_id

string

Rented courier ID used in requests to the Track & Trace API.

route_finish

string

Route finish time relative to the date value, in the [d.]HH:MM:SS format. If specified, positions sent by GPS trackers and the app will be recorded only before the specified time.

route_start

string

Route start time relative to the date value, in the [d.]HH:MM:SS format. If specified:

  • Positions sent by GPS trackers and the app will be recorded only after route_start - tracking_start_h.
  • Order history START event will be added to order history only after the specified time.
  • Order status change SMS notification messages, if enabled, will be sent to clients only after the specified time.

routing_mode

string

Transportation method. Possible values:

  • driving - courier drives a car.
  • truck - courier drives a truck.
  • transit - courier uses public transport and walks.
  • walking - courier walks.

tracking_start_h

integer

Route tracking will start tracking_start_h hours before route start. If route.route_start is specified, positions sent by GPS trackers and the app will be recorded only after route.route_start - route.tracking_start_h if route.tracking_start_h is specified, otherwise after route.route_start - company.tracking_start_h.

Minimum value: 0.
Maximum value: 24.

company_id

integer

Company ID used in requests to the Track & Trace API.

courier_id

integer

ID of the courier who delivers items on the route.

courier_violated_route

boolean

Indicates if a courier visits orders' locations in the order that is different from the predefined order sequence.

depot_id

integer

ID of the depot where the route starts.

custom_fields[]

array

List of route custom fields. Max number of custom fields is 10.

custom_fields[].key

string

Key of custom field. Must correspond to one of route custom fields in company settings.

custom_fields[].value

string

Value of custom field.

date *

string

The date of the route in YYYY-MM-DD format. Cannot be changed if there are orders on route.

id

integer

Route ID used in requests to the Track & Trace API.

imei

integer

The number of the GPS tracker installed on the vehicle on the route.

imei_str

string

String representation of numeric number of a GPS tracker. Should be used in case integer overflow of numeric number of a GPS tracker value in the programming language used. If defined in request, this takes precedence over the value of integer number of a GPS tracker field.

number *

string

Route number. Used for syncing with the delivery company's system.

rented_courier_id

string

Rented courier ID used in requests to the Track & Trace API.

route_finish

string

Route finish time relative to the date value, in the [d.]HH:MM:SS format. If specified, positions sent by GPS trackers and the app will be recorded only before the specified time.

route_start

string

Route start time relative to the date value, in the [d.]HH:MM:SS format. If specified:

  • Positions sent by GPS trackers and the app will be recorded only after route_start - tracking_start_h.
  • Order history START event will be added to order history only after the specified time.
  • Order status change SMS notification messages, if enabled, will be sent to clients only after the specified time.

routing_mode

string

Transportation method. Possible values:

  • driving - courier drives a car.
  • truck - courier drives a truck.
  • transit - courier uses public transport and walks.
  • walking - courier walks.

tracking_start_h

integer

Route tracking will start tracking_start_h hours before route start. If route.route_start is specified, positions sent by GPS trackers and the app will be recorded only after route.route_start - route.tracking_start_h if route.tracking_start_h is specified, otherwise after route.route_start - company.tracking_start_h.

Minimum value: 0.
Maximum value: 24.

company_id

integer

Company ID used in requests to the Track & Trace API.

courier_id

integer

ID of the courier who delivers items on the route.

courier_violated_route

boolean

Indicates if a courier visits orders' locations in the order that is different from the predefined order sequence.

depot_id

integer

ID of the depot where the route starts.

Code 401

Authorization error. Make sure that the request header contains the correct OAuth token.

Code 403

Error accessing the object. The user doesn't have the rights to access the object.

Code 422

Incorrect input. The operation can't be performed.

Code 504

Error working with the API. Repeat the request.