POST/v1/trains/journeys/:gdsprovider/:journeyId/offers/stream

Stream journey offers

Receive itinerary offers, completion and cancellation policy chunks progressively.

Share

Receive itinerary offers, completion and cancellation policy chunks progressively.

Authentication and headers

HeaderDescription
AuthorizationBearer <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>.
Acceptapplication/x-ndjson for progressive stream responses.
Content-Typeapplication/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

gdsprovider
enum
0
Yes
Currently 0
journeyId
stringYes
Journey id returned by the journey search.

Request Query Params Schema

language
enum
eneszh
No
returnCancellationPolicies
booleanNo

Request Body Schema

passengers
arrayYes
passengers[]type
enum
youthadultsenior
Yes

Success 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)

type
enum
itinerary
Yes
item
objectYes
itemitineraryIndex
numberYes
itemsegments
arrayYes
itemsegments[]segmentId
stringYes
itemsegments[]departure
objectYes
itemsegments[]departuredepartureAt
string
Format: ISO 8601
Yes
itemsegments[]departurename
stringYes
itemsegments[]departurelocationId
stringYes
itemsegments[]departurecountry
stringYes
itemsegments[]departurecountryCode
stringYes
itemsegments[]arrival
objectYes
itemsegments[]arrivalarrivalAt
string
Format: ISO 8601
Yes
itemsegments[]arrivalname
stringYes
itemsegments[]arrivallocationId
stringYes
itemsegments[]arrivalcountry
stringYes
itemsegments[]arrivalcountryCode
stringYes
itemsegments[]identifier
stringYes
itemsegments[]transport
enum
trainbusferry
Yes
itemsegments[]durationInMinutes
numberYes
itemsegments[]operator
objectYes
itemsegments[]operatorcode
stringYes
itemsegments[]operatorname
stringYes
itemsegments[]operatorimageUrl
stringNullable
itemsegments[]service
objectYes
itemsegments[]servicename
stringNullable
itemsegments[]serviceimageUrl
stringNullable
itemoffers
arrayYes
itemoffers[]offerId
stringYes
itemoffers[]parts
arrayYes
itemoffers[]parts[]segments
arrayYes
itemoffers[]parts[]segments[]segmentId
stringYes
itemoffers[]parts[]segments[]amenities
arrayYes
itemoffers[]parts[]segments[]amenities[]
string[]Yes
itemoffers[]parts[]flexibility
enum
non_flexsemi_flexfull_flex
Yes
itemoffers[]parts[]comfortClass
enum
basicstandardhighbestunknown
Yes
itemoffers[]parts[]serviceClass
enum
basicstandardhighbestunknown
Yes
itemoffers[]parts[]conditions
arrayYes
itemoffers[]parts[]conditions[]type
stringYes
itemoffers[]parts[]conditions[]condition
stringYes
itemoffers[]parts[]conditions[]note
stringNo
itemoffers[]parts[]conditions[]conditionKey
stringYes
itemoffers[]parts[]cancellationPolicies
arrayYes
itemoffers[]parts[]cancellationPolicies[]__typename
objectYes
itemoffers[]parts[]cancellationPolicies[]__typenametype
enum
CancellationByPercentageCancellationByPercentChargeCancellationByFixedChargeFullCancellableNonCancellable
Yes
itemoffers[]parts[]cancellationPolicies[]description
stringNo
itemoffers[]parts[]cancellationPolicies[]minimum_minutes_before_departure
numberNo
itemoffers[]parts[]cancellationPolicies[]maximum_minutes_before_departure
numberNo
itemoffers[]parts[]cancellationPolicies[]minimum_minutes_after_departure
numberNo
itemoffers[]parts[]cancellationPolicies[]maximum_minutes_after_departure
numberNo
itemoffers[]parts[]cancellationPolicies[]percentage
numberNo
When __typename is CancellationByPercentage
itemoffers[]parts[]cancellationPolicies[]chargePercentage
numberNo
When __typename is CancellationByPercentCharge
itemoffers[]parts[]cancellationPolicies[]chargeAmount
numberNo
When __typename is CancellationByFixedCharge
itemoffers[]parts[]cancellationPolicies[]currency
string
Format: ISO 4217 code
No
When __typename is CancellationByFixedCharge
itemoffers[]parts[]cancellationPolicies[]perPerson
booleanNo
When __typename is CancellationByPercentCharge or CancellationByFixedCharge. Is optional
itemoffers[]parts[]cancellationPolicies[]perLeg
booleanNo
When __typename is CancellationByPercentCharge or CancellationByFixedCharge. Is optional
itemoffers[]parts[]isRefundable
booleanYes
itemoffers[]price
objectYes
itemoffers[]priceamount
numberYes
itemoffers[]pricecurrency
stringYes
itemoffers[]createdAt
string
Format: ISO 8601
Yes
itemoffers[]expiresAt
string
Format: ISO 8601
Yes

,

Response Body Schema (type=offers_search_completed)

type
enum
offers_search_completed
Yes

,

Response Body Schema (type=cancellation_policies)

type
enum
cancellation_policies
Yes
item
arrayYes
item[]conditionKey
stringYes
item[]policies
arrayYes
item[]policies[]__typename
objectYes
item[]policies[]__typenametype
enum
CancellationByPercentageCancellationByPercentChargeCancellationByFixedChargeFullCancellableNonCancellable
Yes
item[]policies[]description
stringNo
item[]policies[]minimum_minutes_before_departure
numberNo
item[]policies[]maximum_minutes_before_departure
numberNo
item[]policies[]minimum_minutes_after_departure
numberNo
item[]policies[]maximum_minutes_after_departure
numberNo
item[]policies[]percentage
numberNo
When __typename is CancellationByPercentage
item[]policies[]chargePercentage
numberNo
When __typename is CancellationByPercentCharge
item[]policies[]chargeAmount
numberNo
When __typename is CancellationByFixedCharge
item[]policies[]currency
string
Format: ISO 4217 code
No
When __typename is CancellationByFixedCharge
item[]policies[]perPerson
booleanNo
When __typename is CancellationByPercentCharge or CancellationByFixedCharge. Is optional
item[]policies[]perLeg
booleanNo
When __typename is CancellationByPercentCharge or CancellationByFixedCharge. Is optional

,

Response Body Schema (error=true)

error
booleanYes
code
stringYes
statusCode
numberYes

Errors

  • 400 for validation or unknown fields.
  • 401 or 403 for invalid API credentials.
  • 500 internal_communication_error or unknown_error for provider failures.
  • Stream errors use an object with error: true, a business code, and statusCode.

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
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"}]}'