Contents
Documentation
REST API - Stop departures
Stop departures
The stop-departures endpoint provides information about when transit trips serve a given stop.
To instead see departures for a specific transit trip, use the trips endpoint. For an overview of trips and schedules, see the Trips & Schedules concept page.
How do I specify a date?
By default, departures for the next hour (in the local timezone for the stop) are shown. You can increase this time window using the next parameter. You can also specify the start and end times manually, using the start_time and end_time parameters.
Dates can also be specified in three different ways:
- Use
dateto request departures on a specific date. - Use
relative_dateto automatically selectTODAYor the next occurrence of the named day, e.g.FRIDAY - Use
service_dateto specify an explicit GTFS service date.
How are departure times calculated?
Transitland calculates scheduled arrivals/departures from static GTFS feeds using the following approaches:
- The scheduled arrival and/or departure times for a given stop, as defined in a static GTFS feed's
stop_times.txtfile. - If the static GTFS feed does not provide an arrival or departure time for the specified stop, Transitland will interpolate times between "timepoint" stops before and after the specified stops.
- When available, Transitland will make use of
shape_dist_traveledvalues inshapes.txtto improve interpolation accuracy.
For operators that also provide GTFS Realtime feeds with TripUpdates, Transitland also provides real-time arrivals/departures. Real-time and scheduled values are listed separately in API responses. Note that "added" trips will only have real-time values, but not scheduled values.
Limitations
- For operators that provide GTFS Realtime feeds with
VehiclePositions(but notTripUpdates), Transitland does not use vehicle positions to independently estimate real-time arrivals/departures. - For operators that define route schedules using
frequencies.txt(a much less popular approach than usingstop_times.txt), Transitland does not currently calculate stop departure times.
Request parameters
GET/api/v2/rest/stops/{stop_key}/departures Departures from a given stop based on static and real-time data
| Parameter | Type | Description | Example |
|---|---|---|---|
| stop_key | string | Stop lookup key; can be an integer ID, a '<feed onestop_id>:<gtfs stop_id'> key, a Onestop ID | f-sf~bay~area~rg:LAKE |
| limit | integer | Maximum number of records to return | limit=1 |
| service_date | string | Search for departures on a specified GTFS service calendar date, in YYYY-MM-DD format | service_date=2022-09-28 |
| date | string | Search for departures on a specified calendar date, in YYYY-MM-DD format | date=2022-09-28 |
| next | integer | Search for departures leaving within the next specified number of seconds in local time | next=600 |
| start_time | string | Search for departures leaving after a specified local time, in HH:MM:SS format | start_time=10:00:00 |
| end_time | string | Search for departures leaving before a specified local time, in HH:MM:SS format | end_time=11:00:00 |
| include_geometry | string enum | Include route geometry | include_geometry=true |
| use_service_window | string enum | Use a fall-back service date if the requested service_date is outside the active service period of the feed version. The fall-back date is selected as the matching day-of-week in the week which provides the best level of scheduled service in the feed version. This value defaults to true. | use_service_window=false |
| id | integer | Search for a specific internal ID | |
| relative_date | string enum | Search for departures on a relative date label, e.g. TODAY, TUESDAY, NEXT_WEDNESDAY | relative_date=NEXT_MONDAY |
| include_alerts | string enum | Include alerts from GTFS Realtime feeds | |
| after | integer | Pagination cursor value. This should be treated as an opaque value created by the server and returned as the link to the next result page, which may be empty. For historical reasons, this is based on the integer record ID values, but that should not be assumed to be the case in the future. |
Response format
stops
array: StopList or search for Stops
id
integerInternal integer ID
onestop_id
stringOnestop ID for this stop, or empty string if not registered
Examples-dr5ruvgnyk-madisonav~e69st
stop_code
stringGTFS
stops.stop_code; short text or number identifying the location for ridersstop_desc
stringGTFS
stops.stop_descExampleNW Corner of Broadway and 14th
stop_id
stringGTFS
stops.stop_idExample400029
stop_name
stringGTFS
stops.stop_nameExampleMADISON AV/E 68 ST
stop_timezone
stringGTFS
stops.stop_timezone; overrides agency timezone; inherits from parent station if emptyExampleAmerica/Los_Angeles
stop_url
stringGTFS
stops.stop_urlgeometry
Geographic location of this stop as a GeoJSON Point
location_type
integerGTFS
stops.location_type [0=stop/platform, 1=station, 2=entrance/exit, 3=generic node, 4=boarding area]platform_code
stringGTFS
stops.platform_code; platform identifier without a 'platform' prefix (e.g. G or 3)tts_stop_name
stringGTFS
stops.tts_stop_name; readable version of stop_name for use with text-to-speech systemsstop_access
integerGTFS
stops.stop_access [0=access only via station entrance/pathways, 1=route directly to the stop]; only valid for platforms (location_type 0) with a parent_stationwheelchair_boarding
integerGTFS
stops.wheelchair_boarding [0=no information, 1=some accessible path exists, 2=no accessible path]zone_id
stringGTFS
stops.zone_id; identifies the fare zone for a stop; required only on stops referenced by fare_rules.txtfeed_version
object: FeedVersionSource feed version for this entity
id
integerInternal integer ID
sha1
stringSHA1 hash of the zip file
Exampleab5bdc8b6cedd06792d42186a9b542504c5eef9a
fetched_at
stringTime when the file was fetched from the URL
Example2019-11-15T00:45:55.409906
feed
object: FeedFeed associated with this feed version
departures
array: StopTimeScheduled departures from this stop, filtered by date/time window and enriched with GTFS-RT estimated times where available
stop_sequence
integerGTFS
stop_times.stop_sequence; order of stops for this trip; values must increase along the trip but need not be consecutivestop_headsign
stringGTFS
stop_times.stop_headsign; overrides the trip-level headsign for passengers boarding at this stoptimepoint
integerGTFS
stop_times.timepoint [0=times are approximate, 1=times are exact]pickup_type
integerGTFS
stop_times.pickup_type [0=regular scheduled pickup, 1=no pickup available, 2=must phone agency to arrange, 3=must coordinate with driver]drop_off_type
integerGTFS
stop_times.drop_off_type [0=regular scheduled drop-off, 1=no drop-off available, 2=must phone agency to arrange, 3=must coordinate with driver]continuous_pickup
integerGTFS
stop_times.continuous_pickup; overrides routes.continuous_pickup for the segment to the next stop [0=continuous, 1=none, 2=must phone agency, 3=must coordinate with driver]continuous_drop_off
integerGTFS
stop_times.continuous_drop_off; overrides routes.continuous_drop_off for the segment to the next stop [0=continuous, 1=none, 2=must phone agency, 3=must coordinate with driver]interpolated
integer1 if this arrival/departure time was filled in by interpolation during import; 0 or null otherwise
arrival_time
stringGTFS
stop_times.arrival_timeExample15:21:04
departure_time
stringGTFS
stop_times.departure_timeExample15:21:04
shape_dist_traveled
numberGTFS
stop_times.shape_dist_traveled; distance from the start of the shape, in the same units as shapes.txtschedule_relationship
object: ScheduleRelationshipReal-time status of the parent trip.
STATIC means no GTFS-RT data was matched. See ScheduleRelationship for per-value semanticsservice_date
stringWhen part of an arrival/departure query, the GTFS service date for this scheduled stop time
Example2019-11-15
date
stringWhen part of an arrival/departure query, the calendar date for this scheduled stop time
Example2019-11-15
arrival
object: StopTimeEventArrival data, including GTFS-RT updates and estimates
departure
object: StopTimeEventDeparture data, including GTFS-RT updates and estimates
trip
object: TripTrip associated with this stop time
children
array: StopChild stops belonging to this station (platforms, entrances, generic nodes, boarding areas)
id
integerInternal integer ID
onestop_id
stringOnestop ID for this stop, or empty string if not registered
Examples-dr5ruvgnyk-madisonav~e69st
stop_code
stringGTFS
stops.stop_code; short text or number identifying the location for ridersstop_desc
stringGTFS
stops.stop_descExampleNW Corner of Broadway and 14th
stop_id
stringGTFS
stops.stop_idExample400029
stop_name
stringGTFS
stops.stop_nameExampleMADISON AV/E 68 ST
stop_timezone
stringGTFS
stops.stop_timezone; overrides agency timezone; inherits from parent station if emptyExampleAmerica/Los_Angeles
stop_url
stringGTFS
stops.stop_urlgeometry
Geographic location of this stop as a GeoJSON Point
location_type
integerGTFS
stops.location_type [0=stop/platform, 1=station, 2=entrance/exit, 3=generic node, 4=boarding area]platform_code
stringGTFS
stops.platform_code; platform identifier without a 'platform' prefix (e.g. G or 3)tts_stop_name
stringGTFS
stops.tts_stop_name; readable version of stop_name for use with text-to-speech systemsstop_access
integerGTFS
stops.stop_access [0=access only via station entrance/pathways, 1=route directly to the stop]; only valid for platforms (location_type 0) with a parent_stationwheelchair_boarding
integerGTFS
stops.wheelchair_boarding [0=no information, 1=some accessible path exists, 2=no accessible path]zone_id
stringGTFS
stops.zone_id; identifies the fare zone for a stop; required only on stops referenced by fare_rules.txtdepartures
array: StopTimeScheduled departures from this stop, filtered by date/time window and enriched with GTFS-RT estimated times where available
alerts
array: AlertGTFS-RT service alerts for this stop; pass
active: true to return only currently active alertsparent
object: StopParent station for this stop; for platforms and entrances (location_type 2, 3, 4), this is the enclosing station (location_type 1)
id
integerInternal integer ID
onestop_id
stringOnestop ID for this stop, or empty string if not registered
Examples-dr5ruvgnyk-madisonav~e69st
stop_code
stringGTFS
stops.stop_code; short text or number identifying the location for ridersstop_desc
stringGTFS
stops.stop_descExampleNW Corner of Broadway and 14th
stop_id
stringGTFS
stops.stop_idExample400029
stop_name
stringGTFS
stops.stop_nameExampleMADISON AV/E 68 ST
stop_timezone
stringGTFS
stops.stop_timezone; overrides agency timezone; inherits from parent station if emptyExampleAmerica/Los_Angeles
stop_url
stringGTFS
stops.stop_urlgeometry
Geographic location of this stop as a GeoJSON Point
location_type
integerGTFS
stops.location_type [0=stop/platform, 1=station, 2=entrance/exit, 3=generic node, 4=boarding area]platform_code
stringGTFS
stops.platform_code; platform identifier without a 'platform' prefix (e.g. G or 3)tts_stop_name
stringGTFS
stops.tts_stop_name; readable version of stop_name for use with text-to-speech systemsstop_access
integerGTFS
stops.stop_access [0=access only via station entrance/pathways, 1=route directly to the stop]; only valid for platforms (location_type 0) with a parent_stationwheelchair_boarding
integerGTFS
stops.wheelchair_boarding [0=no information, 1=some accessible path exists, 2=no accessible path]zone_id
stringGTFS
stops.zone_id; identifies the fare zone for a stop; required only on stops referenced by fare_rules.txtchildren
array: StopChild stops belonging to this station (platforms, entrances, generic nodes, boarding areas)
alerts
array: AlertGTFS-RT service alerts for this stop; pass
active: true to return only currently active alertsalerts
array: AlertGTFS-RT service alerts for this stop; pass
active: true to return only currently active alertscause
stringGTFS-RT Alert cause
effect
stringGTFS-RT Alert effect
severity_level
stringAlert severity:
UNKNOWN_SEVERITY, INFO, WARNING, or SEVEREurl
array: RTTranslationURL for more information
header_text
array: RTTranslationGTFS-RT Alert header text
description_text
array: RTTranslationGTFS-RT Alert description text
tts_header_text
array: RTTranslationHeader text optimized for text-to-speech (TTS) systems
tts_description_text
array: RTTranslationDescription text optimized for text-to-speech (TTS) systems
active_period
array: RTTimeRangeTime ranges during which this alert is active. See https://gtfs.org/realtime/reference/#message-timerange