Using API for mobile app

Can Unified API be used for mobile app?

Hello and welcome to the forum!

Yes, the Unified API can absolutely be used for mobile apps. Please note our terms and conditions and register for an API key if you don’t yet have one.

If you need any help, just ask. :slight_smile:

I have registered for an API key.
My developer and I are experimenting with REST API to integrate TFL Plan a Journey into a mobile app for tourists and visitors.

In the request params, it asks for app key.
We tried the Primary and Secondary keys in Profile but it does not work.
Any advice on how to query will be helpful.

Hi, you should be able to make an HTTP GET request to the following URL, for example, replacing YOUR_APP_KEY with your app_key:

If you still experience issues, please provide an example of a request which is failing (but remove your app_key before posting here), and let us know the status code that is returned and any error message you receive.

Yes. I will app key.
I will attach JSON output from Postman and send in next post.

We have developed a London trip planner app for tourists and visitors to London.
The app allows users to add places to visit on their trip:

Using TFL APIs, we would like to add travel feature and offer users public transport info with live feed on how to get from their current location to their desired destinations by bus, tube, train or by cycle - similar to TFL Journey Planner to:
Allow planning from/to stations, stops, places of interest, geolocations, addresses or postcodes

For example, display choice of routes to get to Borough Market to HMS Belfast by bus or tube and departure and arrival times.

Please advise how to use API to:

Get all valid routes for all lines, including the name and id of the originating and terminating stops for each route.

Get all valid routes for all lines, including the name and id of the originating and terminating stops for each route.

Please advise the correct GET request to fetch this data.
Thank you.

To get all the routes, you first get /Line/Meta/Modes to get a list of transport modes, then using the ones that have isScheduledService set, get /Line/Mode/{modes}/Route to get a list of all timetabled routes. Then, for each line returned, get /Line/{id}/Route/Sequence/{direction}, where direction is outbound and inbound (unless isOutboundOnly flag is set). Note that this gives you routes only, not timetables and not live information, each of which requires a different set of requests.

However, this is NOT the way to go in a mobile app. For a start it would take far too long - you’re looking at 1800 or so requests to get the lot, about the same for timetables. As far as live arrival/departure information goes, by the time you had downloaded the information for every stopPoint/Station it would be out of date

Given what you say you are trying to do, I believe that you should be looking at /Journey/JourneyResults calls and not trying to reinvent the wheel.

1 Like

Thanks for sound advice.
We will look at /Journey/journeyResults.
At present the app links to TFL site in external browser:

But we would like to integrate APIs to display travel info in Trip Planner UI.


Get all valid routes for all lines, including the name and id of the originating and terminating stops for each route.


Just loop though the lines like this looking for “inbound” and “outbound”.

and replace _______ with the line name and $$$$$ with inbound or outbound.

I store them Dijkstra format for finding whatever you might want. They don’t change often so you can cache them for ages.

Bus routes - get a list of them all and store them and you can do the same with RB1 etc.

If you really want EVERYTHING, it’s here in XML TransXchange format -

We recommend using the JourneyResults method of our Unified API. This will ensure the results you get are as up-to-date as possible, and will reflect any disruptions on the network.

The parameters are described on this page:

Please let us know if you have any questions about using this.

By the way, I should note that the Journey Planner widget (which seems to be what was shown in a couple of screenshots above) is no longer supported and may stop working at any time.

1 Like

We will follow your advice on how to get and display Journey info in the app.

Yes. We will use JourneyResults and create our own widget to link from Trip Planner page.