Receive each matching train journey progressively as NDJSON.
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 JSON body as POST /v1/trains/journeys.
Request Body Schema
originLocation id returned by
/locations.destinationLocation id returned by
/locations.datepassengerspassengers[]typeyouth = 0–27 years, adult = 28–59 years, senior = 60+ years.Success response
The response is application/x-ndjson. Each non-error line is a complete journey object without a wrapper.
Response Body Schema
gdsproviderjourneyIditineraryitinerary[]itineraryIndexitinerary[]segmentsitinerary[]segments[]segmentIditinerary[]segments[]departureitinerary[]segments[]departuredepartureAtitinerary[]segments[]departurenameitinerary[]segments[]departurelocationIditinerary[]segments[]departurecountryitinerary[]segments[]departurecountryCodeitinerary[]segments[]arrivalitinerary[]segments[]arrivalarrivalAtitinerary[]segments[]arrivalnameitinerary[]segments[]arrivallocationIditinerary[]segments[]arrivalcountryitinerary[]segments[]arrivalcountryCodeitinerary[]segments[]identifieritinerary[]segments[]transportitinerary[]segments[]durationInMinutesitinerary[]segments[]operatoritinerary[]segments[]operatorcodeitinerary[]segments[]operatornameitinerary[]segments[]operatorimageUrlitinerary[]segments[]serviceitinerary[]segments[]servicenameitinerary[]segments[]serviceimageUrlstopoversstopovers[]stopoverIndexstopovers[]durationInMinutesrouteroute[]itineraryIndexroute[]stopoverIndexcomfortClassescomfortClasses[]accommodationsaccommodations[]ticketClassesticketClasses[]comfortClassticketClasses[]serviceClassErrors
400for validation or unknown fields.401or403for invalid API credentials.500 internal_communication_errororunknown_errorfor provider failures.- A stream error line can include
error: true,code: zero_journeys_found, andstatusCode: 404.
Usage notes
Read the response line by line and call JSON.parse for each line. Do not parse the stream as one JSON document.
cURL example
bash
curl --request POST \
--url "https://api.sandbox.travelandz.com/v1/trains/journeys/stream" \
--header "Authorization: Bearer $TRAVELANDZ_SECRET_KEY" \
--header "X-Travelandz-Id: $TRAVELANDZ_PUBLIC_KEY:$TRAVELANDZ_PROFILE_CODE" \
--header "Accept: application/x-ndjson" \
--data '{"origin":"originId","destination":"destinationId","date":"2026-08-20","passengers":[{"type":"adult"}]}'