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 | 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 | 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
(int64)
Example123
(string)
Example910746
(string)
ExampleSan Francisco International Airport
(string)
ExampleSFO
(integer)
(string)
Exampleblock_2818_wed
(integer)
(integer)
(integer)
Example9
(object array)
(seconds)
Example36060
(seconds)
Example36065
(integer)
Example1
(string)
ExampleSouth San Francisco
(integer)
(integer)
(integer)
(number)
(integer)
(integer)
(integer)
()
(object)
(string)
Example910746_shp
(boolean)
()
(object)
(string)
Example2021_03_22-DX-MVS-Weekday-01
(date)
Example2021-03-22
(date)
Example2021-06-04
(string array)
Example[ "2021-05-02" ]
(string array)
Example[ "2021-04-02", "2021-04-05", "2021-04-06" ]
(boolean)
(integer)
(integer)
(integer)
(integer)
(integer)
(integer)
(integer)
(object array)
(seconds)
Example36000
(seconds)
Example72000
(integer)
Example900
(integer)
(object)
(object)