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.
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
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 specified format
Parameter | Type | Description | Example |
---|---|---|---|
include_alerts | string enum | Include alerts from GTFS Realtime feeds | |
id | integer 0 ... unlimited | Search for a specific internal ID | |
route_key | string | Route lookup key; can be an integer ID, a '<feed onestop_id>:<gtfs route_id>' key, or a Onestop ID | |
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 |
lat | number -90 ... 90 | Latitude | |
lon | number -180 ... 180 | Longitude | |
license_commercial_use_allowed | 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 | 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 | 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 | 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 | 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
Array of objects
Description
Reference GTFS specification for trips.txt
id
(integer)
(integer)
Unique integer ID
trip_id
(string)
(string)
GTFS trip_id
Example910746
trip_headsign
(string)
(string)
GTFS trip_headsign
ExampleSan Francisco International Airport
trip_short_name
(string)
(string)
GTFS trip_short_name
ExampleSFO
direction_id
(integer)
(integer)
GTFS direction_id
block_id
(string)
(string)
GTFS block_id
Exampleblock_2818_wed
wheelchair_accessible
(integer)
(integer)
GTFS wheelchair_accessible
bikes_allowed
(integer)
(integer)
GTFS bikes_allowed
stop_pattern_id
(integer)
(integer)
Pattern of stops for this trip; values are unique within the feed version
Example9
route
(object)
(object)
A subset of fields for the route associated with this trip
feed_version
(object)
(object)
A subset of fields for the feed version
stop_times
(object array)
(object array)
GTFS stop_time entities, with some modifications
arrival_time
(seconds)
(seconds)
Arrival time
Example11:02:03
departure_time
(seconds)
(seconds)
Departure time
Example11:04:05
stop_sequence
(integer)
(integer)
GTFS stop_sequence
Example1
stop_headsign
(string)
(string)
GTFS stop_headsign
ExampleSouth San Francisco
pickup_type
(integer)
(integer)
GTFS pickup_type
drop_off_type
(integer)
(integer)
GTFS drop_off_type
timepoint
(integer)
(integer)
GTFS timepoint
shape_dist_traveled
(number)
(number)
GTFS shape_dist_traveled
continuous_pickup
(integer)
(integer)
GTFS continuous_pickup
continuous_drop_off
(integer)
(integer)
GTFS continuous_drop_off
interpolated
(integer)
(integer)
Non-zero if interpolated time values were set during import
stop
()
()
A subset of fields for this stop
shape
(object)
(object)
Shape for a trip
shape_id
(string)
(string)
GTFS shape_id
Example910746_shp
generated
(boolean)
(boolean)
True if this shape was generated from point-to-point stop locations
geometry
(object)
(object)
Geometry in GeoJSON format
calendar
(object)
(object)
GTFS calendar and calendar_dates entities
service_id
(string)
(string)
GTFS service_id
Example2021_03_22-DX-MVS-Weekday-01
start_date
(date)
(date)
GTFS start_date
Example2021-03-22
end_date
(date)
(date)
GTFS end_date
Example2021-06-04
added_dates
(string array)
(string array)
An array of dates where service is added (exception_type=1)
Example[ "2021-05-02" ]
removed_dates
(string array)
(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)
(boolean)
True if this calendar is generated to represent calendar_date entries
monday
(integer)
(integer)
GTFS monday; service scheduled if 1
tuesday
(integer)
(integer)
GTFS tuesday; service scheduled if 1
wednesday
(integer)
(integer)
GTFS wednesday; service scheduled if 1
thursday
(integer)
(integer)
GTFS thursday; service scheduled if 1
friday
(integer)
(integer)
GTFS friday; service scheduled if 1
saturday
(integer)
(integer)
GTFS saturday; service scheduled if 1
sunday
(integer)
(integer)
GTFS sunday; service scheduled if 1
frequencies
(object array)
(object array)
start_time
(seconds)
(seconds)
When this trip begins repeating, in seconds
Example36000
end_time
(seconds)
(seconds)
When this trip stops repeating, in seconds
Example72000
headway_secs
(integer)
(integer)
GTFS headway_secs
Example900
exact_times
(integer)
(integer)
GTFS exact_times