Transitland developers: As of June 9, 2021 developers need to include an API key on all requests to the Transitland v1 Datastore API. This will help us to better manage use and ensure all can access Transitland resources with fewer interruptions. Sign-up is free.

Datastore API endpoints

To query the Transitland Datastore API, use the base URL of https://transit.land/, appended with the endpoint information below. For example, to find routes operated by the San Francisco Municipal Transportation Agency (SFMTA), you can use this query: https://transit.land/api/v1/routes?operated_by=o-9q8y-sfmta.

The following endpoints are available in Transitland Datastore API.

MethodExample URLParameters
GET/api/v1/changesets?applied=falsechangesets that have not yet been applied
POST/api/v1/changesetsinclude a changeset payload in the request body
PUT/api/v1/changesets/32
(a Changeset can only be updated if it hasn't yet been applied)
include a changeset payload in the request body (secured)
POST/api/v1/changesets/1/check(secured)
POST/api/v1/changesets/1/apply(secured)
POST/api/v1/changesets/1/revert(secured)
DELETE/api/v1/changesets/1Delete Changeset (secured)
GET/api/v1/changesets/1/change_payloads
PUT/api/v1/changesets/1/change_payloadsAdd an additional changeset payload to a Changeset (secured)
POST/api/v1/changesets/1/change_payloads
GET/api/v1/changesets/1/change_payloads/1
PUT/api/v1/changesets/1/change_payloads/1(secured)
DELETE/api/v1/changesets/1/change_payloads/1(secured)
GET/api/v1/issues
GET/api/v1/issues/1
GET/api/v1/issues/categoriesall available categories and issue_types of each category
GET/api/v1/onestop_id/o-9q8y-SFMTAfinal part of the path can be a Onestop ID for any type of entity (for example, a stop or an operator)
GET/api/v1/stopsnone required
GET/api/v1/stops?imported_with_gtfs_id=true&gtfs_id=PITTgtfs_id is the ID used in a GTFS feed's stops.txt file
GET/api/v1/stops?lon=-121.977772198&lat=37.413530093&r=100lon is longitude; lat is latitude; r is radius of search in meters (if not specified, defaults to 100 meters)
GET/api/v1/stops?bbox=-122.4183,37.7758,-122.4120,37.7858bbox is a search bounding box with southwest longitude, southwest latitude, northeast longitude, northeast latitude (separated by commas)
GET/api/v1/stops?served_by=o-9q9-BART,r-9q8y-richmond~dalycity~millbraeserved_by can be any number of Onestop ID's for operators and routes
GET/api/v1/stops?tag_key=wheelchair_boardingfind all stops that have a tag of tag_key with any value
GET/api/v1/stops?tag_key=wheelchair_boarding&tag_value=1find all stops that have a tag of tag_key and a value of tag_value
GET/api/v1/stops?import_level=4find all stops with a given import level
GET/api/v1/operatorsnone required
GET/api/v1/operators?imported_with_gtfs_id=true&gtfs_id=CTgtfs_id is the ID used in a GTFS feed's agencies.txt file
GET/api/v1/operators?lon=-121.977772198&lat=37.413530093&r=100lon is longitude; lat is latitude; r is radius of search in meters (if not specified, defaults to 100 meters)
GET/api/v1/operators?bbox=-122.4183,37.7758,-122.4120,37.7858bbox is a search bounding box with southwest longitude, southwest latitude, northeast longitude, northeast latitude (separated by commas)
GET/api/v1/operators?tag_key=agency_timezonefind all operators that have a tag of tag_key with any value
GET/api/v1/operators?tag_key=agency_timezone&tag_value=America/Los_Angelesfind all operators that have a tag of tag_key and a value of tag_value
GET/api/v1/operators?import_level=4find all operators with a given import level
GET/api/v1/routesnone required
GET/api/v1/routes?imported_with_gtfs_id=true&gtfs_id=Lo-16APRgtfs_id is the ID used in a GTFS feed's routes.txt file
GET/api/v1/routes?imported_with_gtfs_id=true&gtfs_id=Lo-16APR&imported_from_feed_version=fd0bf2327f8034ceabff6d914220531def1e3903gtfs_id is the ID used in a GTFS feed's routes.txt file and imported_from_feed_version is a feed version SHA1 hash
GET/api/v1/routes?operated_by=o-9q9-BARToperated_by is a Onestop ID for an operator/agency
GET/api/v1/routes?vehicle_type=bus,4find all routes with vehicle type(s) by integer or string. Possible values defined by the GTFS spec for the route_type column and the Extended GTFS Route Types. Separate multiple vehicle types by commas.
GET/api/v1/routes?bbox=-122.4183,37.7758,-122.4120,37.7858bbox is a search bounding box with southwest longitude, southwest latitude, northeast longitude, northeast latitude (separated by commas)
GET/api/v1/routes?tag_key=route_colorfind all routes that have a tag of tag_key with any value
GET/api/v1/routes?tag_key=route_color&tag_value=FEF0B5find all routes that have a tag of tag_key and a value of tag_value
GET/api/v1/routes?traverses=r-9q9-pittsburg~baypoint~sfia~millbrae-49ae87-5ae164find all routes having specified route stop patterns
GET/api/v1/routes?import_level=4find all routes with a given import level
GET/api/v1/routes?include_geometry=truedetermine whether to return the route geometry. The default is true, which means route geometry is part of the response.
GET/api/v1/route_stop_patternsnone required
GET/api/v1/route_stop_patterns?traversed_by=r-9q8y-richmond~dalycity~millbraefind all Route Stop Patterns belonging to route
GET/api/v1/route_stop_patterns?bbox=-122.4183,37.7758,-122.4120,37.7858bbox is a search bounding box with southwest longitude, southwest latitude, northeast longitude, northeast latitude (separated by commas)
GET/api/v1/route_stop_patterns?stops_visited=s-dr5rec3weg-whitehallferryterminal,s-dr5r4rn32w-stgeorgeferryterminalany one or more stop Onestop IDs, separated by comma. Finds Route Stop Patterns with stops_visited in stop_pattern.
GET/api/v1/route_stop_patterns?trips=01SFO10,02SFO10any one or more trip ids, separated by comma. Finds Route Stop Patterns with specified trips in trips.
POST/api/v1/webhooks/feed_fetcher(secured) fetches all feeds
POST/api/v1/webhooks/feed_fetcher?feed_onestop_id=f-9q9-caltrain(secured) fetches only one feed
POST/api/v1/webhooks/feed_eater?feed_onestop_id=f-9q9-caltrain,feed_version_sha1=ab1e6ac73943082803f110df4b0fdd63a1d6b9f7(secured)
GET/api/v1/feedsnone required
GET/api/v1/feeds?tag_key=licensefind all feeds that have a tag of tag_key with any value
GET/api/v1/feeds?tag_key=license&tag_value=Creative%20Commons%20Attribution%203.0%20Unported%20Licensefind all feeds that have a tag of tag_key and a value of tag_value
GET/api/v1/feeds?bbox=-122.4183,37.7758,-122.4120,37.7858bbox is a search bounding box with southwest longitude, southwest latitude, northeast longitude, northeast latitude (separated by commas)
GET/api/v1/feeds/f-9q9-bayarearapidtransitnone required
GET/api/v1/feed_versions?feed_onestop_id=f-9q9-bayarearapidtransitfilter feed versions based on feed_onestop_id (which can be a comma-separated list of multiple Onestop IDs)
GET/api/v1/feed_versions/c06b4b6b40815f27c81b4fcf486ac1fd70ab1966none required
PUT/api/v1/feed_versions/c06b4b6b40815f27c81b4fcf486ac1fd70ab1966(secured) update import_level
GET/api/v1/feed_version_imports?feed_onestop_id=f-9q9-bayarearapidtransit&feed_version_sha1=c06b4b6b40815f27c81b4fcf486ac1fd70ab1966filter feed version import records based on feed_onestop_id and/or feed_version_sha1 (both of which can be comma-separated lists of multiple Onestop IDs)
GET/api/v1/feed_version_imports/1none required
GET/api/v1/schedule_stop_pairsFind all Schedule Stop Pairs. All options below can be combined.
GET/api/v1/schedule_stop_pairs?origin_onestop_id=s-9q8yyugptw-sanfranciscocaltrainstationFind all Schedule Stop Pairs from origin. Accepts multiple Onestop IDs, separated by commas.
GET/api/v1/schedule_stop_pairs?destination_onestop_id=s-9q8yyugptw-sanfranciscocaltrainstationFind all Schedule Stop Pairs to a destination. Accepts multiple Onestop IDs, separated by commas.
GET/api/v1/schedule_stop_pairs?date=2015-08-05Find all Schedule Stop Pairs from origin on date
GET/api/v1/schedule_stop_pairs?service_from_date=2015-08-05Find all Schedule Stop Pairs in effect from a date
GET/api/v1/schedule_stop_pairs?service_before_date=2015-10-20Find all Schedule Stop Pairs in effect before a date
GET/api/v1/schedule_stop_pairs?origin_departure_between=09:00:00,09:10:00Find all Schedule Stop Pairs with origin_departure_time in a range
GET/api/v1/schedule_stop_pairs?trip=6507768-CT-14OCT-Combo-Weekday-01Find all Schedule Stop Pairs by trip identifier
GET/api/v1/schedule_stop_pairs?route_onestop_id=r-9q8y-richmond~dalycity~millbraeFind all Schedule Stop Pairs by route. Accepts multiple Onestop IDs, separated by commas.
GET/api/v1/schedule_stop_pairs?operator_onestop_id=o-9q9-caltrainFind all Schedule Stop Pairs by operator. Accepts multiple Onestop IDs, separated by commas.
GET/api/v1/schedule_stop_pairs?bbox=-121.0,35.0,-124.0,37.0Find all Schedule Stop Pairs originating within a bounding box
GET/api/v1/schedule_stop_pairs?active=trueSchedule Stop Pairs from active FeedVersions
GET/api/v1/schedule_stop_pairs?import_level=2Schedule Stop Pairs from FeedVersion with a given import_level
GET/api/v1/feed_version_infos?feed_version_sha1=700753c9707f4fb203776d13fcb1e372d7b068faFeedVersionInfo records for a given Feed Version
GET/api/v1/feed_version_infos?feed_onestop_id=f-9q9-caltrainFeedVersionInfo records for a given Feed
GET/api/v1/feed_version_infos?type=FeedVersionInfoStatisticsFeedVersionInfo by info type

Pagination for JSON endpoints

  • ?offset=50 is the index of the first entity to be displayed (starts with 0)
  • By default, 50 entities are displayed per page. To change the number, specify ?per_page=1000.
  • To show the total number of results, use ?total=true

Max Request Size

If queries have not completed after two minutes, they will be killed and you will receive a timeout response from the Datastore. If your query times out, try reducing the per_page count, the bounding box size, etc. If your query seems as small as is possible, let us know.

Format

  • By default, responses are paginated JSON
  • Specify .geojson instead for GeoJSON on some endpoints. For example: /api/v1/stops.geojson?bbox=-122.4183,37.7758,-122.4120,37.7858 and /api/v1/routes.geojson?operated_by=o-9q9-bayarearapidtransit

API authentication

Any API calls that involve writing to the database (creating/editing/applying changesets or running the Feed Eater data ingestion pipeline) require authentication. Currently authentication is limited to Mapzen staff, although we're preparing to share editing and moderation authorization with outsider collaborators in the future.