---
updatedAt: 2025-05-21T09:48:02.000Z
agentTools:
  projectIndex: https://toursolver.readme.io/llms.txt
---

# Get optimization result organized by tours

Get the result of planning optimization organized by tours (one tour per
resource per day). Status of the optimization must be terminated.

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "servers": [
    {
      "url": "https://api.geoconcept.com/tsapi",
      "description": "Production",
      "variables": {}
    }
  ],
  "info": {
    "contact": {
      "email": "support@nomadia-group.com",
      "name": "Nomadia Group",
      "url": "https://www.nomadia-group.com/contact/"
    },
    "description": "Web APIs for TourSolver.",
    "title": "TourSolver API",
    "version": "2.0"
  },
  "tags": [
    {
      "description": "Start optimizations, follow the progress, retrieve the results, etc",
      "name": "Optimization"
    }
  ],
  "paths": {
    "/toursResult": {
      "get": {
        "description": "Get the result of planning optimization organized by tours (one tour per\nresource per day). Status of the optimization must be terminated.",
        "operationId": "getToursResult",
        "parameters": [
          {
            "description": "the id of optimization task, as returned by the optimize service",
            "in": "query",
            "name": "taskId",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "default": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OptimToursResult"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/OptimToursResult"
                }
              },
              "text/xml": {
                "schema": {
                  "$ref": "#/components/schemas/OptimToursResult"
                }
              }
            },
            "description": "Result of the optimization organized by tours"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "servers": [
          {
            "description": "Production",
            "url": "https://api.geoconcept.com/tsapi",
            "variables": {}
          }
        ],
        "summary": "Get optimization result organized by tours",
        "tags": [
          "Optimization"
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "OptimToursResult": {
        "type": "object",
        "description": "Result of an optimization task. Planned visists are grouped by tour.",
        "properties": {
          "errCode": {
            "type": "string",
            "description": "Error code",
            "enum": [
              "0",
              "1",
              "2",
              "3",
              "4",
              "5",
              "6",
              "7",
              "8",
              "9",
              "10",
              "11",
              "12",
              "13",
              "14",
              "100",
              "101",
              "102",
              "103",
              "104",
              "105",
              "106",
              "107",
              "108",
              "109",
              "110",
              "111",
              "112",
              "113",
              "114",
              "115",
              "116",
              "200",
              "201",
              "300",
              "301",
              "400",
              "401",
              "500",
              "501",
              "502",
              "600",
              "601",
              "602",
              "603",
              "604",
              "1000",
              "1001",
              "1002",
              "1003",
              "1004",
              "1006",
              "1007",
              "1008",
              "2000",
              "2001",
              "2002",
              "2003",
              "2004",
              "2005",
              "2006",
              "2007",
              "2008",
              "2009",
              "2010",
              "2011",
              "2021",
              "2022",
              "2023",
              "2024",
              "2025",
              "2026",
              "2027",
              "2028",
              "2029",
              "2030",
              "2031",
              "3000",
              "3001",
              "3002",
              "4000",
              "4001",
              "4002",
              "5000",
              "5001",
              "5002",
              "5003",
              "6000"
            ]
          },
          "message": {
            "type": "string",
            "description": "Error message"
          },
          "status": {
            "type": "string",
            "description": "OK or ERROR",
            "enum": [
              "OK",
              "ERROR"
            ]
          },
          "taskId": {
            "type": "string",
            "description": "the id of the optimization task (usefull if result is automatically sent through a webhook)."
          },
          "tours": {
            "type": "array",
            "description": "List of tours (one tour per resource per day)",
            "items": {
              "$ref": "#/components/schemas/TSTour"
            }
          },
          "unplannedOrders": {
            "type": "array",
            "description": "the orders which has not been planned because: <li>it was sent by an\r\n\tother mail service <li>it was not scheduled by any resource.",
            "items": {
              "$ref": "#/components/schemas/TSUnplanned"
            }
          },
          "warnings": {
            "type": "array",
            "description": "the list of warning messages (and associated error codes) about possible\r\n\tOrders and Resources elements constraints misconfiguration.",
            "items": {
              "$ref": "#/components/schemas/TSWarning"
            }
          }
        }
      },
      "TSPlanned": {
        "type": "object",
        "description": "Details of a stop within a resource tour.",
        "properties": {
          "dayId": {
            "type": "string",
            "description": "day of the stop"
          },
          "frequencyCount": {
            "type": "string",
            "description": "When using frequencies, the total number of instances"
          },
          "frequencyNumber": {
            "type": "string",
            "description": "When using frequencies, the instance number"
          },
          "resourceId": {
            "type": "string",
            "description": "Assigned resource identifier"
          },
          "stopDriveDistance": {
            "type": "integer",
            "format": "int32",
            "description": "The drive distance from the previous to the current stop."
          },
          "stopDriveTime": {
            "type": "string",
            "description": "Time, can be expressed in minutes or in hh:mm:ss format."
          },
          "stopDuration": {
            "type": "string",
            "description": "Time, can be expressed in minutes or in hh:mm:ss format."
          },
          "stopElapsedDistance": {
            "type": "integer",
            "format": "int32",
            "description": "The tour cumulated driven distance at the stop."
          },
          "stopId": {
            "type": "string",
            "description": "the ID of the stop or order"
          },
          "stopPosition": {
            "type": "integer",
            "format": "int32",
            "description": "The position of the stop in the resource tour."
          },
          "stopStartTime": {
            "type": "string",
            "description": "Time, can be expressed in minutes or in hh:mm:ss format."
          },
          "stopStatus": {
            "type": "integer",
            "format": "int32",
            "description": "The status of the stop.\n\nAn order can be on time, late, waited, impossible (non compliant). It can\nalso be a courier service delivery and not planned. See\nStopStatusConstants for more information about stop status.\n\n**Type:** integer.\n\n* 0 = OnTime: The stop begins into the specified visit time window.\n\n* 1 = Late: The stop begins after the specified visit time window.\n\n* 2 = Waited: The resource waits at the stop for the specified stop\nstart time.\n\n* 3 = Impossible: The stop cannot be planned.\n\n* 4 = BadDay: The stop is planned without respect of frequency.\n\n* NotPlanned: The courier service is in charge of a stop or the stop\nis not included in the planning process.\n\n* BadPrevious: When the visits are split, the parts should follow\none another. This status is that of a part following another visit\ninstead of the previous part of the split visit."
          },
          "stopType": {
            "type": "integer",
            "format": "int32",
            "description": "The stop type\n\nA tour is composed of stops, which can be either customers visits or\nbreaks, like reload breaks, lunch breaks, or even night breaks.\n\nStopTypeConstants are\n\n* 0 = Visit: The stop is an element of the Orders object.\n\n* 1 = Start: The stop is the initial stage (departure) of the tour,\noccurring at the resource's start location.\n\n* 2 = End: The stop is the the last stage (arrival) of the tour,\noccurring at the resource's stop location.\n\n* 3 = EndBeforeOvernight: The stop is the the last stage (arrival) of\nthe tour, occurring where the resource stopped for the night.\n\n* 4 = ReloadBreak: The stop is a reload break within the tour,\noccurring at a depot location.\n\n* 5 = LunchBreak: The stop is the lunch break within the tour,\noccurring anywhere between two other located stops.\n\n* 6 = RestBreak: The stop is a rest break within the tour, occurring\nanywhere between two located stops.\n\n* 7 = WaitBreak: The stop is a wait break within the tour, occurring\nbefore a visit.\n\n* 8 = StartAfterOvernight: The stop is the last stage (arrival) of\nthe tour, it occurs where the resource stopped for the night.\n\n* 9 = Briefing: The stop is a briefing break within the tour,\noccurring right after the departure of the tour.\n\n* 10 = DeBriefing: The stop is a wait break within the tour, occurring\nright before the arrival of the tour."
          },
          "stopX": {
            "type": "number",
            "format": "double",
            "description": "The X coordinate of the stop (longitude)."
          },
          "stopY": {
            "type": "number",
            "format": "double",
            "description": "The Y coordinate of the stop (latitude)."
          }
        }
      },
      "TSTour": {
        "type": "object",
        "description": "Details of a stop within a resource tour.",
        "properties": {
          "additionalCost": {
            "type": "number",
            "format": "double",
            "description": "Additional cost\n\nAdditional cost depends on additional cost configuration specified on\nresources and orders"
          },
          "dayId": {
            "type": "string",
            "description": "The day of the tour."
          },
          "deliveryCost": {
            "type": "number",
            "format": "double",
            "description": "Total delivery cost of the tour\n\nDelivery cost depends on PenaltyPerVisit defined on resources and\nconfiguration specified in options (see countDepotsInDeliveryCost and\ncountVisitCostOnceIfSameLocation)"
          },
          "plannedOrders": {
            "type": "array",
            "description": "Orders planned in this tour.",
            "items": {
              "$ref": "#/components/schemas/TSPlanned"
            }
          },
          "reloadNb": {
            "type": "integer",
            "format": "int32",
            "description": "Number of reloads during this tour."
          },
          "resourceCapacities": {
            "type": "array",
            "description": "List of resource capacities.",
            "items": {
              "type": "number",
              "format": "double",
              "description": "List of resource capacities."
            }
          },
          "resourceId": {
            "type": "string",
            "description": "Assigned resource identifier."
          },
          "totalCost": {
            "type": "number",
            "format": "double",
            "description": "Total cost.\n\nTotal cost = (delivery cost) + (additional cost)"
          },
          "travelDistance": {
            "type": "integer",
            "format": "int32",
            "description": "Drive distance for this tour."
          },
          "travelDuration": {
            "type": "string",
            "description": "Time, can be expressed in minutes or in hh:mm:ss format."
          },
          "usedCapacities": {
            "type": "array",
            "description": "List of used capacities\n\nTour used capacities can exceed resource capacities if the tour contains\none or several stops to a depot.",
            "items": {
              "type": "number",
              "format": "double",
              "description": "List of used capacities\n\nTour used capacities can exceed resource capacities if the tour contains\none or several stops to a depot."
            }
          }
        }
      },
      "TSUnplanned": {
        "type": "object",
        "description": "Unplanned order",
        "properties": {
          "frequencyNumber": {
            "type": "string",
            "description": "when using frequencies, the instance number."
          },
          "reason": {
            "type": "string",
            "description": "The reason why it was not planned."
          },
          "stopID": {
            "type": "string",
            "description": "The ID of the stop."
          }
        }
      },
      "TSWarning": {
        "type": "object",
        "properties": {
          "constraint": {
            "type": "integer",
            "format": "int32",
            "description": "The ID of the constraint causing the warning."
          },
          "constraintName": {
            "type": "string",
            "description": "The name of the constraint causing the warning."
          },
          "i18nMessageCode": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "The ID of the object causing the warning."
          },
          "message": {
            "type": "string",
            "description": "Warning message."
          },
          "messageId": {
            "type": "integer",
            "format": "int32",
            "description": "The id of the message."
          },
          "objectType": {
            "type": "string",
            "description": "The type of object causing the warning."
          },
          "value": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "apiKey": {
        "description": "The api key can be passed through an header or in the query.",
        "in": "header",
        "name": "apiKey",
        "type": "apiKey"
      }
    }
  }
}
```