Docs
DevelopersReferenceItineraries

API: Create An Itinerary

POST
/v1/itineraries

Creates a private itinerary. Send the clean shape: destination needs a name and a coordinate; everything else can follow, and a stop sent without a coordinate is placed on the map from its name. Stops, days, flights, hotels, expenses and packing items get an id if you leave it out. An itinerary for the same destination and start date as one you already have is refused as duplicateItinerary unless you pass allowDuplicate=true. Adding packing or expenses needs Travelyfe Pro. Anything the server could not place or fill is listed in needsAttention. Answers 201 with the itinerary, its ETag and a Location header.

AuthorizationBearer <token>

A Travelyfe access token.

In: header

Query Parameters

allowDuplicate?boolean

Create it even if it looks like one you already have.

Header Parameters

Idempotency-Key?string

A unique key per logical request. Retrying with the same key and body replays the first response instead of repeating the write.

Formatuuid
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"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Any itinerary fields, named as in ItineraryDocument. On create, destination needs a coordinate; the main details a traveller has not given (origin, startDate, travellers, coverImage) are filled or refused by name.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/itineraries" \  -H "Content-Type: application/json" \  -d '{}'
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "title": "string",  "summary": "string",  "destination": {    "name": "string",    "address": "string",    "coordinate": {      "latitude": -90,      "longitude": -180    },    "placeId": "string",    "countryCode": "string",    "timeZone": "string",    "code": "string"  },  "origin": {    "name": "string",    "address": "string",    "coordinate": {      "latitude": -90,      "longitude": -180    },    "placeId": "string",    "countryCode": "string",    "timeZone": "string",    "code": "string"  },  "startDate": "2019-08-24",  "travellers": 1,  "tags": [    "string"  ],  "coverImage": {    "url": "http://example.com",    "source": "string"  },  "currency": "string",  "days": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "image": {        "url": "http://example.com",        "source": "string"      },      "stops": [        {          "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",          "name": "string",          "category": "beach",          "place": {            "name": "string",            "address": "string",            "coordinate": {              "latitude": -90,              "longitude": -180            },            "placeId": "string",            "countryCode": "string",            "timeZone": "string",            "code": "string"          },          "startTime": "string",          "startTimeSuggested": true,          "durationMinutes": 1,          "phoneNumber": "string",          "activity": {            "provider": "string",            "productCode": "string",            "rating": 0,            "reviewCount": 0,            "bookingUrl": "http://example.com",            "lastCheckedAt": "2019-08-24T14:15:22Z"          }        }      ],      "legs": [        {          "from": "string",          "mode": "walk",          "minutes": 0,          "metres": 0,          "source": "string",          "to": "string"        }      ]    }  ],  "flights": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "flightAirline": {        "code": "string",        "name": "string"      },      "flightNumber": "string",      "departureAirport": {        "name": "string",        "address": "string",        "coordinate": {          "latitude": -90,          "longitude": -180        },        "placeId": "string",        "countryCode": "string",        "timeZone": "string",        "code": "string"      },      "arrivalAirport": {        "name": "string",        "address": "string",        "coordinate": {          "latitude": -90,          "longitude": -180        },        "placeId": "string",        "countryCode": "string",        "timeZone": "string",        "code": "string"      },      "departureDate": "2019-08-24T14:15:22Z",      "arrivalDate": "2019-08-24T14:15:22Z",      "cabinClass": "economy",      "seatNumber": "string",      "gateNumber": "string",      "departureTerminal": "string",      "arrivalTerminal": "string",      "phoneNumber": "string"    }  ],  "hotels": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "name": "string",      "place": {        "name": "string",        "address": "string",        "coordinate": {          "latitude": -90,          "longitude": -180        },        "placeId": "string",        "countryCode": "string",        "timeZone": "string",        "code": "string"      },      "checkInDate": "2019-08-24T14:15:22Z",      "checkOutDate": "2019-08-24T14:15:22Z",      "roomNumber": "string",      "phoneNumber": "string"    }  ],  "expenses": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "name": "string",      "cost": {        "amount": 1,        "currency": "string"      },      "category": "activity",      "date": "2019-08-24",      "belongsTo": {        "kind": "flight",        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"      }    }  ],  "packing": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "name": "string",      "category": "accessories",      "quantity": 1,      "isPacked": true,      "belongsTo": {        "kind": "flight",        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"      }    }  ],  "documents": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "name": "string",      "category": "boardingPass",      "file": {        "path": "string",        "name": "string",        "size": 0      },      "belongsTo": {        "kind": "flight",        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"      }    }  ],  "savedFrom": {    "itineraryId": "03efdba6-bc0e-4f7f-a1d4-b800bf7fb9ae",    "author": "string",    "authorDisplayName": "string",    "authorIsPro": true  },  "visibility": "private",  "role": "owner",  "author": {},  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z",  "likesCount": 0,  "viewsCount": 0}