---
title: "Assign an order to a tour."
method: GET
path: "/tour/assign_order"
tags: ["Disposition|Tour"]
---

# Assign an order to a tour.

`GET /tour/assign_order`

This endpoint allows an order to be associated with a tour. The system will attempt to find a stop at the address
of the order. If no existing stop is found, a new stop is added to the tour.


When a new stop is added to the tour, it must be recalculated or optimzed if desired. The status of the tour will
be reset to `NEW`. This is because the distances, durations, and departure and arrival times of the jobs may
change when a new job is added, and the values need to be calculated for the new stop as well. You must do that
at the `/tour/calculate` endpoint.

## Query parameters

- `orderId` integer
- `orderExternalReference` string
- `tourId` integer, required
- `beforeStopId` integer
- `afterStopId` integer

## Response `200`

Success Response:

- StandardDispoTourAssignOrderResponse
  - `data` DispoTourAssignOrderResponseDispoTourItem
    - `id` integer — The internal id of the tour.
    - `startDate` string — Represents a date. (ISO 8601) ICU-Format: yyyy-MM-dd
    - `team` string — The name of the team.
    - `teamId` integer — The internal id of the team.
    - `district` string — The name of the district.
    - `districtId` integer — The internal id of the district.
    - `numStops` integer — The amount of stops of the tour.
    - `numOrders` integer — The amount of orders of the tour.
    - `duration` integer — The total duration of the tour.
    - `distance` integer — The total distance of the tour.
    - `status` string — The status of the tour.
    - `reference` integer — The reference of the tour.
    - `dispoType` string — The name of the dispo type.
    - `dispoTypeId` integer — The internal id of the dispoType.
    - `stops` object[] — The stops of the tour.
      - `id` integer — The internal id of the stop.
      - `sequence` integer — The sequence of the stop.
      - `type` string — The stop type. | Value | Description | |--------------------------|--------------------------------------| | HOME | Home Stop used to identify the start and end of the tour | | ORDER | Use this type for a normal stop with orders | | SUB | Used for sub stops | | TBREAK | Break Stop | | HOTEL | Used for overnight stays | | FUEL | Used for fueling | | LOAD | Used for pickup and delivery orders. | | UNLOAD | Used for pickup and delivery orders. |
      - `name` string — The name address addition.
      - `name2` string — The name2 address addition.
      - `name3` string — The name3 address addition.
      - `street` string — The street.
      - `zipCode` string — The zip code.
      - `city` string — The city.
      - `countryCode` string — The two-digit ISO 3166 country code.
      - `provinceCode` string — The province code.
      - `latLng` number[] — Represents a geo coordinate. An array of two double values, representing the latitude and longitude.
      - `contactPersonName` string — The contact person name.
      - `contactPersonEmail` string — The contact person e-mail.
      - `contactPersonPhoneNumber` string — The contact person phone number.
      - `contactPersonMobileNumber` string — The contact person mobile number.
      - `noteDriver` string — A note for the driver. This info is shown to the driver in his app.
      - `notePlanner` string — A note for the planner.
      - `estimatedDrivingDuration` integer — The estimated driving duration in seconds between the previos and this stop.
      - `estimatedDrivingDistance` integer — The estimated driving distance in meters between the previos and this stop.
      - `estimatedTollCosts` number — The estimated toll costs between the previos and this stop.
      - `eta` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
      - `etd` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
      - `ata` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
      - `atd` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
      - `etc` integer — The estimated time in seconds to completion of the stop.
      - `totalSubEtc` integer — The estimated time in seconds to completion of all sub stops.
      - `atc` integer — The actual time in seconds to completion of the stop.
      - `orders` object[] — The orders of the stop.
        - `id` integer — The internal id of the order.
        - `reference` string — The customer order number.
        - `externalReference` string — The internal reference for the order.
        - `subject` string — The order subject.
        - `createdAt` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
        - `project` integer — The id of the project.
        - `projectReferenceSign` string — The reference sign of the project.
      - `subStops` object[] — The sub stops of the stop.
        - `id` integer — The internal id of the sub stop.
        - `tourId` integer — The internal id of the tour from the sub stop.
        - `etc` integer — The estimated time in seconds to completion of the sub stop.
      - `masterStopId` integer — The internal id of the master stop.
      - `masterTourId` integer — The internal id of the tour from the master stop.
      - `masterEtc` integer — The internal id of the tour from the master stop.
    - `startTime` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
    - `endTime` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
  - `newStop` DispoTourFetchDataResponseDispoTourStopItem
    - `id` integer — The internal id of the stop.
    - `sequence` integer — The sequence of the stop.
    - `type` string — The stop type. | Value | Description | |--------------------------|--------------------------------------| | HOME | Home Stop used to identify the start and end of the tour | | ORDER | Use this type for a normal stop with orders | | SUB | Used for sub stops | | TBREAK | Break Stop | | HOTEL | Used for overnight stays | | FUEL | Used for fueling | | LOAD | Used for pickup and delivery orders. | | UNLOAD | Used for pickup and delivery orders. |
    - `name` string — The name address addition.
    - `name2` string — The name2 address addition.
    - `name3` string — The name3 address addition.
    - `street` string — The street.
    - `zipCode` string — The zip code.
    - `city` string — The city.
    - `countryCode` string — The two-digit ISO 3166 country code.
    - `provinceCode` string — The province code.
    - `latLng` number[] — Represents a geo coordinate. An array of two double values, representing the latitude and longitude.
    - `contactPersonName` string — The contact person name.
    - `contactPersonEmail` string — The contact person e-mail.
    - `contactPersonPhoneNumber` string — The contact person phone number.
    - `contactPersonMobileNumber` string — The contact person mobile number.
    - `noteDriver` string — A note for the driver. This info is shown to the driver in his app.
    - `notePlanner` string — A note for the planner.
    - `estimatedDrivingDuration` integer — The estimated driving duration in seconds between the previos and this stop.
    - `estimatedDrivingDistance` integer — The estimated driving distance in meters between the previos and this stop.
    - `estimatedTollCosts` number — The estimated toll costs between the previos and this stop.
    - `eta` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
    - `etd` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
    - `ata` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
    - `atd` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
    - `etc` integer — The estimated time in seconds to completion of the stop.
    - `totalSubEtc` integer — The estimated time in seconds to completion of all sub stops.
    - `atc` integer — The actual time in seconds to completion of the stop.
    - `orders` object[] — The orders of the stop.
      - `id` integer — The internal id of the order.
      - `reference` string — The customer order number.
      - `externalReference` string — The internal reference for the order.
      - `subject` string — The order subject.
      - `createdAt` string — Represents a date and a time. (ISO 8601) ICU-Format: yyyy-MM-dd'T'HH:mm:ssxxx
      - `project` integer — The id of the project.
      - `projectReferenceSign` string — The reference sign of the project.
    - `subStops` object[] — The sub stops of the stop.
      - `id` integer — The internal id of the sub stop.
      - `tourId` integer — The internal id of the tour from the sub stop.
      - `etc` integer — The estimated time in seconds to completion of the sub stop.
    - `masterStopId` integer — The internal id of the master stop.
    - `masterTourId` integer — The internal id of the tour from the master stop.
    - `masterEtc` integer — The internal id of the tour from the master stop.

---

[API](https://skmtc.net/geocapture/apis/geocapture-api.md) · [All operations](https://skmtc.net/geocapture/apis/geocapture-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/geocapture/geocapture-api/revisions/869b05603541/schema)
