Contents
REST API - Routes
Routes
The REST API routes endpoint provides a fast and flexible way to browse
Request overview
The routes API provides optional flags for including or disincluding certain response sections; this may be useful for optimizing the speed and size of requests. The API also provides png as a format option, which returns a PNG format image containing a simple static map of the route and stops.
Geographic queries require all three parameters of lat, lon, and radius to be specified. The maximum radius is 10km.
The route API returns "active"
Route API results are based on this GraphQL query.
Request parameters
GET/api/v2/rest/routes Search for routes
GET/api/v2/rest/routes.{format} Request routes in specified format
GET/api/v2/rest/routes/{route_key} Request a route by ID or Onestop ID
GET/api/v2/rest/routes/{route_key}.format Request a route by ID or Onestop 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 | |
| agency_key | string | Agency lookup key; can be an integer ID, a '<feed onestop_id>:<gtfs agency_id>' key, or a Onestop ID | |
| route_id | string | Search for records with this GTFS route_id | route_id=Bu-130 |
| route_type | integer | Search for routes with this GTFS route (vehicle) type | route_type=1 |
| route_types | string | Search for routes with these GTFS route (vehicle) types. Accepts comma separated values. | route_types=1,2 |
| operator_onestop_id | string | Search for records by operator OnestopID | operator_onestop_id=... |
| include_alerts | string enum | Include alerts from GTFS Realtime feeds | |
| include_geometry | string enum | Include route geometry | include_geometry=true |
| include_stops | string enum | Include route stops | include_stops=true |
| 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=png |
| search | string | Full text search | search=daly+city |
| onestop_id | string | Search for a specific Onestop ID | onestop_id=r-9q9j-l1 |
| 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 |
| radius | number | Search radius (meters); requires lat and lon | lon=-122&lat=37&radius=1000 |
| lat | number | Latitude | |
| lon | number | Longitude | |
| bbox | string | Geographic search using a bounding box, with coordinates in (min_lon, min_lat, max_lon, max_lat) order as a comma separated string | bbox=-122.269,37.807,-122.267,37.808 |
| 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
routes
array: RouteCurrently imported routes. If no feed version is specified, defaults to active feed versions.
id
integerInternal integer ID
route_color
stringGTFS routes.route_color
route_desc
stringGTFS routes.route_desc
route_id
stringGTFS routes.route_id
route_long_name
stringGTFS routes.route_long_name
route_short_name
stringGTFS routes.route_short_name
route_sort_order
integerGTFS routes.route_sort_order
route_text_color
stringGTFS routes.route_text_color
route_type
integerGTFS routes.route_type
route_url
stringGTFS routes.route_url
continuous_pickup
integerGTFS routes.continuous_pickup
continuous_drop_off
integerGTFS routes.continuous_drop_off
onestop_id
stringOnestopID for this route
geometry
Representative geometry for this route
alerts
array: AlertGTFS-RT alerts for this route
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
agency
object: AgencyAgency associated with this route
id
integerInternal integer ID
agency_id
stringGTFS agency.agency_id
agency_name
stringGTFS agency.agency_name
onestop_id
stringOnestopID for this agency (or its associated operator)
alerts
array: AlertGTFS-RT alerts for this agency
feed_version
object: FeedVersionSource feed version for this entity
id
integerInternal integer ID
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
route_stops
array: RouteStopStops associated with this route
stop
object: StopAssociated stop