What dictates how many journeys are returned by the Journeys planner API?

Hi! First time user of the Unified API here. I’d like to understand what dictates the number of journeys that are returned by the Journeys planner endpoint.

For context, I am just wanting to get real-time departures from one station to another on the Elizabeth line. I have noticed that the most journeys that will ever be returned are 3, and this is fine, but sometimes only 2 are returned, sometimes 1. It’s not very consistent and I’m unsure on how to keep it consistent. I’ve checked CityMapper in these cases and have seen there are more than 1 or 2 upcoming departures, so I’m unsure why these aren’t returned by the API.

Is it to do with a certain timeframe within which trains will be departing? Or is it to do with whether a train has left its origin station, for example?

I would love to keep it consistent using any parameters that are available, but I’m not sure if what I’m wanting to do actually exists - e.g. I’d love to ensure there are always 3 journeys returned (if they exist before the end of the timetable).

Any tips or advice appreciated!

Hello and welcome to the forum!

There are several reasons why fewer than three journeys are sometimes returned. This could be because other journeys are significantly longer than the fastest route or because they require many changes. To keep the system efficient, it will sometimes not return such journeys and we therefore cannot guarantee that three journeys will always be returned.

If you have specific examples of journey requests that produce an unusually small number of results, we can take a look at them.

One thing you might like to try is to use the Alternative Routes feature, which may return additional results: