When visualizing many routes over a large region, consider using Transitland's vector tiles instead of the REST API.
Documentation
REST API - Routes
Last updated
Routes
The REST API routes endpoint provides a fast and flexible way to browse routes and to visualize their representative geometries.
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" feed versions unless requesting a specific feed version.
Route API results are based on this GraphQL query.
GEThttps://transit.land/api/v2/rest/routes
- GET
https://transit.land/api/v2/rest/routes.{format}Request routes in specified format - GET
https://transit.land/api/v2/rest/routes/{route_key}Request a route by ID or Onestop ID - GET
https://transit.land/api/v2/rest/routes/{route_key}.{format}Request a route by ID or Onestop ID in specified format
Request
route_optional stringkey - Route lookup key; can be an integer ID, a '<feed onestop_id>:<gtfs route_id>' key, or a Onestop ID
agency_optional stringkey - Agency lookup key; can be an integer ID, a '<feed onestop_id>:<gtfs agency_id>' key, or a Onestop ID
route_optional stringtypes - Search for routes with these GTFS route (vehicle) types. Accepts comma separated values.
afteroptional integer (int32)- 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.
radiusoptional number- Search for routes geographically, based on stops at this location; radius is in meters, requires lon and lat
bboxoptional string- Geographic search using a bounding box, with coordinates in (min_lon, min_lat, max_lon, max_lat) order as a comma separated string
license_optional stringcommercial_ use_ allowed - 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'.
Allowed:
yes,no,unknown,exclude_no license_optional stringcreate_ derived_ product - 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'.
Allowed:
yes,no,unknown,exclude_no
Response
routesarray of Route- List or search for Routes
routes.route_nullable stringcolor - GTFS
routes.route_color; color that corresponds to a route, as a six-digit hexadecimal number (e.g.FF0000) routes.route_nullable stringdesc - GTFS
routes.route_desc; description of a route that provides useful, quality information routes.route_nullable stringshort_ name - GTFS
routes.route_short_name; short name of a route, such as a line number or abbreviation routes.route_nullable integersort_ order - GTFS
routes.route_sort_order; orders routes for display; routes with a lower value should be displayed first routes.route_nullable stringtext_ color - GTFS
routes.route_text_color; legible color to use for text drawn against the route_color background, as a six-digit hexadecimal number routes.route_integertype - GTFS
routes.route_type; numeric code indicating the type of transportation [0=tram/light rail, 1=subway/metro, 2=rail, 3=bus, 4=ferry, 5=cable tram, 6=aerial lift, 7=funicular, 11=trolleybus, 12=monorail]; extended types also supported routes.route_integertype_ basic - The basic GTFS route type this route's
route_typeis a kind of: an extended type is replaced by the basic type it belongs to, so 702 (express bus service) becomes 3 (bus) and 401 (metro service) becomes 1 (subway/metro). Aroute_typethat is already basic, or that is not a known extended type, is returned unchanged routes.continuous_nullable integerpickup - GTFS
routes.continuous_pickup; indicates whether a rider can board along the route between stops [0=continuous stopping pickup, 1=no continuous stopping, 2=must phone agency, 3=must coordinate with driver] routes.continuous_nullable integerdrop_ off - GTFS
routes.continuous_drop_off; indicates whether a rider can alight along the route between stops [0=continuous stopping drop-off, 1=no continuous stopping, 2=must phone agency, 3=must coordinate with driver] routes.cemv_nullable integersupport - GTFS
routes.cemv_support; whether riders can use a contactless EMV (cEMV) card or mobile device as fare media for trips on this route [0=no information, 1=supported, 2=not supported]; takes precedence overagency.cemv_support routes.geometrynullable Geometry- Aggregated representative geometry for this route as a single LineString or MultiLineString; for direction-specific shapes see
geometries routes.alertsnullable array of Alert- GTFS-RT service alerts on this route, as a whole or at one of its stops, whose agency and mode, if given, are the route's; pass
active: trueto return only currently active alerts,include_modes: trueto also return alerts on the route's mode, such as all of its agency's subway service, andinclude_trips: trueto also return alerts on the route's trips