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

Obtener ofertas de un viaje

Obtén ofertas reservables para un viaje devuelto por la búsqueda.

Compartir

Obtén ofertas reservables para un viaje devuelto por la búsqueda.

Autenticación y headers

HeaderDescripción
AuthorizationBearer <secret_key>. Conserva el secret en el servidor y nunca lo escribas en logs del cliente.
X-Travelandz-Id<public_key>:<profile_code>, donde el profile code persistido tiene el formato dp_<12 alfanuméricos>.
Content-Typeapplication/json para peticiones con body JSON.

Petición

Path: gdsprovider actualmente es 0; journeyId viene de la búsqueda. Query opcional: language (en, es, zh) y returnCancellationPolicies (boolean).

Body requerido:

json
json
{"passengers":[{"type":"adult"},{"type":"senior"}]}

Schema de parámetros

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

Schema de query params

language
enum
eneszh
No
returnCancellationPolicies
booleanNo

Schema del body

passengers
array
passengers[]type
enum
youthadultsenior

Respuesta exitosa

Devuelve un objeto journey cuyos itinerarios contienen offers[]. Las ofertas incluyen offerId, partes, flexibilidad, clases, condiciones, políticas de cancelación y precio { amount, currency }.

Schema de respuesta

journey
object
journeygdsprovider
number
journeyjourneyId
string
journeyitinerary
array
journeyitinerary[]itineraryIndex
number
journeyitinerary[]segments
array
journeyitinerary[]segments[]segmentId
string
journeyitinerary[]segments[]departure
object
journeyitinerary[]segments[]departuredepartureAt
string
Formato: ISO 8601
journeyitinerary[]segments[]departurename
string
journeyitinerary[]segments[]departurelocationId
string
journeyitinerary[]segments[]departurecountry
string
journeyitinerary[]segments[]departurecountryCode
string
journeyitinerary[]segments[]arrival
object
journeyitinerary[]segments[]arrivalarrivalAt
string
Formato: ISO 8601
journeyitinerary[]segments[]arrivalname
string
journeyitinerary[]segments[]arrivallocationId
string
journeyitinerary[]segments[]arrivalcountry
string
journeyitinerary[]segments[]arrivalcountryCode
string
journeyitinerary[]segments[]identifier
string
journeyitinerary[]segments[]transport
enum
trainbusferry
journeyitinerary[]segments[]durationInMinutes
number
journeyitinerary[]segments[]operator
object
journeyitinerary[]segments[]operatorcode
string
journeyitinerary[]segments[]operatorname
string
journeyitinerary[]segments[]operatorimageUrl
stringNullable
journeyitinerary[]segments[]service
object
journeyitinerary[]segments[]servicename
stringNullable
journeyitinerary[]segments[]serviceimageUrl
stringNullable
journeyitinerary[]offers
array
journeyitinerary[]offers[]offerId
string
journeyitinerary[]offers[]parts
array
journeyitinerary[]offers[]parts[]segments
array
journeyitinerary[]offers[]parts[]segments[]segmentId
string
journeyitinerary[]offers[]parts[]segments[]amenities
array
journeyitinerary[]offers[]parts[]segments[]amenities[]
string[]
journeyitinerary[]offers[]parts[]flexibility
enum
non_flexsemi_flexfull_flex
journeyitinerary[]offers[]parts[]comfortClass
enum
basicstandardhighbestunknown
journeyitinerary[]offers[]parts[]serviceClass
enum
basicstandardhighbestunknown
journeyitinerary[]offers[]parts[]conditions
array
journeyitinerary[]offers[]parts[]conditions[]type
string
journeyitinerary[]offers[]parts[]conditions[]condition
string
journeyitinerary[]offers[]parts[]conditions[]note
stringNo
journeyitinerary[]offers[]parts[]conditions[]conditionKey
string
journeyitinerary[]offers[]parts[]cancellationPolicies
array
journeyitinerary[]offers[]parts[]cancellationPolicies[]__typename
object
journeyitinerary[]offers[]parts[]cancellationPolicies[]__typenametype
enum
CancellationByPercentageCancellationByPercentChargeCancellationByFixedChargeFullCancellableNonCancellable
journeyitinerary[]offers[]parts[]cancellationPolicies[]description
stringNo
journeyitinerary[]offers[]parts[]cancellationPolicies[]minimum_minutes_before_departure
numberNo
journeyitinerary[]offers[]parts[]cancellationPolicies[]maximum_minutes_before_departure
numberNo
journeyitinerary[]offers[]parts[]cancellationPolicies[]minimum_minutes_after_departure
numberNo
journeyitinerary[]offers[]parts[]cancellationPolicies[]maximum_minutes_after_departure
numberNo
journeyitinerary[]offers[]parts[]cancellationPolicies[]percentage
numberNo
When __typename is CancellationByPercentage
journeyitinerary[]offers[]parts[]cancellationPolicies[]chargePercentage
numberNo
When __typename is CancellationByPercentCharge
journeyitinerary[]offers[]parts[]cancellationPolicies[]chargeAmount
numberNo
When __typename is CancellationByFixedCharge
journeyitinerary[]offers[]parts[]cancellationPolicies[]currency
string
Formato: ISO 4217 code
No
When __typename is CancellationByFixedCharge
journeyitinerary[]offers[]parts[]cancellationPolicies[]perPerson
booleanNo
When __typename is CancellationByPercentCharge or CancellationByFixedCharge. Is optional
journeyitinerary[]offers[]parts[]cancellationPolicies[]perLeg
booleanNo
When __typename is CancellationByPercentCharge or CancellationByFixedCharge. Is optional
journeyitinerary[]offers[]parts[]isRefundable
boolean
journeyitinerary[]offers[]price
object
journeyitinerary[]offers[]priceamount
number
journeyitinerary[]offers[]pricecurrency
string
journeyitinerary[]offers[]createdAt
string
Formato: ISO 8601
journeyitinerary[]offers[]expiresAt
string
Formato: ISO 8601
journeystopovers
array
journeystopovers[]stopoverIndex
numberNo
journeystopovers[]durationInMinutes
numberNo
journeyroute
array
journeyroute[]itineraryIndex
numberNo
journeyroute[]stopoverIndex
numberNo
journeycomfortClasses
array
journeycomfortClasses[]
enum[]
journeyaccommodations
array
journeyaccommodations[]
enum[]
journeyticketClasses
array
journeyticketClasses[]comfortClass
enum
basicstandardhighbestunknown
journeyticketClasses[]serviceClass
enum
basicstandardhighbestunknown

Errores

  • 400 por validación o campos desconocidos.
  • 401 o 403 por credenciales API inválidas.
  • 500 internal_communication_error o unknown_error por fallos del proveedor.
  • 无法找到报价时返回 404 zero_journeys_found

Notas de uso

Usa cada offerId en el endpoint de pre-reserva. Las ofertas expiran; continúa el flujo antes de expiresAt.

Ejemplo cURL

bash
bash
curl --request POST \
  --url "https://api.sandbox.travelandz.com/v1/trains/journeys/0/journey_123/offers?language=en&returnCancellationPolicies=true" \
  --header "Authorization: Bearer $TRAVELANDZ_SECRET_KEY" \
  --header "X-Travelandz-Id: $TRAVELANDZ_PUBLIC_KEY:$TRAVELANDZ_PROFILE_CODE" \
  --header "Content-Type: application/json" \
  --data '{"passengers":[{"type":"adult"}]}'