POST
/api/v1/optimizeOptimize a route
Compute the optimal stop order with arrival times, distance and duration.
https://app.otiggo.com/api/v1/optimize
Billing
- 1 stop credit per stop in the request (not per kilometer)
- 2–200 stops per call in production
- Failed optimizations are refunded automatically
Request body
| Param | Type | Description |
|---|---|---|
startrequired | Location | Departure point. Coordinates or street + postalCode + city. |
endoptional | Location | Optional return point. Same shape as start. |
stopsrequired | Stop[] | Array of stops (2–200). Each needs a unique id and a location. |
departureTimeoptional | string (ISO 8601) | Optional departure datetime used for the schedule. |
avoidTollsoptional | boolean | When true, prefer routes without tolls. |
Location
Either coordinates, or a full address (geocoded server-side — live keys only).
| Param | Type | Description |
|---|---|---|
latitudeoptional | number | −90 … 90 |
longitudeoptional | number | −180 … 180 |
streetoptional | string | Street address |
postalCodeoptional | string | Postal code |
cityoptional | string | City |
Stop
| Param | Type | Description |
|---|---|---|
idrequired | string | Unique id (max 100 chars). Returned in order and schedule. |
deadlineoptional | string | Optional "HH:MM" deadline in Europe/Paris time. |
serviceSecondsoptional | number | Optional time spent at the stop (0–3600). |
Response fields
| Param | Type | Description |
|---|---|---|
orderoptional | string[] | Optimal stop ids in visit order. |
waypointsoptional | object[] | id, order, latitude, longitude for each stop. |
totalDistanceKmoptional | number | Total route distance. |
estimatedTimeMinoptional | number | Estimated duration in minutes. |
scheduleoptional | object[] | Arrival times per stop (colisId, arrivee). |
departAt / returnAtoptional | string | null | ISO departure and return times. |
lateStopsoptional | object[] | null | Stops past their deadline, if any. |
stopsChargedoptional | number | Credits charged (0 in sandbox). |
stopsBalanceoptional | number | Remaining balance (live only). |