The Public Transit API returns the Transit Score for a location and provides easy access to nearby public transit stops and routes.
Programmers can use the Public Transit API to:
- Add Transit Score to your website
- Show public transit stops on a map
- Show details about nearby transit routes
The Public Transit API has data from over 350+ public transit agencies.
Transit data missing in your area, or have a feed to submit? Email us here.
Getting Started
To start using the Public Transit API, request an API key.
Branding Requirements
All API calls must comply with the Walk Score branding requirements.
Transit API Calls
There are six available API calls from the base URL https://transit.walkscore.com:
Name | URL | Description |
---|---|---|
score | /transit/score/ | Returns the Transit Score for a given location. |
stop search | /transit/search/stops/ | Returns information about stops near a given location. |
network search | /transit/search/network/ | Returns connected stops and routes near a given location. |
stop detail | /transit/stop/ID/ | Returns details for a single stop. |
route detail | /transit/route/ID/ | Returns details for a single route. |
supported cities | /transit/supported/cities/ | Returns a list of cities for which scores are available. |
All Transit API calls return JSON information and the HTTP 200 status code on success, or return an HTTP 4xx status code on failure.
All Transit API calls require an API Key parameter, wsapikey. If you do not include this parameter, you will receive a 4xx status code. If you are over quota, you will also receive a 4xx status code.
The "Transit Score" API Call
The score API call returns a Transit Score for a location that is an integer between 0 and 100 along with an English description of the score.
Transit Score is available in the following cities. You must pass in a valid city along with either a two-letter state or country code in order to receive a Transit Score.
The score API takes the following parameters:
Parameter | Required | Description |
---|---|---|
lat | yes | The latitude to score. |
lon | yes | The longitude to score. |
city | yes | The name of the city where the address is located. |
state | required in US | A two-letter USPS state code for the city. You must supply this parameter for cities in the United States; for all other cities, you should instead use the country parameter. |
country | required outside US | A two-letter ISO-3166 country code for the city. You must supply this parameter for cities outside of the United States; for cities in the United States, use the state parameter instead. |
wsapikey | yes | Your Walk Score API Key. |
The score API returns a JSON dictionary containing the following keys:
Key | Description |
---|---|
transit_score | The score, an integer between 0 and 100 inclusive. |
description | An English description of the Transit Score suitable for display to users. E.G. Rider's Paradise. |
summary | An English summary of the number of routes used to compute this transit score. |
ws_link | A link to the Transit Score page for this address on walkscore.com. |
logo_url | Link to the Walk Score logo. |
help_link | A link to the walkscore.com page for how scoring works. |
The returned logo_url is an https link, but it may also be accessed via http.
EXAMPLE. To get the Transit Score of Pike Place Market in Seattle, make the following call:
https://transit.walkscore.com/transit/score/?lat=47.6101359&lon=-122.3420567&city=Seattle&state=WA&wsapikey=your_key
The Transit API will return the following JSON:
{ "scored_lat": 47.610135900000003, "scored_lon": -122.3420567, "transit_score": 100, "description": "World-Class", "summary": "266 nearby routes: 260 bus, 4 rail, 2 other", "ws_link": "http://www.walkscore.com/...", "help_link": "https://www.redfin.com/how-walk-score-works" }
Transit Score API Status and Error Codes
Successful API requests return an HTTP 200 response:
HTTP Response | Status Code | Description |
---|---|---|
400 | City/state not supported. |
Contact us for tech support.
The "Stop Search" API Call
The stop search API call returns information about stops near a given location.
This call returns sixteen stops that service unique routes near the location. In other words, each stop must contain a unique route or it is considered a duplicate stop. For example, if there were three bus stops near a location that only served the Route #16 bus, only the first of those stops would be returned by the stop search API call.
If you want all stops and routes use the network search call.
Summary text and HTML about the stops and the corresponding routes is also returned. Structured information about related routes is also provided.
The stop search API takes the following parameters:
Parameter | Required | Description | Default |
---|---|---|---|
lat | yes | The latitude to search near. | |
lon | yes | The longitude to search near. | |
wsapikey | yes | Your Walk Score API Key. |
The stop search API returns a JSON array of stop dictionaries. Each stop dictionary contains the following keys:
Key | Description |
---|---|
id | The stop's id. This can be used to query for further stop details. |
lat | The stop's latitude. |
lon | The stop's longitude. |
name | The stop's name; often, this is the street intersection. |
distance | The stop's distance to the search point, in miles. |
summary_text | A text summary of the stop, its distance to the search location, and serviced routes. |
summary_html | An HTML summary of the stop, suitable for adding directly to your web page. |
route_summary | A JSON array of routes corresponding to this stop. See below for route summary information. |
A route_summary is provided for each stop. The route_summary is a JSON array containing dictionaries with the following keys:
Key | Description |
---|---|
id | The route's id. This can be used to query for further route details. |
name | The route's name; generally, this is the bus or train route number. |
short_name | The route's short name as specified by GTFS; often, a short abstract identifier. |
long_name | The route's long name as specified by GTFS; often, includes the route's destination or stop. |
category | The route's transit category, either "Rail," "Bus," or "Other." |
agency | The name of the transit agency that operates this route. |
agency_url | A link to the transit agency's home page. |
color | A hex string representing the route's color designation. Defaults to white (FFFFFF). |
text_color | A hex string representing a legible color to use for text against a background of the route's color. Defaults to black (000000). |
description | A description of the route. |
EXAMPLE. To get stops near JFK airport that service unique routes, make the following call:
https://transit.walkscore.com/transit/search/stops/?lat=40.6678248&lon=-73.8330133&wsapikey=your_key
The Transit API will return the following JSON:
[ { "name": "Aqueduct Racetrack", "summary_text": "Aqueduct Racetrack (0.1 mi)\tA 8 Avenue Express", "summary_html": " <span class=\"walkscore\"> <span class=\"stop\">Aqueduct Racetrack</span> <span class=\"distance\">(0.1 mi)</span> <span class=\"Rail\">A 8 Avenue Express</span></span>", "route_summary": [ { "text_color": "FFFFFF", "id": "8c057", "agency": "MTA New York City Transit", "agency_url": "http://www.mta.info", "color": "2850AD", "short_name": "A", "name": "A 8 Avenue Express", "description": "Trains operate between Inwood-207 St, Manhattan and Far Rockaway-Mott Avenue...", "long_name": "8 Avenue Express", "category": "Rail" }, ... ], "lon": -73.834058, "lat": 40.668234, "distance": 0.1, "id": "s16679" }, ... ]
The "Transit Network Search" API Call
The network search API is an advanced API call that returns detailed information about all of the routes and stops within one mile of a given location. Information is returned in two dictionary data structures so that it can be cross-correlated. In general, you should only use this API if you have advanced needs; the data it returns is richer but is more complex to process.
The network search API takes the following parameters:
Parameter | Required | Description | Default |
---|---|---|---|
lat | yes | The latitude to search near. | |
lon | yes | The longitude to search near. | |
wsapikey | yes | Your Walk Score API Key. |
The network search API returns a JSON dictionary containing two keys:
Key | Description |
---|---|
routes | A dictionary where each key is a route's id, and each value is a route detail dictionary. (See below.) |
stops | A dictionary where each key is a stop's id, and each value is a stop detail dictionary. (See below.) |
Each route detail dictionary contains the following keys:
Key | Description |
---|---|
id | The route's id. This can be used to query for further route details. |
name | The route's name; generally, this is the bus or train route number. |
short_name | The route's short name as specified by GTFS; often, a short abstract identifier. |
long_name | The route's long name as specified by GTFS; often, includes the route's destination or stop. |
category | The route's transit category, either "Rail," "Bus," or "Other." |
agency | The name of the transit agency responsible for this route. |
agency_url | The name of the transit agency that operates this route. |
color | A hex string representing the route's color designation. Defaults to white (FFFFFF). |
text_color | A hex string representing a legible color to use for text against a background of the route's color. Defaults to black (000000). |
description | A description of the route. |
stop_ids | A list of Stop IDs serviced by this route. The ids in this list are not guaranteed to appear as keys in the top-level stops dictionary. |
And each stop detail dictionary contains the following keys:
Key | Description |
---|---|
id | The stop's id. This can be used to query for further stop details. |
lat | The stop's latitude. |
lon | The stop's longitude. |
name | The stop's name; often, this is the street intersection. |
route_ids | A JSON array of route ids corresponding to this stop. The ids in this list are guaranteed to appear as keys in the routes top-level dictionary. |
The network search API call guarantees that, for a given stop, all of the corresponding route_id values are found in the routes dictionary. The reverse is not guaranteed.
EXAMPLE. To get extensive information about the transit network within a mile of JFK Airport, make the following call:
https://transit.walkscore.com/transit/search/network/?lat=40.6678248&lon=-73.8330133&wsapikey=your_key
The Transit API will return the following JSON:
{ "routes": { "r446": { "category": "Rail", "agency": "MTA New York City Transit", "name": "A 8 Avenue Express", "short_name": "A", "long_name": "8 Avenue Express", "agency_url": "http://www.mta.info", "color": "2850AD", "text_color": "FFFFFF", "description": "Trains operate between Inwood-207 St, Manhattan and Far Rockaway-Mott Avenue...", "stop_ids": [ "s10644", "s14748", ... ], "id": "r446" }, "r462": { "category": "Bus", "agency": "MTA Bus Company", "name": "Q11 Elmhurst / Queens Ctr - Old Howard Bch", "short_name": "Q11", "long_name": "Elmhurst / Queens Ctr - Old Howard Bch", "agency_url": "http://www.mta.info", "color": "6CBE45", "text_color": "FFFFFF", "description": null, "stop_ids": [ "s13828", "s11155", ... ], "id": "r462" }, ... }, "stops": { "s17737": { "lat": 40.668234, "route_ids": [ "r415", "r282", ... ], "lon": -73.834058, "id": "s17737", "name": "Aqueduct - North Conduit Av" }, "s11544": { "lat": 40.663429, "route_ids": [ "r478", "r254", ... ], "lon": -73.833281, "id": "s11544", "name": "101 ST /157 AV" }, ... } }
The "Stop Details" API Call
The stop details API call returns detailed information about a single stop. You must call this URL with a valid stop ID.
The stop details API takes the following parameters:
Parameter | Required | Description | Default |
---|---|---|---|
ID | yes | This ID is specified in the URL itself. See below for details. | |
wsapikey | yes | Your Walk Score API Key. |
The stop details API returns a JSON dictionary containing the following keys:
Key | Description |
---|---|
id | The stop's id. |
lat | The stop's latitude. |
lon | The stop's longitude. |
name | The stop's name; often, this is the street intersection. |
route_ids | A JSON array of route IDs corresponding to this stop. Route IDs can be used to perform further lookups. |
EXAMPLE. To get detail about stop s17737, make the following call:
https://transit.walkscore.com/transit/stop/s17737/?wsapikey=your_key
The Transit API will return the following JSON:
{ "lat": 47.610702500000002, "route_ids": [ "r415", "r282", "r403", "r375", "r367" ], "lon": -122.340332, "id": "s17737", "name": "2nd Ave & Stewart St" }
The "Route Details" API Call
The routes details API call returns detailed information about a single route. You must call this URL with a valid route ID.
The route details API takes the following parameters:
Parameter | Required | Description | Default |
---|---|---|---|
ID | yes | This ID is specified in the URL itself. See below for details. | |
wsapikey | yes | Your Walk Score API Key. |
The route details API returns a JSON dictionary containing the following keys:
Key | Description |
---|---|
id | The route's id. This can be used to query for further route details. |
name | The route's name; generally, this is the bus or train route number. |
short_name | The route's short name as specified by GTFS; often, a short abstract identifier. |
long_name | The route's long name as specified by GTFS; often, includes the route's destination or stop. |
category | The route's transit category, either "Rail," "Bus," or "Other." |
agency | The name of the transit agency responsible for this route. |
agency_url | A link to the responsible agency's home page. |
color | A hex string representing the route's color designation. Defaults to white (FFFFFF). |
text_color | A hex string representing a legible color to use for text against a background of the route's color. Defaults to black (000000). |
description | A description of the route. |
stop_ids | A list of Stop IDs serviced by this route. The ids in this list are not guaranteed to appear as keys in the top-level stops dictionary. |
geometry_wkt | A Well-Known Text string describing the path of this route on a map. This may be an empty linestring, a point, or a linestring with multiple points. |
EXAMPLE. To get detail about route r403, make the following call:
https://transit.walkscore.com/transit/route/r403/?wsapikey=your_key
The Transit API will return the following JSON:
{ "category": "Rail", "agency": "MTA New York City Transit", "name": "A 8 Avenue Express", "short_name": "A", "long_name": "8 Avenue Express", "agency_url": "http://www.mta.info", "color": "2850AD", "text_color": "FFFFFF", "description": "Trains operate between Inwood-207 St, Manhattan and Far Rockaway-Mott Avenue...", "stop_ids": [ "s12203", "s13993", ... ], "id": "r403", "geometry_wkt": "LINESTRING(...)" }
The "Supported Cities" API Call
The supported cities API call returns a list of cities where the score API is known to provide good results. This call is a structured way to get a list of our supported cities and is not generally used by our API partners.
The supported cities API takes the following parameters:
Parameter | Required | Description |
---|---|---|
wsapikey | yes | Your Walk Score API Key. |
The supported cities API returns a JSON array of supported cities. Each city is represented as a dictionary containing the following keys:
Key | Description |
---|---|
city | The canonical name of a supported city. |
state | Optional. A two-letter USPS state code. This value is provided if, and only if, the supported city is located in the United States. |
country | Optional. A two-letter ISO-3166 country code. This value is provided if, and only if, the supported city is located outside of the United States. |
population | The current estimated population of the city. |
EXAMPLE. To get detail about supported cities, make the following call:
https://transit.walkscore.com/transit/supported/cities/?wsapikey=your_key
The Transit API will return the following JSON:
[ { "city": "Seattle", "state": "WA", "population": 617000 }, ... ]