Getting Offers
Once you've found a journey, the next step is getting pricing options, what we call offers. An offer represents a specific way to travel that journey, with a price, fare type, and service level.
What is an Offer?
An offer is a pricing option for a journey. Each offer includes:
- Price: The total cost for your passengers
- Fare type: How flexible the ticket is (can you change or cancel?)
- Service class: The level of comfort (standard, first class, etc.)
- Reservations: Whether seat reservations are included or required
A single journey typically has multiple offers, giving travelers choices between price, flexibility, and comfort. For example:
- A low-cost, non-refundable option
- A flexible, refundable option (usually more expensive)
- A first-class option with guaranteed seats
Getting Offers for a Journey
Use the getJourneyOffer query (or subscription) to get pricing for a journey. You'll need:
- The journey ID (from your search results)
- Passenger information (number and types of travelers)
You can include up to five passengers in a single offer request. This works with all train operators.
Use subscriptions for better UX
Getting offers can take up to 30 seconds because train operators have slow systems. Use WebSocket subscriptions to stream results as they arrive. This lets you show progress to users and display offers incrementally. See Subscriptions for details.
Example: Get offers for a journey
graphql
subscription GetJourneyOffer {
getJourneyOffer(
journey: "51fb0ff4-f9b3-46dd-a099-b09b800b68d1"
passengers: [{ type: ADULT }]
) {
id
status
itinerary {
__typename
... on SegmentCollection {
status
segments {
departureAt
origin {
name
countryCode
}
}
offers {
price {
amount
currency
}
parts {
... on AdmissionPart {
conditions {
description
type
}
flexibility
serviceClass
comfortClass
}
... on ReservationPart {
conditions {
description
type
}
flexibility
comfortClass
accommodation {
type
}
}
}
}
}
... on Stopover {
location {
name
countryCode
}
}
}
}
}subscription GetJourneyOffer {
getJourneyOffer(
journey: "eebc0062-d845-46d7-9f77-5653c1805d04"
passengers: [{ type: ADULT }]
) {
id
status
itinerary {
__typename
... on SegmentCollection {
status
segments {
departureAt
origin {
name
countryCode
}
}
offers {
price {
amount
currency
}
parts {
... on AdmissionPart {
conditions {
description
type
}
flexibility
serviceClass
comfortClass
}
... on ReservationPart {
conditions {
description
type
}
flexibility
comfortClass
accommodation {
type
}
}
}
}
}
... on Stopover {
location {
name
countryCode
}
}
}
}
}Understanding Offer Parts
Offers consist of parts that describe what's included. The two main types are:
Admission Parts
The right to travel: the basic ticket. This includes:
- Flexibility: Can you change or cancel? (
FULL_FLEX,SEMI_FLEX,NON_FLEX) - Service class: Standard, high-speed, premium, etc.
- Comfort class: First class, second class, etc.
Reservation Parts
A reserved seat or accommodation. This includes:
- Flexibility: Same as admission parts
- Comfort class: The class of the reserved seat
- Accommodation: Type of reservation (seat, couchette, sleeper, etc.)
Most offers include both admission (the right to travel) and reservation (a specific seat). Some journeys only require admission. You can sit anywhere in your class.
Passenger Requirements
When requesting offers, provide passenger information:
- For adults: Age or birth date is optional
- For youth/seniors: Age or birth date is required (for discount eligibility)
The API uses this information to calculate correct pricing and ensure passengers qualify for age-based discounts.
Offer Availability
Finding a journey doesn't guarantee offers are available. The API checks real-time availability with train operators, and sometimes:
- Tickets aren't on sale yet (too far in advance)
- Tickets are sold out (popular routes, last-minute bookings)
- The exact journey isn't available (but similar alternatives might be)
When offers are available, they may have slight timing variations from your original journey search. The overall route stays the same, but departure times might shift slightly. The API ensures:
- Safe connection times between trains
- The same comfort level
- The same overall itinerary
Choosing Which Journey to Price
When you search for journeys, you'll get multiple options for the same day. Which one should you price? Here are some strategies:
Filter by Journey Type
If you know what type of journey your users want, filter during the search:
SMART(default): Most comfortable, may include overnight stopsNON_STOP: Fastest route, but may be less comfortableBLUEPRINT: Pre-defined expert itineraries
See Finding Journeys for details on filtering.
Use Journey Ratings
The API includes a rating system that scores journeys based on travel time, comfort, connection quality, and more. Ratings range from 0 to 1, where 1 is the best possible journey.
Use getJourneyRatings to compare multiple journeys and pick the highest-rated option:
Example: Compare journey ratings
graphql
query GetJourneyRatings {
getJourneyRatings(
journeys: [
"cbbfca3f-6494-4a31-a399-2acac2f4708f"
"69e2df61-61e3-4e6f-a023-042cb35ce0ca"
"46cee640-b96b-418f-961f-a1eebb229b90"
]
)
}query GetJourneyRatings {
getJourneyRatings(
journeys: [
"8407cb04-b38c-4009-bc71-485b4fb1122b"
"c9c4cb0c-cb6d-43f1-b350-d14faa13df45"
"39d77ea7-3649-4481-9433-ec795fa76a09"
]
)
}Let Users Choose
For user-facing applications, show multiple journey options and let users pick. Display:
- Departure and arrival times
- Number of changes
- Total travel time
- Journey type (if helpful)
Then price the journey the user selects.
Responsible API usage
The All Aboard API operates on fair use principles. Only request offers for journeys you're reasonably confident users will book. See API Usage and Look-to-Book for details on our fair use policy.
Next Steps
Once you have offers, the next step is creating a booking. See Booking Tickets to learn how to:
- Create a booking from an offer
- Add passenger details
- Select specific offers and seat preferences
- Complete the purchase