Walk Score Professional

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 200+ public transit agencies.

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 http://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 Scores are 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 yes 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 no 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.
research no If yes, the Transit API bypasses validating the city, state, and country parameters. When set to yes, transit scores are considered experimental.
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.

EXAMPLE. To get the Transit Score of Pike Place Market in Seattle, make the following call:

http://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/..."
}

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.
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.

EXAMPLE. To get sixteen stops near Pike Place Market that service unique routes, make the following call:

http://transit.walkscore.com/transit/search/stops/?lat=47.6101359&lon=-122.3420567&wsapikey=your_key

The Transit API will return the following JSON:

[
    {
        "name": "1st Ave & Pine St",
        "summary_text": "1st Ave & Pine St (0.1 mi)\t15, 18, 21, 22, 56, 81",
        "summary_html": "
            <span class=\"walkscore\">
                <span class=\"stop\">1st Ave &amp; Pine St</span>
                <span class=\"distance\">(0.1 mi)</span>
                <span class=\"Bus\">15, 18, 21, 22, 56, 81</span></span>",
        "route_summary": [
            {
                "category": "Bus",
                "id": "r437",
                "name": "15"
            },
            {
                "category": "Bus",
                "id": "r448",
                "name": "18"
            },
            ...
        ],
        "lon": -122.341072,
        "lat": 47.609840400000003,
        "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.
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.
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.
distance The stop's distance to the search point, in miles.
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 Pike Place Market, make the following call:

http://transit.walkscore.com/transit/search/network/?lat=47.6101359&lon=-122.3420567&wsapikey=your_key

The Transit API will return the following JSON:

{
    "routes": {
        "r446": {
            "category": "Bus",
            "agency": "Metro Transit",
            "name": "10",
            "agency_url": "http://metro.kingcounty.gov",
            "stop_ids": [
                "s10644",
                "s14748",
                ...
            ],
            "id": "r446"
        },
        "r462": {
            "category": "Bus",
            "agency": "Metro Transit",
            "name": "81",
            "agency_url": "http://metro.kingcounty.gov",
            "stop_ids": [
                "s13828",
                "s11155",
                ...
            ],
            "id": "r462"
        },
        ...
    },
    "stops": {
        "s17737": {
            "lat": 47.610702500000002,
            "route_ids": [
                "r415",
                "r282",
                ...
            ],
            "lon": -122.340332,
            "id": "s17737",
            "name": "2nd Ave & Stewart St"
        },
        "s11544": {
            "lat": 47.609794600000001,
            "route_ids": [
                "r478",
                "r254",
                ...
            ],
            "lon": -122.340782,
            "id": "s11544",
            "name": "1st Ave & Pine St"
        },
        ...
    }
}

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:

http://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.
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.
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 LINESTRING describing the path of this route on a map. This may be an empty linestring.

EXAMPLE. To get detail about route r403, make the following call:

http://transit.walkscore.com/transit/route/r403/?wsapikey=your_key

The Transit API will return the following JSON:

{
    "category": "Bus",
    "agency": "Metro Transit",
    "name": "214",
    "agency_url": "http://metro.kingcounty.gov",
    "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:

http://transit.walkscore.com/transit/supported/cities/?wsapikey=your_key

The Transit API will return the following JSON:

[
    {
        "city": "Seattle",
        "state": "WA",
        "population": 617000
    },
    ...
]