Docs
DevelopersReferenceDays

API: Optimise A Day's Stops

POST
/v1/itineraries/{id}/days/{dayId}/optimise

Proposes the best order and travel mode for a day's stops, and changes nothing. Flights and hotels never move: the hotel the traveller sleeps in, or the airport on an arrival or departure day, anchors the route. Stops with a time the traveller set, restaurants, hotels and transport keep their slots. changed is false unless the plan saves at least 10 minutes or a tenth of the day's travel, or a mode change alone saves 5 minutes, so a day in its best order comes back as it is. Apply a proposal by sending the day's stops and legs to PATCH /v1/itineraries/{id}.

Requires Travelyfe Pro (subscriptionRequired otherwise), and an owner or editor.

AuthorizationBearer <token>

A Travelyfe access token.

In: header

Path Parameters

id*string

The itinerary id (UUID).

Formatuuid
dayId*string

The day id.

Header Parameters

Travelyfe-Itinerary-Shape?"clean"

Send clean on every request that reads or writes an itinerary. It is the shape this reference documents.

Value in

  • "clean"

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/itineraries/497f6eca-6276-4993-bfeb-53cbbbba6f08/days/string/optimise"
{  "changed": true,  "stopIds": [    "4256c298-92f0-40e5-91e8-592fbc66f299"  ],  "travelModes": {    "property1": "string",    "property2": "string"  },  "savedMinutes": 0,  "currentMinutes": 0,  "optimisedMinutes": 0,  "source": "string",  "legs": [    {}  ]}