Metro Bus & Rail Real-time Arrivals Overview

Metro’s Realtime Application Programming Interface (API) lives at It gives you access to the positions of Metro vehicles on their routes in real time.

The Realtime API is a RESTful web service designed to serve bus location data gathered by our Advanced Transportation Management System (ATMS) and the new Nextrip prediction engine. This is the result of years of difficult work refining the information we collect from the GPS trackers on every bus. Sometimes that data arrives too late to give us useful information. Our busses serve 1433 square miles. Whenever the buses travel into a radio shadow we need to make a prediction about the location of the bus. This is where Nextrip comes into play.

Our Nextrip service is provided by NextBus, if you are familiar with their XML structure — you are welcome to retrieve the data from them.

  • Please review NextBus’ XML Documentation
  • Agency ID for Metro Bus = lametro
  • Agency ID for Metro Rail = lametro-rail

You may now easily build and deploy custom applications using Metro’s data as a foundation. If you want to build a mobile application that plots the position of Metro’s Rapid busses on a map then this is the API for you. The interface gives your program access to collections and elements. Collections retrieve lists of element URIs. Element URIs retrieve a representation of the element. Only HTTP GET operations are allowed.

This new section of the site is here to document the interface and give you some examples of how you might use it. We need more examples! Please help us help you by including your code snippets in the comments area.

Try it out and let us know what you think. We hope you enjoy it!

-Metro Developer

Media types available from

The API delivers three different flavors of data: XML, JSON, and JSONP. This table lists the formats and their MIME types.

MIME type Description


XML is an encoded document format with arbitrary structure best consumed by machines.


JSON (an acronym for JavaScript Object Notation) is a lightweight text-based open standard designed for the exchange of human-readable data. This is the default.


Also known as JSON-P or JSON with padding. This is a JSON payload wrapped in a callback function. JSON-P is designed to be evaluated in the browser within a <script> element.

Metro’s Realtime API Collections

The interface is divided into four collections: Agency, Routes, Stops, and Vehicles. Each collection returns a list of elements. The element IDs tacitly suggest the URL for the element.

Method Description


“lametro” is the only available Agency element (for now). Agency ID is case-sensitive, and should be all lower-cased.


A list of routes available at the agency.


A list of stops served by the route.


A list of the current position of all vehicles belonging to the agency.

Consider these examples. The first retrieves a collection of routes operated by agency LA Metro. The second retrieves predictions for element stop 6033 . These links open in a new browser window. Go ahead and try them!

Check the examples page for more.

Methods available for most elements

Method Description


General information about the element.


Service update, alerts, and other messages relevant to the element.


Predictions for the element.

Links to documentation

Use JSON-P if you’re writing JQuery code that requires a callback function.

Page Description
This page
Route methods
Grab bag of examples

13 thoughts on “Metro Bus & Rail Real-time Arrivals Overview

  1. I see that the RealTime API got posted about less than a week ago.

    Does that impact the developer challenge deadline? Also where can the documentation for NextBus webservice be found?

    • Hi reggiedigital,

      That’s right–we published the Realtime API yesterday. As far as I know this will not change any deadlines.

      The Realtime API is your connection to our Nextrip webservice. Sorry for the confusion.

      Good luck–let us know how it goes!

  2. Hello,

    I had two questions relating to the developer competition:

    1. Is it necessary to use either the Metro Realtime API or Trip Planner API? Or is it fine if I host the Metro GTFS data on my own server and use it as the data source for my app?

    2. I see that neither the Realtime API or Trip Planner API contain geo-location information for bus stops. Are there any plans for the Metro team to add such information within the competition time-frame? Currently GTFS data is the only way I can get geo-location info for all bus stops.

    Thank you.

  3. I am trying to map arrival predictions, but can’t find a way to associate that with vehicle location. The vehicle locations only seem to have a bus ID, which isn’t associated with any other data.

    Thank you.

    • Hello rmartin,

      There’s more than one way to do it, but I would approach it this way. First get the current runs on the route then get the vehicle locations for those runs. Here’s an example using our default JSON data:

      which gives me run_ids 181_55_1 and 181_43_0. Now get the list of all vehicle positions and find those run ids:

      Filter the vehicle list by your run_ids and you’ll get what you want:

      {"seconds_since_report": 107,
      "run_id": "181_55_1",
      "longitude": -118.293037,
      "heading": 280.0,
      "route_id": "181",
      "predictable": true,
      "latitude": 34.101841,
      "id": "7184"}

      (Note that I only got data for one of the runs in this example. I assume that the other one isn’t on the road yet.)

      But now that you mention it, it would be handy to get the vehicle location using the run_id instead of the bus_id. I’ll put this in my feature request list.

      Hope that helps!

      • Doug,

        Thanks for the reply. I see how that method could be used to map the vehicle locations for all instances of a given run. But is there any way to isolate a single instance, for example, the next arriving bus? I’ve thought about using distance and heading, but this might be somewhat unreliable as most routes are not perfectly linear.

        I actually think bus_id is the most appropriate attribute for what I’m trying to accomplish. The only problem is that it’s missing from the prediction results, so once you get a prediction there’s no way of showing the location of just that bus on a map.

        Thanks again,
        Robert Martin

  4. Why are the rail lines not available through the API? Will these be available at any point on the API? Not having these available makes the transit map incredibly incomplete.

Leave a Reply