Contents
REST API - Feeds
Feeds
The REST API feeds endpoint provides a fast and flexible way to browse source feeds registered in the Transitland platform.
Request overview
The feeds API provides a number of searching and filtering parameters; results are based on this GraphQL query.
Request parameters
GET/api/v2/rest/feeds Search for feeds
GET/api/v2/rest/feeds.{format} Request feeds in specified format
GET/api/v2/rest/feeds/{feed_key} Request a feed by ID or Onestop ID
GET/api/v2/rest/feeds/{feed_key}.format Request a feed by ID or Onestop ID in specifed format
| Parameter | Type | Description | Example |
|---|---|---|---|
| feed_key | string | Feed lookup key; can be an integer ID or a Onestop ID | |
| spec | string enum | Type of data contained in this feed | spec=gtfs |
| fetch_error | string enum | Search for feeds with or without a fetch error | fetch_error=true |
| tag_key | string | Search for feeds with a tag. Combine with tag_value also query for the value of the tag. | tag_key=gtfs_data_exchange |
| tag_value | string | Search for feeds tagged with a given value. Must be combined with tag_key. | tag_key=unstable_url&tag_value=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=geojson |
| search | string | Full text search | search=caltrain |
| onestop_id | string | Search for a specific Onestop ID | onestop_id=f-sf~bay~area~rg |
| lon | number | Longitude | |
| lat | number | Latitude | |
| radius | number | Search radius (meters); requires lat and lon | lon=-122.3?lat=37.8&radius=1000 |
| 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
feeds
array: FeedFeeds
id
integerInternal integer ID
spec
object: FeedSpecTypesType of feed
name
stringA common name for this feed. Optional. Alternatively use
associated_operators[].nameonestop_id
stringOnestopID for this feed
languages
array: StringLanguage(s) included in this feed
urls
object: FeedUrlsURLs associated with this feed
static_current
stringURL for the static feed that represents today's service
static_historic
array: StringURLs for static feeds that represent past service that is no longer in effect
static_planned
array: StringURLs for static feeds that represent service planned for upcoming dates. Typically used to represent calendar/service changes that will take effect few weeks or months in the future
realtime_vehicle_positions
stringURL for GTFS-RT VehiclePosition messages
realtime_trip_updates
stringURL for GTFS-RT TripUpdate messages
realtime_alerts
stringURL for GTFS-RT Alert messages
gbfs_auto_discovery
stringURL for GBFS feed
gbfs.json auto-discovery filemds_provider
stringURL for MDS feed provider endpoint
license
object: FeedLicenseFeed license metadata
spdx_identifier
stringSPDX identifier for a common license. See https://spdx.org/licenses/
url
stringURL for a custom license
use_without_attribution
stringAre feed consumers allowed to use the feed contents without including attribution text in their app or map?
create_derived_product
stringAre feed consumers allowed to create and share derived products from the feed?
redistribution_allowed
stringAre feed consumers allowed to redistribute the feed in its entirety?
commercial_use_allowed
stringAre feed consumers allowed to use the feed for commercial purposes?
share_alike_optional
stringAre feed consumers allowed to keep their modifications of this feed private?
attribution_text
stringFeed consumers must include this particular text when using this feed
attribution_instructions
stringFeed consumers must follow these instructions for how to provide attribution
authorization
object: FeedAuthorizationAuthorization metadata for fetching data from this feed
type
stringMethod for inserting authorization secret into request
param_name
stringWhen
type=query_param, this specifies the name of the query parameter. When type=header, this specifies the name of the headerinfo_url
stringWebsite to visit to sign up for an account
feed_state
object: FeedStateCurrent feed state
feed_version
object: FeedVersionThe active feed version for this feed
feed_versions
array: FeedVersionVersions of this feed that have been fetched, archived, and imported
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
url
stringURL used to fetch the file
earliest_calendar_date
stringThe earliest date with scheduled service
Example2020-01-01
latest_calendar_date
stringThe latest date with scheduled service
Example2020-12-31
Downloading latest static GTFS
See also downloading static GTFS feed versions.
GET/api/v2/rest/feeds/{feed_key}/download_latest_feed_version Download latest feed version
| Parameter | Type | Description | Example |
|---|---|---|---|
| feed_key | string | Feed lookup key; can be an integer ID or Onestop ID value |
Description Download the latest feed version GTFS zip for this feed, if redistribution is allowed by the source feed's license
Downloading latest GTFS Realtime
For more information about GTFS Realtime message types and fields, see the GTFS Realtime reference documentation.
GET/api/v2/rest/feeds/{feed_key}/download_latest_rt/{rt_type}.{format} Download latest GTFS Realtime feed data
| Parameter | Type | Description | Example |
|---|---|---|---|
| feed_key | string | Feed lookup key; can be an integer ID or Onestop ID value | |
| rt_type | string enum | GTFS Realtime message types to download | |
| format | string enum | Output format (JSON or Protocol Buffers) |
Description Download the latest snapshot of the specified GTFS Realtime feed, if redistribution is allowed by the source feed's license. Returns 404 if feed or message not found, 401 if redistribution not allowed.