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.

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 stops departures endpoint.

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" feed versions 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 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 single trip by ID

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

ParameterTypeDescriptionExample
include_alertsstring enum
truefalse
Include alerts from GTFS Realtime feeds
idinteger
0 ... unlimited
Search for a specific internal ID
route_keystring

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

Return records past this record ID
limitinteger
0 ... 100
Maximum number of records to returnlimit=1
format enum
jsongeojsongeojsonlpng
Response formatformat=geojson
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
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
-90 ... 90
Latitude
lonnumber
-180 ... 180
Longitude
license_commercial_use_allowed 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_optional 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_product 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_allowed 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_attribution 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

Array of objects
Description
id
(integer)
Unique integer ID
trip_id
(string)
GTFS trip_id

Example910746

trip_headsign
(string)
GTFS trip_headsign

ExampleSan Francisco International Airport

trip_short_name
(string)
GTFS trip_short_name

ExampleSFO

direction_id
(integer)
GTFS direction_id
block_id
(string)
GTFS block_id

Exampleblock_2818_wed

wheelchair_accessible
(integer)
GTFS wheelchair_accessible
bikes_allowed
(integer)
GTFS bikes_allowed
stop_pattern_id
(integer)
Pattern of stops for this trip; values are unique within the feed version

Example9

route
(object)
A subset of fields for the route associated with this trip
feed_version
(object)
A subset of fields for the feed version
stop_times
(object array)
GTFS stop_time entities, with some modifications
arrival_time
(seconds)
Arrival time

Example11:02:03

departure_time
(seconds)
Departure time

Example11:04:05

stop_sequence
(integer)
GTFS stop_sequence

Example1

stop_headsign
(string)
GTFS stop_headsign

ExampleSouth San Francisco

pickup_type
(integer)
GTFS pickup_type
drop_off_type
(integer)
GTFS drop_off_type
timepoint
(integer)
GTFS timepoint
shape_dist_traveled
(number)
GTFS shape_dist_traveled
continuous_pickup
(integer)
GTFS continuous_pickup
continuous_drop_off
(integer)
GTFS continuous_drop_off
interpolated
(integer)
Non-zero if interpolated time values were set during import
stop
()
A subset of fields for this stop
shape
(object)
Shape for a trip
shape_id
(string)
GTFS shape_id

Example910746_shp

generated
(boolean)
True if this shape was generated from point-to-point stop locations
geometry
(object)
Geometry in GeoJSON format
calendar
(object)
GTFS calendar and calendar_dates entities
service_id
(string)
GTFS service_id

Example2021_03_22-DX-MVS-Weekday-01

start_date
(date)
GTFS start_date

Example2021-03-22

end_date
(date)
GTFS end_date

Example2021-06-04

added_dates
(string array)
An array of dates where service is added (exception_type=1)

Example[ "2021-05-02" ]

removed_dates
(string array)
An array of dates where service is added (exception_type=2)

Example[ "2021-04-02", "2021-04-05", "2021-04-06" ]

generated
(boolean)
True if this calendar is generated to represent calendar_date entries
monday
(integer)
GTFS monday; service scheduled if 1
tuesday
(integer)
GTFS tuesday; service scheduled if 1
wednesday
(integer)
GTFS wednesday; service scheduled if 1
thursday
(integer)
GTFS thursday; service scheduled if 1
friday
(integer)
GTFS friday; service scheduled if 1
saturday
(integer)
GTFS saturday; service scheduled if 1
sunday
(integer)
GTFS sunday; service scheduled if 1
frequencies
(object array)
start_time
(seconds)
When this trip begins repeating, in seconds

Example36000

end_time
(seconds)
When this trip stops repeating, in seconds

Example72000

headway_secs
(integer)
GTFS headway_secs

Example900

exact_times
(integer)
GTFS exact_times