Contents
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: StopCurrently imported stops. If no feed version is specified, defaults to active feed versions.
id
integerInternal integer ID
onestop_id
stringOnestopID for this stop, if available
Examples-dr5ruvgnyk-madisonav~e69st
stop_code
stringGTFS stops.stop_code
stop_desc
stringGTFS stops.stop_desc
ExampleNW Corner of Broadway and 14th
stop_id
stringGTFS stops.stop_id
Example400029
stop_name
stringGTFS stops.stop_name
ExampleMADISON AV/E 68 ST
stop_timezone
stringGTFS stops.stop_timezone; if overriding agency/route timezone
ExampleAmerica/Los_Angeles
stop_url
stringGTFS stops.stop_url
geometry
Stop geometry
location_type
integerGTFS stops.location_type; this is optional in GTFS spec
platform_code
stringGTFS stops.platform_code
tts_stop_name
stringGTFS stops.tts_stop_name
wheelchair_boarding
integerGTFS stops.wheelchair_boarding
zone_id
stringGTFS stops.zone_id
feed_version
object: FeedVersionFeed version
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: StopTimeDepartures from this stop for a given date and time
stop_sequence
integerGTFS stop_times.stop_sequence
stop_headsign
stringGTFS stop_times.stop_headsign
timepoint
integerGTFS stop_times.timepoint
pickup_type
integerGTFS stop_times.pickup_type
drop_off_type
integerGTFS stop_times.drop_off_type
continuous_pickup
integerGTFS stop_times.continuous_pickup
continuous_drop_off
integerGTFS stop_times.continuous_drop_off
interpolated
integerSet if this arrival/departure time was interpolated during import
arrival_time
stringGTFS stop_times.arrival_time
Example15:21:04
departure_time
stringGTFS stop_times.departure_time
Example15:21:04
shape_dist_traveled
numberGTFS stop_times.shape_dist_traveled
schedule_relationship
object: ScheduleRelationshipA status flag for real-time information about this trip.
If no real-time information is available, the value will be STATIC and the estimated arrival/departure times will be empty. A trip with real-time information available will be SCHEDULED; a canceled trip will be CANCELED, and an added trip that is not present in the static GTFS will be ADDED.
service_date
stringIf part of an arrival/departure query, the GTFS service date for this scheduled stop time
Example2019-11-15
date
stringIf part of an arrival/departure query, the calendar date for this scheduled stop time
Example2019-11-15
arrival
object: StopTimeEventDetailed arrival information, including GTFS-RT updates and estimates
departure
object: StopTimeEventDetailed departure information, including GTFS-RT updates and estimates
trip
object: TripTrip associated with this stop time
children
array: StopStop children
id
integerInternal integer ID
onestop_id
stringOnestopID for this stop, if available
Examples-dr5ruvgnyk-madisonav~e69st
stop_code
stringGTFS stops.stop_code
stop_desc
stringGTFS stops.stop_desc
ExampleNW Corner of Broadway and 14th
stop_id
stringGTFS stops.stop_id
Example400029
stop_name
stringGTFS stops.stop_name
ExampleMADISON AV/E 68 ST
stop_timezone
stringGTFS stops.stop_timezone; if overriding agency/route timezone
ExampleAmerica/Los_Angeles
stop_url
stringGTFS stops.stop_url
geometry
Stop geometry
location_type
integerGTFS stops.location_type; this is optional in GTFS spec
platform_code
stringGTFS stops.platform_code
tts_stop_name
stringGTFS stops.tts_stop_name
wheelchair_boarding
integerGTFS stops.wheelchair_boarding
zone_id
stringGTFS stops.zone_id
departures
array: StopTimeDepartures from this stop for a given date and time
alerts
array: AlertGTFS-RT Alerts for this stop
parent
object: StopStop parent station
id
integerInternal integer ID
onestop_id
stringOnestopID for this stop, if available
Examples-dr5ruvgnyk-madisonav~e69st
stop_code
stringGTFS stops.stop_code
stop_desc
stringGTFS stops.stop_desc
ExampleNW Corner of Broadway and 14th
stop_id
stringGTFS stops.stop_id
Example400029
stop_name
stringGTFS stops.stop_name
ExampleMADISON AV/E 68 ST
stop_timezone
stringGTFS stops.stop_timezone; if overriding agency/route timezone
ExampleAmerica/Los_Angeles
stop_url
stringGTFS stops.stop_url
geometry
Stop geometry
location_type
integerGTFS stops.location_type; this is optional in GTFS spec
platform_code
stringGTFS stops.platform_code
tts_stop_name
stringGTFS stops.tts_stop_name
wheelchair_boarding
integerGTFS stops.wheelchair_boarding
zone_id
stringGTFS stops.zone_id
children
array: StopStop children
alerts
array: AlertGTFS-RT Alerts for this stop
alerts
array: AlertGTFS-RT Alerts for this stop
cause
stringGTFS-RT Alert cause
effect
stringGTFS-RT Alert effect
severity_level
stringGTFS-RT Alert severity level
url
array: RTTranslationGTFS-RT Alert uRL for more information
header_text
array: RTTranslationGTFS-RT Alert header text
description_text
array: RTTranslationGTFS-RT Alert description text
tts_header_text
array: RTTranslationGTFS-RT Alert TTS header text
tts_description_text
array: RTTranslationGTFS-RT Alert TTS description text
active_period
array: RTTimeRangeGTFS-RT Alert active alert period. See https://gtfs.org/realtime/reference/#message-timerange