REST API - Trips

Trips

Trips are trips.txt entities imported from GTFS, and include the same basic structure and fields, plus some additional metadata.

Trip responses include their associated shape, calendar, frequency, and stop departure information; these entities do not have stand-alone endpoints.

For an overview of trips, schedules, and service calendars, see the .

Request overview

Trips must be accessed through a route; either a route ID or Onestop ID may be used.

Stop time information is only available when requesting a single trip by ID.

To instead see all departures from a given stop, use the .

Shapes are included when accessing a single trip, requesting geojson or geojsonl formats, or with include_geometry=true.

Trips scheduled to run on a particular date can be selected using the service_date parameter, a date in YYYY-MM-DD format.

The trip API returns "active" unless requesting a specific feed version.

Trip API results are based on this GraphQL query.


Request parameters

GET/api/v2/rest/routes/{route_key}/trips Search for trips

GET/api/v2/rest/routes/{route_key}/trips.{format} Request trips in specified format

GET/api/v2/rest/routes/{route_key}/trips/{id} Request a trip by ID

GET/api/v2/rest/routes/{route_key}/trips/{id}.format Request a trip by ID in specified format

ParameterTypeDescriptionExample
route_keystring

Route lookup key; can be an integer ID, a '<feed onestop_id>:<gtfs route_id>' key, or a Onestop ID
service_datestring

Search for trips active on this dateservice_date=...
trip_idstring

Search for records with this GTFS trip_idtrip_id=305
include_geometrystring enum
truefalse
Include shape geometryinclude_geometry=true
use_service_windowstring enum
truefalse
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
relative_datestring enum
TODAYMONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAYSUNDAYNEXT_MONDAYNEXT_TUESDAYNEXT_WEDNESDAYNEXT_THURSDAYNEXT_FRIDAYNEXT_SATURDAYNEXT_SUNDAY
Search for departures on a relative date label, e.g. TODAY, TUESDAY, NEXT_WEDNESDAYrelative_date=NEXT_MONDAY
include_alertsstring enum
truefalse
Include alerts from GTFS Realtime feeds
idinteger

Search for a specific internal ID
afterinteger

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.
limitinteger

Maximum number of records to returnlimit=1
formatstring enum
jsongeojsongeojsonlpng
Response formatformat=geojson
feed_version_sha1string

Search for records in this feed versionfeed_version_sha1=041ffeec...
feed_onestop_idstring

Search for records in this feedfeed_onestop_id=f-sf~bay~area~rg
latnumber

Latitude
lonnumber

Longitude
license_commercial_use_allowedstring enum
yesnounknownexclude_no
Filter entities by feed license 'commercial_use_allowed' value. Please see Source Feed concept for details on license values. 'exclude_no' is equivalent to 'yes' and 'unknown'.
license_share_alike_optionalstring enum
yesnounknownexclude_no
Filter entities by feed license 'share_alike_optional' value. Please see Source Feed concept for details on license values. 'exclude_no' is equivalent to 'yes' and 'unknown'.
license_create_derived_productstring enum
yesnounknownexclude_no
Filter entities by feed license 'create_derived_product' value. Please see Source Feed concept for details on license values. 'exclude_no' is equivalent to 'yes' and 'unknown'.
license_redistribution_allowedstring enum
yesnounknownexclude_no
Filter entities by feed license 'redistribution_allowed' value. Please see Source Feed concept for details on license values. 'exclude_no' is equivalent to 'yes' and 'unknown'.
license_use_without_attributionstring enum
yesnounknownexclude_no
Filter entities by feed license 'use_without_attribution' value. Please see Source Feed concept for details on license values. 'exclude_no' is equivalent to 'yes' and 'unknown'.

Response format


