Contents
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"
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
| Parameter | Type | Description | Example |
|---|---|---|---|
| route_key | string | Route lookup key; can be an integer ID, a '<feed onestop_id>:<gtfs route_id>' key, or a Onestop ID | |
| service_date | string | Search for trips active on this date | service_date=... |
| trip_id | string | Search for records with this GTFS trip_id | trip_id=305 |
| include_geometry | string enum | Include shape 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 |
| 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 | |
| id | integer | Search for a specific internal ID | |
| 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. | |
| limit | integer | Maximum number of records to return | limit=1 |
| format | string enum | Response format | format=geojson |
| feed_version_sha1 | string | Search for records in this feed version | feed_version_sha1=041ffeec... |
| feed_onestop_id | string | Search for records in this feed | feed_onestop_id=f-sf~bay~area~rg |
| lat | number | Latitude | |
| lon | number | Longitude | |
| license_commercial_use_allowed | string enum | 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_optional | string enum | 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_product | string enum | 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_allowed | string enum | 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_attribution | string enum | 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: TripCurrently imported trips. If no feed version is specified, defaults to active feed versions.
id
integerInternal integer ID
trip_id
stringGTFS trips.trip_id
trip_headsign
stringGTFS trips.trip_headsign
trip_short_name
stringGTFS trips.trip_short_name
direction_id
integerGTFS trips.direction_id
block_id
stringGTFS trips.block_id
wheelchair_accessible
integerGTFS trips.wheelchair_accessible
bikes_allowed
integerGTFS trips.bikes_allowed
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.
stop_pattern_id
integerCalculated stop pattern ID; an integer scoped to the feed version
feed_version
object: FeedVersionFeed version for this entity
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
shape
object: ShapeShape for this trip
shape_id
stringGTFS shapes.shape_id
geometry
Geometry for this shape
generated
booleanWas this geometry automatically generated from stop locations?
calendar
object: CalendarCalendar for this trip
service_id
stringGTFS calendar.service_id
start_date
stringGTFS calendar.start_date
Example2019-11-15
end_date
stringGTFS calendar.end_date
Example2019-11-15
monday
integerGTFS calendar.monday
tuesday
integerGTFS calendar.tuesday
wednesday
integerGTFS calendar.wednesday
thursday
integerGTFS calendar.thursday
friday
integerGTFS calendar.friday
saturday
integerGTFS calendar.saturday
sunday
integerGTFS calendar.sunday
added_dates
array: DateAdded dates, derived from GTFS calendar_dates
removed_dates
array: DateRemoved dates, derived from GTFS calendar_dates
frequencies
array: FrequencyFrequencies for this trip
start_time
stringGTFS frequencies.start_time
Example15:21:04
end_time
stringGTFS frequencies.end_time
Example15:21:04
headway_secs
integerGTFS frequencies.headway_secs
exact_times
integerGTFS frequencies.exact_times
alerts
array: AlertGTFS-RT alerts for this trip
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
route
object: RouteRoute for this trip
id
integerInternal integer ID
onestop_id
stringOnestopID for this route
route_id
stringGTFS routes.route_id
route_short_name
stringGTFS routes.route_short_name
route_long_name
stringGTFS routes.route_long_name
alerts
array: AlertGTFS-RT alerts for this route
agency
object: AgencyAgency associated with this route
stop_times
array: StopTimeStop times for this trip
arrival_time
stringGTFS stop_times.arrival_time
Example15:21:04
departure_time
stringGTFS stop_times.departure_time
Example15:21:04
stop_sequence
integerGTFS stop_times.stop_sequence
stop_headsign
stringGTFS stop_times.stop_headsign
pickup_type
integerGTFS stop_times.pickup_type
drop_off_type
integerGTFS stop_times.drop_off_type
timepoint
integerGTFS stop_times.timepoint
interpolated
integerSet if this arrival/departure time was interpolated during import
stop
object: StopStop associated with this stop time