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
Sí
Currently 0
journeyId
stringSí
Journey id returned by the journey search.

Schema de query params

language
enum
eneszh
No
returnCancellationPolicies
booleanNo

Schema del body

passengers
arraySí
passengers[]type
enum
youthadultsenior
Sí

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
objectSí
journeygdsprovider
numberSí
journeyjourneyId
stringSí
journeyitinerary
arraySí
journeyitinerary[]itineraryIndex
numberSí
journeyitinerary[]segments
arraySí
journeyitinerary[]segments[]segmentId
stringSí
journeyitinerary[]segments[]departure
objectSí
journeyitinerary[]segments[]departuredepartureAt
string
Formato: ISO 8601
Sí
journeyitinerary[]segments[]departurename
stringSí
journeyitinerary[]segments[]departurelocationId
stringSí
journeyitinerary[]segments[]departurecountry
stringSí
journeyitinerary[]segments[]departurecountryCode
stringSí
journeyitinerary[]segments[]arrival
objectSí
journeyitinerary[]segments[]arrivalarrivalAt
string
Formato: ISO 8601
Sí
journeyitinerary[]segments[]arrivalname
stringSí
journeyitinerary[]segments[]arrivallocationId
stringSí
journeyitinerary[]segments[]arrivalcountry
stringSí
journeyitinerary[]segments[]arrivalcountryCode
stringSí
journeyitinerary[]segments[]identifier
stringSí
journeyitinerary[]segments[]transport
enum
trainbusferry
Sí
journeyitinerary[]segments[]durationInMinutes
numberSí
journeyitinerary[]segments[]operator
objectSí
journeyitinerary[]segments[]operatorcode
stringSí
journeyitinerary[]segments[]operatorname
stringSí
journeyitinerary[]segments[]operatorimageUrl
stringNullable
journeyitinerary[]segments[]service
objectSí
journeyitinerary[]segments[]servicename
stringNullable
journeyitinerary[]segments[]serviceimageUrl
stringNullable
journeyitinerary[]offers
arraySí
journeyitinerary[]offers[]offerId
stringSí
journeyitinerary[]offers[]parts
arraySí
journeyitinerary[]offers[]parts[]segments
arraySí
journeyitinerary[]offers[]parts[]segments[]segmentId
stringSí
journeyitinerary[]offers[]parts[]segments[]amenities
arraySí
journeyitinerary[]offers[]parts[]segments[]amenities[]
string[]Sí
journeyitinerary[]offers[]parts[]flexibility
enum
non_flexsemi_flexfull_flex
Sí
journeyitinerary[]offers[]parts[]comfortClass
enum
basicstandardhighbestunknown
Sí
journeyitinerary[]offers[]parts[]serviceClass
enum
basicstandardhighbestunknown
Sí
journeyitinerary[]offers[]parts[]conditions
arraySí
journeyitinerary[]offers[]parts[]conditions[]type
stringSí
journeyitinerary[]offers[]parts[]conditions[]condition
stringSí
journeyitinerary[]offers[]parts[]conditions[]note
stringNo
journeyitinerary[]offers[]parts[]conditions[]conditionKey
stringSí
journeyitinerary[]offers[]parts[]cancellationPolicies
arraySí
journeyitinerary[]offers[]parts[]cancellationPolicies[]__typename
objectSí
journeyitinerary[]offers[]parts[]cancellationPolicies[]__typenametype
enum
CancellationByPercentageCancellationByPercentChargeCancellationByFixedChargeFullCancellableNonCancellable
Sí
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
booleanSí
journeyitinerary[]offers[]price
objectSí
journeyitinerary[]offers[]priceamount
numberSí
journeyitinerary[]offers[]pricecurrency
stringSí
journeyitinerary[]offers[]createdAt
string
Formato: ISO 8601
Sí
journeyitinerary[]offers[]expiresAt
string
Formato: ISO 8601
Sí
journeystopovers
arraySí
journeystopovers[]stopoverIndex
numberNo
journeystopovers[]durationInMinutes
numberNo
journeyroute
arraySí
journeyroute[]itineraryIndex
numberNo
journeyroute[]stopoverIndex
numberNo
journeycomfortClasses
arraySí
journeycomfortClasses[]
enum[]Sí
journeyaccommodations
arraySí
journeyaccommodations[]
enum[]Sí
journeyticketClasses
arraySí
journeyticketClasses[]comfortClass
enum
basicstandardhighbestunknown
Sí
journeyticketClasses[]serviceClass
enum
basicstandardhighbestunknown
Sí

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