trips
array: Trip
Currently imported trips. If no feed version is specified, defaults to active feed versions.
id
integer
Internal integer ID
trip_id
string
GTFS trips.trip_id
trip_headsign
string
GTFS trips.trip_headsign
trip_short_name
string
GTFS trips.trip_short_name
direction_id
integer
GTFS trips.direction_id
block_id
string
GTFS trips.block_id
wheelchair_accessible
integer
GTFS trips.wheelchair_accessible
bikes_allowed
integer
GTFS trips.bikes_allowed
schedule_relationship
object: ScheduleRelationship
A 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.
EnumSCHEDULEDADDEDUNSCHEDULEDCANCELEDSTATICSKIPPEDNO_DATAREPLACEMENTDUPLICATEDDELETED
stop_pattern_id
integer
Calculated stop pattern ID; an integer scoped to the feed version
feed_version
object: FeedVersion
Feed version for this entity
sha1
string
SHA1 hash of the zip file

Exampleab5bdc8b6cedd06792d42186a9b542504c5eef9a

fetched_at
string
Time when the file was fetched from the url

Example2019-11-15T00:45:55.409906

feed
object: Feed
Feed associated with this feed version
shape
object: Shape
Shape for this trip
shape_id
string
GTFS shapes.shape_id
geometry
Geometry for this shape
generated
boolean
Was this geometry automatically generated from stop locations?
calendar
object: Calendar
Calendar for this trip
service_id
string
GTFS calendar.service_id
start_date
string
GTFS calendar.start_date

Example2019-11-15

end_date
string
GTFS calendar.end_date

Example2019-11-15

monday
integer
GTFS calendar.monday
tuesday
integer
GTFS calendar.tuesday
wednesday
integer
GTFS calendar.wednesday
thursday
integer
GTFS calendar.thursday
friday
integer
GTFS calendar.friday
saturday
integer
GTFS calendar.saturday
sunday
integer
GTFS calendar.sunday
added_dates
array: Date
Added dates, derived from GTFS calendar_dates
removed_dates
array: Date
Removed dates, derived from GTFS calendar_dates
frequencies
array: Frequency
Frequencies for this trip
start_time
string
GTFS frequencies.start_time

Example15:21:04

end_time
string
GTFS frequencies.end_time

Example15:21:04

headway_secs
integer
GTFS frequencies.headway_secs
exact_times
integer
GTFS frequencies.exact_times
alerts
array: Alert
GTFS-RT alerts for this trip
cause
string
GTFS-RT Alert cause
effect
string
GTFS-RT Alert effect
severity_level
string
GTFS-RT Alert severity level
url
array: RTTranslation
GTFS-RT Alert uRL for more information
header_text
array: RTTranslation
GTFS-RT Alert header text
description_text
array: RTTranslation
GTFS-RT Alert description text
tts_header_text
array: RTTranslation
GTFS-RT Alert TTS header text
tts_description_text
array: RTTranslation
GTFS-RT Alert TTS description text
active_period
array: RTTimeRange
GTFS-RT Alert active alert period. See https://gtfs.org/realtime/reference/#message-timerange
route
object: Route
Route for this trip
id
integer
Internal integer ID
onestop_id
string
OnestopID for this route
route_id
string
GTFS routes.route_id
route_short_name
string
GTFS routes.route_short_name
route_long_name
string
GTFS routes.route_long_name
alerts
array: Alert
GTFS-RT alerts for this route
agency
object: Agency
Agency associated with this route
stop_times
array: StopTime
Stop times for this trip
arrival_time
string
GTFS stop_times.arrival_time

Example15:21:04

departure_time
string
GTFS stop_times.departure_time

Example15:21:04

stop_sequence
integer
GTFS stop_times.stop_sequence
stop_headsign
string
GTFS stop_times.stop_headsign
pickup_type
integer
GTFS stop_times.pickup_type
drop_off_type
integer
GTFS stop_times.drop_off_type
timepoint
integer
GTFS stop_times.timepoint
interpolated
integer
Set if this arrival/departure time was interpolated during import
stop
object: Stop
Stop associated with this stop time