Finding Interrail Passes
A rail pass lets the passenger travel on a number of days within a validity period, instead of on one booked train. You find the passes for your passengers with getPassBundles.
What are rail passes?
There are two kinds of Interrail pass:
- Interrail Global Pass: Travel in 33 European countries
- Interrail One Country Pass: Travel within a single country
A pass suits travelers who visit several places, travel a lot over several days or weeks, or don't want to be tied to specific trains. For a single journey on fixed dates, regular tickets are usually the better choice. See Finding Journeys.
Pass bundles
The API returns passes as bundles (PassBundle). A bundle is the cheapest combination of passes that covers all your passengers, based on their types and ages.
nationality and countryResidence don't affect the search. They are collected as booking requirements and checked when you call createOrder. It fails with INVALID_COUNTRY_FOR_PASS or RESIDENCE_MATCHES_PASS_COUNTRY if the pass isn't valid for the passenger's country of residence.
Getting pass bundles
Use the getPassBundles query to find the passes for your passengers:
Example: Get all available passes
query GetInterrailBundles {
getPassBundles(passengers: [{ type: ADULT }, { type: YOUTH, age: 9 }]) {
id
class
product
price {
amount
currency
}
travelDayCount
validityPeriod
}
}Not every product is sold for every passenger type. Some One Country Passes have no senior price, for example. Products that don't cover all your passengers are left out, so you may get fewer products than you expect, or an empty list.
Filtering pass results
Use the filter argument to narrow the results.
Filter by product
Set product to get one pass product, such as the Interrail Global Pass:
Example: Get only Interrail Global Passes
query GetInterrailBundles {
getPassBundles(
passengers: [{ type: ADULT }]
filter: { product: "interrail-global-pass" }
) {
id
class
product
price {
amount
currency
}
travelDayCount
validityPeriod
}
}Filter by class
Set class to get first class or second class passes only:
Example: Get only first class passes
query GetInterrailBundles {
getPassBundles(passengers: [{ type: ADULT }], filter: { class: "1stclass" }) {
id
class
product
price {
amount
currency
}
travelDayCount
validityPeriod
}
}Filter by campaign
Pass providers sometimes run campaigns, such as a Black Friday sale. Campaign passes are only returned when you ask for them with a campaignCode.
Query campaigns for the codes you can use. It only lists the campaigns you are allowed to sell, so every code it returns works as a campaignCode. Each campaign also lists the products it covers. A product's key, such as interrail-global-pass, is what you pass as product to narrow the results further.
Example: List the campaigns available to you
query GetCampaigns {
campaigns {
code
products {
key
name
}
}
}Campaigns have no name or description to display, so write your own labels for the codes. Products have a name that you can fall back on, but its language isn't guaranteed.
A campaign leaves the list when it ends, so read the list again from time to time instead of caching the codes. Bookings already made under the campaign aren't affected.
Campaign passes often have their own conditions, for example for refunds and validity, so check a pass's details before you sell it.
To get a campaign's passes, pass its code:
Example: Get Black Friday campaign passes
query GetInterrailBundles {
getPassBundles(
passengers: [{ type: ADULT }]
filter: { campaignCode: "black-friday", product: "interrail-global-pass" }
) {
id
class
product
price {
amount
currency
}
travelDayCount
validityPeriod
}
}Comparing passes to tickets
getPassBundlesForJourneyOffer returns the passes that work for a specific journey, so you can show the traveler a pass next to the ticket price. The passes it returns:
- Are valid in every country on the route
- Have enough travel days for the journey
- Match the passengers
Example: Compare passes to tickets for a journey
query GetApplicablePassBundles {
getPassBundlesForJourneyOffer(
journeyOffer: "521cf6b3-945b-4dd5-8513-aa4ff0b64b72"
passengers: [{ type: ADULT }]
) {
id
class
product
price {
amount
currency
}
travelDayCount
validityPeriod
}
}Using the Rail Pass List embed
If you don't want to build the interface yourself, use the Rail Pass List embed. It shows the passes you choose, and lets the user pick one and buy it.
<aa-passbundle-list
publicApiKey="your-api-key-here"
product="interrail-global-pass"
currency="EUR"></aa-passbundle-list>To show passes you have already fetched, use the Rail Pass Cards embed.