Create a temporary booking from one or more selected train offers.
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
Path gdsprovider is currently 0. The body requires a non-empty offerIds array of strings.
Request Params Schema
gdsproviderCurrently
0Request Body Schema
offerIdsofferIds[]Success response
Returns booking with bookingId, expiresAt, terms and conditions, total price, passengers and extra fees.
Response Body Schema
bookingbookinggdsproviderbookingbookingIdbookingexpiresAtbookingtermsAndConditionsbookingtermsAndConditions[]bookingtotalPricebookingtotalPriceamountbookingtotalPricecurrencybookingpassengersbookingpassengers[]idbookingpassengers[]typebookingextraFeesbookingextraFees[]amountbookingextraFees[]currencyErrors
400for validation or unknown fields.401or403for invalid API credentials.500 internal_communication_errororunknown_errorfor provider failures.booking_not_foundwhen an offer cannot be pre-booked or has expired.
Usage notes
Keep bookingId and complete the order before expiresAt.
cURL example
bash
curl --request POST \
--url "https://api.sandbox.travelandz.com/v1/trains/book/0/prebook" \
--header "Authorization: Bearer $TRAVELANDZ_SECRET_KEY" \
--header "X-Travelandz-Id: $TRAVELANDZ_PUBLIC_KEY:$TRAVELANDZ_PROFILE_CODE" \
--header "Content-Type: application/json" \
--data '{"offerIds":["offer_123"]}'