Stops / Routes / Recommended routes help

76 views
Skip to first unread message

Sam Pullman

unread,
Jan 2, 2022, 8:58:48 PMJan 2
to MBTA Developers
Hi MBTA, I am trying to create a query to find the recommended route between two stops. I only care about stops that have light/heavy subway rail vehicles (type=0,1). I have so far used the following queries:

Query #1
Get all routes that are of heavy/light rail type:
/routes?api_key={API_Key}&filter[type]=0,1

Query #2
Returns all stops for given route:
/stops?api_key={API_Key}&include=route&filter[route]={route}

Query #3
For each stop, I use the following query to get the detailed stop info, like id.
stops/{place}?api_key= {API_Key} &include=connecting_stops,child_stops

But I feel like I may be stuck. My goal is to supply any two stops for any of the Subway routes I get back from query #1, and to return a recommended route between the two. For example, I want to find a way to choose Haymarket (Orange Line) and Milton (Mattapan Trolley) and get a reccomended route between the two. My ideal functionality would be a query based JSON API version of what is available through https://www.mbta.com/trip-planner.

Thank you in advance!

Developer at MBTA

unread,
Feb 15, 2022, 11:56:02 AMFeb 15
to MBTA Developers
Hi there,

We do not currently provide an API for trip planning, but there are other paid and open-source services that can do trip planning using our GTFS feeds. Google's Directions API is a straightforward pay-per-request option. OpenTripPlanner (2.0 or later) is a good open-source option, but you will need to set it up on your own servers and point it to our GTFS and GTFS-rt URLs.

—Developer@MBTA
Reply all
Reply to author
Forward
0 new messages