REST API - 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 OnestopID may be used.

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

Shapes are included when accessing a single trip, requesting geojson format, 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}.format Request a single trip by ID in format

Parameter Type Description Example
id integer
0 ... unlimited
Search for a specific internal ID
route_key string

Route specified as id (if an integer) or onestop_id (if string)
after integer

Return records past this record ID
limit integer
0 ... 100
Maximum number of records to return limit=1
format enum
jsongeojsonpng
Response format format=geojson
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
truefalse
Include shape geometry include_geometry=true
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-9q9-caltrain

Response format

Array of objects
Description
id
(int64)
Unique integer ID

Example123

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

stop_times
(object array)
GTFS stop_time entities, with some modifications
arrival_time
(seconds)
Arrival time, in seconds since midnight

Example36060

departure_time
(seconds)
Departure time, in seconds since midnight

Example36065

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
()
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
route
(object)
A subset of fields for the route associated with this trip
feed_version
(object)
A subset of fields for the feed version