Metra GTFS API

The Metra GTFS API is hosted at https://gtfsapi.metrarail.com and provides both RAW data and JSON. With all of our feeds, and as part of the conditions under the License Agreement, you may retrieve data directly from Metra's APIs. However, you must redistribute the data through your own host or web service and not direct your application users to access data directly from Metra's servers.

GTFS Static Data

The static file is updated periodically, reflecting the most recent schedule for Metra trains. For convenience, we provide a text file with the date and time that the schedule was published. The schedule may update at any given time, so developers are encouraged use this to determine if it is necessary to grab and rebuild the schedule. For a planned schedule update, the new file will be published at 3:00:00 AM; however, occasionally there may be a sudden change that requires us to push a new schedule immediately. Checking the published.txt file every few minutes will ensure you get the most recent schedule regardless of when we publish it.

For convenience, we also provide the schedule in JSON - this data will update whenever we publish a new schedule. Additionally, we provide the stop times for any given trip in the current schedule. These can be obtained by passing the trip id in the request for stop times (/gtfs/schedule/stop_times/<TRIP_ID>).

Raw GTFS Feeds

  • GET - /gtfs/raw/schedule.zip

Schedule Publishing Time

  • /gtfs/raw/published.txt

JSON GTFS Feeds

  • /gtfs/schedule/stops
  • /gtfs/schedule/stop_times
  • /gtfs/schedule/trips
  • /gtfs/schedule/shapes
  • /gtfs/schedule/routes
  • /gtfs/schedule/calendar
  • /gtfs/schedule/calendar_dates
  • /gtfs/schedule/agency
  • /gtfs/schedule/stop_times/<TRIP_ID>

GTFS Realtime Data

Realtime data is provided in both RAW and JSON format. This data is updated every 30 seconds, so there is no need to check any more frequently. If at any time realtime data is not available for any schedule or trip, it is assumed that the static schedule is correct.

Alerts - regardless of the active_period defined in an alert, if an alert is in the feed it is assumed to be active. Conversely, if an alert is not in the feed (regardless of the end specified in active_period) it is assumed to no longer be active.

Vehicle Positions - on occasion when a train is underground or at a terminal it will lose sight with the GPS satellites. When a train is scheduled to have begun a trip and no vehicle position is available it is assumed that the train is in route.

Trip Updates - trip updates will provide realtime information for the scheduled trip. When a train is tracking (reporting GPS coordinates) a trip update will be provided for the trip. If no trip update is available and a trip is scheduled to have begun, it is assumed that the train is running according to schedule. Note that a trip update does not always indicate a running train. Trip updates may be provided hours ahead of time in an instance of an annulled or added train. Also, in cases where the trip is modified such as having a stop added or removed, a trip update will be available regardless of the start time for the trip.

Raw GTFS Feeds

  • GET - /gtfs/raw/positionUpdates.dat
  • GET - /gtfs/raw/tripUpdates.dat
  • GET - /gtfs/raw/alerts.dat

JSON GTFS Feeds

  • /gtfs/alerts
  • /gtfs/positions
  • /gtfs/tripUpdates