Contents
Documentation
REST API - Agencies and Operators
Agencies and Operators
Operators and agencies are two means of grouping together stops, routes, trips, and other data for a single organization that offers transit service. For more information on the distinction, see agencies and operators.
Request overview
The REST API provides access to both agencies and operators, with results based on agency and operator GraphQL queries.
Agency request parameters
GET/api/v2/rest/agencies Search for agencies
GET/api/v2/rest/agencies.{format} Request agencies in specified format
GET/api/v2/rest/agencies/{agency_key} Request an agency by ID or Onestop ID
GET/api/v2/rest/agencies/{agency_key}.{format} Request an agency by ID or Onestop ID in specified format
| Parameter | Type | Description | Example |
|---|---|---|---|
| agency_key | string | Agency lookup key; can be an integer ID, a '<feed onestop_id>:<gtfs agency_id>' key, or a Onestop ID | |
| agency_id | string | Search for records with this GTFS agency_id (string) | agency_id=BART |
| agency_name | string | Search for records with this GTFS agency_name | agency_name=Caltrain |
| id | integer | Search for a specific internal ID | |
| include_alerts | string enum | Include alerts from GTFS Realtime feeds | |
| include_routes | string enum | Include routes that serve this stop | include_routes=true |
| 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=geojson |
| search | string | Full text search | search=bart |
| onestop_id | string | Search for a specific Onestop ID | onestop_id=o-9q9-caltrain |
| feed_version_sha1 | string | Search for records in this feed version | feed_version_sha1=1c4721d4... |
| 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.3&lat=37.8&radius=1000 |
| lon | number | Longitude | |
| lat | number | Latitude | |
| 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 |
| adm0_name | string | Search by country name | adm0_name=Mexico |
| adm0_iso | string | Search by country 2 letter ISO 3166 code | adm0_iso=US |
| adm1_name | string | Search by state/province/division name | adm1_name=California |
| adm1_iso | string | Search by state/province/division ISO 3166-2 code | adm1_iso=US-CA |
| city_name | string | Search by city name | city_name=Oakland |
| 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'. |
Agency response format
agencies
array: AgencyList or search for Agencies (each an
agency.txt record from a specific FeedVersion); defaults to currently active feed versions when none is specifiedid
integerInternal integer ID
agency_name
stringGTFS
agency.agency_nameagency_id
stringGTFS
agency.agency_idonestop_id
stringOnestop ID for this agency (or its associated operator)
agency_url
stringGTFS
agency.agency_urlagency_timezone
stringGTFS
agency.agency_timezone; stop times use this timezone unless overridden by stop_timezoneagency_lang
stringGTFS
agency.agency_lang; primary language used by this transit agency, as a BCP 47 language tagagency_phone
stringGTFS
agency.agency_phone; voice telephone number for the agency's customer serviceagency_fare_url
stringGTFS
agency.agency_fare_url; URL of a web page where a rider can purchase tickets or passesagency_email
stringGTFS
agency.agency_email; email address actively monitored by the agency's customer service departmentcemv_support
integerGTFS
agency.cemv_support; whether riders can use a contactless EMV (cEMV) card or mobile device as fare media for trips associated with this agency [0=no information, 1=supported, 2=not supported]geometry
Convex hull of all stops served by this agency
operator
object: OperatorOperator associated with this agency
onestop_id
stringOnestop ID for this operator.
Format:
o-geohash-name.
Example: o-dr5r-nyct.name
stringOperator name
short_name
stringOperator short name
tags
objectAtlas tags providing additional metadata for this operator
feeds
array: FeedFeeds associated with this operator
alerts
array: AlertGTFS-RT service alerts for this agency; pass
active: true to return only currently active alertscause
stringGTFS-RT Alert cause
effect
stringGTFS-RT Alert effect
severity_level
stringAlert severity:
UNKNOWN_SEVERITY, INFO, WARNING, or SEVEREurl
array: RTTranslationURL for more information
header_text
array: RTTranslationGTFS-RT Alert header text
description_text
array: RTTranslationGTFS-RT Alert description text
tts_header_text
array: RTTranslationHeader text optimized for text-to-speech (TTS) systems
tts_description_text
array: RTTranslationDescription text optimized for text-to-speech (TTS) systems
active_period
array: RTTimeRangeTime ranges during which this alert is active. See https://gtfs.org/realtime/reference/#message-timerange
places
array: AgencyPlaceAdministrative places (city, state, country) matched to this agency by overlap with stop locations, ranked by association strength
city_name
stringBest-matched city name
adm0_name
stringBest-matched country name
adm1_name
stringBest-matched state or province name
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
routes
array: RouteRoutes associated with this agency
id
integerInternal integer ID
route_id
stringGTFS
routes.route_idroute_short_name
stringGTFS
routes.route_short_name; short name of a route, such as a line number or abbreviationroute_long_name
stringGTFS
routes.route_long_name; full descriptive name of a routealerts
array: AlertGTFS-RT service alerts for this route; pass
active: true to return only currently active alertsOperator request parameters
GET/api/v2/rest/operators Search for operators
GET/api/v2/rest/operators.{format} Request operators in specified format
GET/api/v2/rest/operators/{operator_key} Request an operator by ID or Onestop ID
GET/api/v2/rest/operators/{operator_key}.{format} Request an operator by ID or Onestop ID in specified format
| Parameter | Type | Description | Example |
|---|---|---|---|
| tag_key | string | Search for operators with a tag. Combine with tag_value also query for the value of the tag. | tag_key=us_ntd_id |
| tag_value | string | Search for feeds tagged with a given value. Must be combined with tag_key. | tag_key=us_ntd_id&tag_value=40029 |
| onestop_id | string | Search for a specific Onestop ID | onestop_id=o-9q9-caltrain |
| feed_onestop_id | string | Search for records in this feed | feed_onestop_id=f-sf~bay~area~rg |
| search | string | Full text search | search=bart |
| include_alerts | string enum | Include alerts from GTFS Realtime feeds | |
| 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 | |
| adm0_name | string | Search by country name | adm0_name=Mexico |
| adm0_iso | string | Search by country 2 letter ISO 3166 code | adm0_iso=US |
| adm1_name | string | Search by state/province/division name | adm1_name=California |
| adm1_iso | string | Search by state/province/division ISO 3166-2 code | adm1_iso=US-CA |
| city_name | string | Search by city name | city_name=Oakland |
| radius | number | Search radius (meters); requires lat and lon | lon=-122.3&lat=37.8&radius=1000 |
| lon | number | Longitude | |
| lat | number | Latitude | |
| 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'. |
Operator response format
operators
array: OperatorList or search for Operators (higher-level groupings of agencies)
id
integerInternal integer ID
onestop_id
stringOnestop ID for this operator.
Format:
o-geohash-name.
Example: o-dr5r-nyct.name
stringOperator name
short_name
stringOperator short name
website
stringOperator website
tags
objectAtlas tags providing additional metadata for this operator
feeds
array: FeedFeeds associated with this operator
id
integerInternal integer ID
onestop_id
stringOnestop ID for this feed.
Format:
f-geohash-name.
Example: f-9q9-bart.name
stringA common name for this feed; alternatively use
associated_operators[].namespec
object: FeedSpecTypesType of feed:
GTFS, GTFS_RT, GBFS, or MDSagencies
array: AgencyAgencies for this operator from active feed versions
id
integerInternal integer ID
agency_id
stringGTFS
agency.agency_idagency_name
stringGTFS
agency.agency_namegeometry
Convex hull of all stops served by this agency
alerts
array: AlertGTFS-RT service alerts for this agency; pass
active: true to return only currently active alertsplaces
array: AgencyPlaceAdministrative places (city, state, country) matched to this agency by overlap with stop locations, ranked by association strength