Skip to content
Docs

Subway departures

One row each time a train leaves a station, recorded live from the MTA's subway feeds since October 2026.

Rows
398,192
Size
7.5 MB
Covers
2026-10-04 onward
Updated
Daily
Source
MTA subway GTFS-realtime feeds
License
CC BY 4.0
Fileshttps://data.transitlab.nyc/v1/subway_stop_events/year=YYYY/month=MM/YYYY-MM-DD.parquetOne file a day, 2 so far. In the database as transitlab.subway_stop_events.

Rows and size from catalog.json, 2026-10-06.

One train leaving one station. Every 10 seconds our collector reads the MTA’s eight subway feeds. Each feed lists, for every train, the stops it has yet to make. When a stop drops off a train’s list, the train has just left it, and we write a row with departed_at set to the feed time of that snapshot.

When a whole trip vanishes from the feed, its remaining stops get rows with event = 'trip_ended' and departed_at set to when the trip was last seen. Leave those out of run-time work.

This is the source of subway segment times from October 2026 on.

-- How long did southbound L trains take from Union Sq to 3 Av yesterday?
WITH dep AS (
SELECT trip_uid, stop_id, max(departed_at) AS departed_at -- the last departure is the real one
FROM transitlab.subway_stop_events
WHERE event = 'departed' AND route_id = 'L'
AND stop_id IN ('L03S', 'L05S')
AND departed_at >= current_date - 1 AND departed_at < current_date
GROUP BY trip_uid, stop_id
)
SELECT a.trip_uid,
a.departed_at AT TIME ZONE 'UTC' AT TIME ZONE 'America/New_York' AS left_union_sq,
date_diff('second', a.departed_at, b.departed_at) AS seconds
FROM dep a JOIN dep b USING (trip_uid)
WHERE a.stop_id = 'L03S' AND b.stop_id = 'L05S'
ORDER BY left_union_sq;
row_idvarchar

Stable ID of the row. If a row appears twice, keep one.

observed_attimestamp

When we wrote the row (UTC).

eventvarchar

departed, or trip_ended when a whole trip dropped out of the feed.

feedvarchar

Which of the MTA's subway feeds the train came from.

trip_uidvarchar

Our ID for the train trip.

trip_idvarchar

MTA trip ID.

route_idvarchar

Subway route.

start_datevarchar

Service date, YYYYMMDD.

stop_idvarchar

GTFS stop ID, with direction.

arrivaltimestamp

The MTA's last predicted arrival (UTC).

departuretimestamp

The MTA's last predicted departure (UTC).

first_seentimestamp

First time the stop appeared in the feed (UTC).

last_seentimestamp

Last time it appeared (UTC).

departed_attimestamp

Feed time of the first snapshot without the stop: just after the train left (UTC).

  • Use the last departure per trip and stop. The feed sometimes drops a stop and adds it back, so about 3% of trip-stops have more than one departed row. The last one is right; the first can be minutes early.
  • Times are UTC without a zone. Write departed_at AT TIME ZONE 'UTC' to get a proper timestamp before you turn it into New York time.
  • Times are within about 10 to 15 seconds. That is how often the feed refreshes. Averages over many trains are sharper than that.
  • How we checked it against the older archive: Our subway collector.