Submit passenger details to create and confirm an order from a pre-booking.
Authentication and headers
| Header | Description |
|---|---|
Authorization | Bearer <secret_key>. Keep the secret on the server and never write it to client logs. |
X-Travelandz-Id | <public_key>:<profile_code>, where the persisted profile code has the form dp_<12 alphanumeric>. |
Content-Type | application/json for requests with a JSON body. |
Request
The body requires passengers[]. Each passenger requires id, title (mr, ms, mx), firstName, lastName, phone and email; send additional fields requested by required-fields.
json
{"passengers":[{"id":"passenger_1","title":"mr","firstName":"John","lastName":"Doe","phone":"+34123456789","email":"john.doe@example.com","countryCode":"ES","bornDate":"1988-04-20","nationality":"ES","identityDocument":{"documentNumber":"X1234567","type":"passport"}}]}Request Params Schema
gdsproviderCurrently
0bookingIdBooking id returned by prebook.
Request Body Schema
passengerspassengers[]idPassenger id returned by prebook.
passengers[]titlepassengers[]firstNamepassengers[]lastNamepassengers[]agepassengers[]nationalitypassengers[]phonepassengers[]emailpassengers[]countryCodepassengers[]bornDatepassengers[]cityOfBirthpassengers[]countryOfBirthpassengers[]addresspassengers[]citypassengers[]postalCodepassengers[]identityDocumentpassengers[]identityDocumentdocumentNumberpassengers[]identityDocumenttypeSuccess response
Returns orderId, bookingId, bookingReference and bookingStatus. Status can be pending, confirmed or cancelled.
Response Body Schema
orderIdbookingIdbookingReferencebookingStatusErrors
400for validation or unknown fields.401or403for invalid API credentials.500 internal_communication_errororunknown_errorfor provider failures.booking_not_foundwhen the pre-booking is missing or expired.
Usage notes
Use the passenger ids returned by prebook. Preserve the order identifiers exactly as returned for later retrieval and refund calls.
cURL example
bash
curl --request POST \
--url "https://api.sandbox.travelandz.com/v1/trains/book/0/booking_123/order" \
--header "Authorization: Bearer $TRAVELANDZ_SECRET_KEY" \
--header "X-Travelandz-Id: $TRAVELANDZ_PUBLIC_KEY:$TRAVELANDZ_PROFILE_CODE" \
--header "Content-Type: application/json" \
--data '{"passengers":[{"id":"passenger_1","title":"mr","firstName":"John","lastName":"Doe","phone":"+34123456789","email":"john.doe@example.com"}]}'