Receive itinerary offers, completion and cancellation policy chunks progressively.
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>. |
Accept | application/x-ndjson for progressive stream responses. |
Content-Type | application/json for requests with a JSON body. |
Request
Uses the same path, query and JSON body as the non-stream journey offers endpoint.
Request Params Schema
gdsproviderCurrently
0journeyIdJourney id returned by the journey search.
Request Query Params Schema
languagereturnCancellationPoliciesRequest Body Schema
passengerspassengers[]typeSuccess response
Each NDJSON line is discriminated by type: itinerary with an item, offers_search_completed, or cancellation_policies with an item array.
Response Body Schema (type=itinerary)
typeitemitemitineraryIndexitemsegmentsitemsegments[]segmentIditemsegments[]departureitemsegments[]departuredepartureAtitemsegments[]departurenameitemsegments[]departurelocationIditemsegments[]departurecountryitemsegments[]departurecountryCodeitemsegments[]arrivalitemsegments[]arrivalarrivalAtitemsegments[]arrivalnameitemsegments[]arrivallocationIditemsegments[]arrivalcountryitemsegments[]arrivalcountryCodeitemsegments[]identifieritemsegments[]transportitemsegments[]durationInMinutesitemsegments[]operatoritemsegments[]operatorcodeitemsegments[]operatornameitemsegments[]operatorimageUrlitemsegments[]serviceitemsegments[]servicenameitemsegments[]serviceimageUrlitemoffersitemoffers[]offerIditemoffers[]partsitemoffers[]parts[]segmentsitemoffers[]parts[]segments[]segmentIditemoffers[]parts[]segments[]amenitiesitemoffers[]parts[]segments[]amenities[]itemoffers[]parts[]flexibilityitemoffers[]parts[]comfortClassitemoffers[]parts[]serviceClassitemoffers[]parts[]conditionsitemoffers[]parts[]conditions[]typeitemoffers[]parts[]conditions[]conditionitemoffers[]parts[]conditions[]noteitemoffers[]parts[]conditions[]conditionKeyitemoffers[]parts[]cancellationPoliciesitemoffers[]parts[]cancellationPolicies[]__typenameitemoffers[]parts[]cancellationPolicies[]__typenametypeitemoffers[]parts[]cancellationPolicies[]descriptionitemoffers[]parts[]cancellationPolicies[]minimum_minutes_before_departureitemoffers[]parts[]cancellationPolicies[]maximum_minutes_before_departureitemoffers[]parts[]cancellationPolicies[]minimum_minutes_after_departureitemoffers[]parts[]cancellationPolicies[]maximum_minutes_after_departureitemoffers[]parts[]cancellationPolicies[]percentageWhen
__typename is CancellationByPercentageitemoffers[]parts[]cancellationPolicies[]chargePercentageWhen
__typename is CancellationByPercentChargeitemoffers[]parts[]cancellationPolicies[]chargeAmountWhen
__typename is CancellationByFixedChargeitemoffers[]parts[]cancellationPolicies[]currencyWhen
__typename is CancellationByFixedChargeitemoffers[]parts[]cancellationPolicies[]perPersonWhen
__typename is CancellationByPercentCharge or CancellationByFixedCharge. Is optionalitemoffers[]parts[]cancellationPolicies[]perLegWhen
__typename is CancellationByPercentCharge or CancellationByFixedCharge. Is optionalitemoffers[]parts[]isRefundableitemoffers[]priceitemoffers[]priceamountitemoffers[]pricecurrencyitemoffers[]createdAtitemoffers[]expiresAt,
Response Body Schema (type=offers_search_completed)
type,
Response Body Schema (type=cancellation_policies)
typeitemitem[]conditionKeyitem[]policiesitem[]policies[]__typenameitem[]policies[]__typenametypeitem[]policies[]descriptionitem[]policies[]minimum_minutes_before_departureitem[]policies[]maximum_minutes_before_departureitem[]policies[]minimum_minutes_after_departureitem[]policies[]maximum_minutes_after_departureitem[]policies[]percentageWhen
__typename is CancellationByPercentageitem[]policies[]chargePercentageWhen
__typename is CancellationByPercentChargeitem[]policies[]chargeAmountWhen
__typename is CancellationByFixedChargeitem[]policies[]currencyWhen
__typename is CancellationByFixedChargeitem[]policies[]perPersonWhen
__typename is CancellationByPercentCharge or CancellationByFixedCharge. Is optionalitem[]policies[]perLegWhen
__typename is CancellationByPercentCharge or CancellationByFixedCharge. Is optional,
Response Body Schema (error=true)
errorcodestatusCodeErrors
400for validation or unknown fields.401or403for invalid API credentials.500 internal_communication_errororunknown_errorfor provider failures.- Stream errors use an object with
error: true, a businesscode, andstatusCode.
Usage notes
Switch on type; not every line has the shape of an itinerary. Consume until offers_search_completed and keep policy chunks separately.
cURL example
bash
curl --request POST \
--url "https://api.sandbox.travelandz.com/v1/trains/journeys/0/journey_123/offers/stream?language=en&returnCancellationPolicies=true" \
--header "Authorization: Bearer $TRAVELANDZ_SECRET_KEY" \
--header "X-Travelandz-Id: $TRAVELANDZ_PUBLIC_KEY:$TRAVELANDZ_PROFILE_CODE" \
--header "Accept: application/x-ndjson" \
--data '{"passengers":[{"type":"adult"}]}'