Skip to content
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.

When visualizing many routes over a large region, consider using Transitland's vector tiles instead of the REST API.

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

  • GEThttps://transit.land/api/v2/rest/routes.{format}Request routes in specified format
  • GEThttps://transit.land/api/v2/rest/routes/{route_key}Request a route by ID or Onestop ID
  • GEThttps://transit.land/api/v2/rest/routes/{route_key}.{format}Request a route by ID or Onestop ID in specified format

Request

route_keyoptional string
Route lookup key; can be an integer ID, a '<feed onestop_id>:<gtfs route_id>' key, or a Onestop ID
agency_keyoptional string
Agency lookup key; can be an integer ID, a '<feed onestop_id>:<gtfs agency_id>' key, or a Onestop ID
route_idoptional string
Search for records with this GTFS route_id
route_typeoptional integer
Search for routes with this GTFS route (vehicle) type
route_typesoptional string
Search for routes with these GTFS route (vehicle) types. Accepts comma separated values.
operator_onestop_idoptional string
Search for records by operator OnestopID
serves_stop_onestop_idoptional string
Search for routes serving a stop with this OnestopID
include_alertsoptional string
Include alerts from GTFS Realtime feeds

Allowed:true, false

include_geometryoptional string
Include route geometry

Allowed:true, false

include_stopsoptional string
Include route stops

Allowed:true, false

idoptional integer (int32)
Search for a specific internal ID
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.
limitoptional integer (int32)
Maximum number of records to return
formatoptional string
Response format

Allowed:json, geojson, geojsonl

onestop_idoptional string
Search for a specific Onestop ID
feed_version_sha1optional string
Search for records in this feed version
feed_onestop_idoptional string
Search for records in this feed
radiusoptional number
Search for routes geographically, based on stops at this location; radius is in meters, requires lon and lat
latoptional number
Latitude
lonoptional number
Longitude
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_commercial_use_allowedoptional string
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_share_alike_optionaloptional string
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'.

Allowed:yes, no, unknown, exclude_no

license_create_derived_productoptional string
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

license_redistribution_allowedoptional string
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'.

Allowed:yes, no, unknown, exclude_no

license_use_without_attributionoptional string
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'.

Allowed:yes, no, unknown, exclude_no

Response

routesarray of Route
List or search for Routes
routes.idinteger
Internal integer ID
routes.route_colornullable string
GTFS routes.route_color; color that corresponds to a route, as a six-digit hexadecimal number (e.g. FF0000)
routes.route_descnullable string
GTFS routes.route_desc; description of a route that provides useful, quality information
routes.route_idstring
GTFS routes.route_id
routes.route_long_namenullable string
GTFS routes.route_long_name; full descriptive name of a route
routes.route_short_namenullable string
GTFS routes.route_short_name; short name of a route, such as a line number or abbreviation
routes.route_sort_ordernullable integer
GTFS routes.route_sort_order; orders routes for display; routes with a lower value should be displayed first
routes.route_text_colornullable string
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_typeinteger
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_type_basicinteger
The basic GTFS route type this route's route_type is 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). A route_type that is already basic, or that is not a known extended type, is returned unchanged
routes.route_urlnullable string
GTFS routes.route_url; URL of a web page about the particular route
routes.continuous_pickupnullable integer
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_drop_offnullable integer
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_supportnullable integer
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 over agency.cemv_support
routes.onestop_idnullable string
Onestop ID for this route
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: true to return only currently active alerts, include_modes: true to also return alerts on the route's mode, such as all of its agency's subway service, and include_trips: true to also return alerts on the route's trips
routes.agencyAgency
Agency associated with this route
routes.feed_versionFeedVersion
Source feed version for this entity
routes.route_stopsarray of RouteStop
Stops on this route as RouteStop associations (with route and agency context)