Journey List Embed
The Journey List embed shows a list of journeys between two locations, with streamed results and prices.
It fetches the journeys from the All Aboard API. When the user clicks "Find tickets" on a journey, it calls journeyOffer and shows the offers. When the user selects a journey offer, it emits the aa-journey-list-select event, with the id of the journey offer in the event's detail.
If your own code already has the journeys, the Journey Cards show them without an API key.
The list is responsive and adapts to the user's screen size. Scroll down to see an example.
Getting started
First load the script. It is a standard JavaScript module, so the script tag needs type="module".
<script
src="https://allaboard.eu/embed/aa-journey-list.js"
type="module"></script>The script registers the custom element aa-journey-list. You can then use it like any other HTML element.
<aa-journey-list
publicApiKey="your-api-key-here"
origin="4X7ZaxZO"
destination="ObB7ATsZ"
departureDate="2026-12-23"></aa-journey-list>Cost centers and API keys
This embed runs on public web pages, so anyone who views the page can see its publicApiKey. Give it a key with only the base scope and the payment gateway scope: live and live:payments:stripe, or test and test:payments:stripe when testing. Never use a key that can read your orders or spend your wallet. Configuring embeds safely explains why.
The Journey List only searches for journeys and prices them. It doesn't create a booking, an order or a payment. You do that in your own code, with the offer id from the aa-journey-list-select event.
Attributes
Set these attributes on the <aa-journey-list> element to tell it which journeys to show.
| Name | Description | Required |
|---|---|---|
publicApiKey |
Your public API key. You can find your API key in the Dashboard. | Yes |
origin |
The uid of the origin location. Get location uids from the locations query. |
Yes |
destination |
The uid of the destination location. Get location uids from the locations query. |
Yes |
departureDate |
The departure date, formatted as YYYY-MM-DD. |
Yes |
disabled |
Disables the buttons in the journey list. This is a boolean attribute: add it to disable the buttons, and remove it to enable them. | No |
auto-fetch-offers |
When set, the journey list fetches offers automatically for the journeys that are in view. | No |
direct |
Show only direct connections. | No |
getOfferButtonLabel |
The label to show on the button that gets an offer. Defaults to "Find tickets". | No |
gettingOfferButtonLabel |
The label to show on the button while getting an offer. Defaults to a loading indicator with no text. | No |
selectOfferButtonLabel |
The label to show on the button that selects an offer. Defaults to "Select". | No |
selectedOfferButtonLabel |
The label to show on the button after an offer is selected. Defaults to "Selected". | No |
sessionId |
The session ID to use when calling the API. Can be any unique string that identifies the session. Used for analytics and troubleshooting. | No |
currency |
The currency to display prices in. For example, EUR or GBP. Defaults to the currency of the language. For example, DKK for da and SEK for sv. |
No |
language |
The language of the list: en (the default), da, de, es, fr, nb or sv. |
No |
theme |
The color theme: light (the default), dark, or auto, which follows the visitor's light or dark system setting. |
No |
passengers |
The default set of passengers to use when fetching offers. See below for details. | No |
The passengers attribute
There are two ways to set the passengers:
- As an attribute value: a comma-separated list of passenger types, each optionally followed by a dot and an age, such as
ADULT,YOUTH.8. - As a property, set directly on the
<aa-journey-list>element using JavaScript.
<aa-journey-list
publicApiKey="your-api-key-here"
origin="4X7ZaxZO"
destination="ObB7ATsZ"
departureDate="2026-12-23"
passengers="ADULT,YOUTH.8"></aa-journey-list>const list = document.querySelector('aa-journey-list')
list.passengers = [{ type: 'ADULT' }, { type: 'YOUTH', age: 8 }]const list = document.querySelector('aa-journey-list')
list.passengers = [{ type: 'ADULT', travelCards: [{ code: 'aatc_interrail' }] }]Passengers set from JavaScript can have travel cards, so that discount card holders and passholders are priced and booked correctly.
Events
Listen for the Journey List's events with addEventListener, for example to show journey details or create a booking when a journey is selected.
| Name | Description |
|---|---|
aa-journey-list-rendered |
Emitted when the journey list has received a new Journey and updated. The event's detail has the journeyIds array. |
aa-journey-list-offer-request |
Emitted when a JourneyOffer is requested. The event's detail has the journeyId of the journey the offer is requested for. |
aa-journey-list-offer-received |
Emitted when a JourneyOffer is received. The event's detail has the journeyOfferId, which you can use to fetch the journey or create a booking. |
aa-journey-list-select |
Emitted when a JourneyOffer is selected. The event's detail has the journeyOfferId, which you can use to fetch the journey or create a booking. |
aa-journey-list-error |
Emitted when an error occurs. The event's detail has the error, which you can use to show an error message. |
Slots
Custom elements use slots to show your own markup inside the element.
error
Use the error slot to show your own message when the journey list fails to load, or when there are no journeys.
<aa-journey-list
publicApiKey="your-api-key-here"
origin="4X7ZaxZO"
destination="ObB7ATsZ"
departureDate="2026-12-23">
<p slot="error">No journeys found</p>
</aa-journey-list>Example
Change the origin, destination, currency and language to see the list update.