Developers

We love seeing all the cool and interesting ways people mash up our data. So to help people shorten their development cycles we've created an API.

Go. Play. Innovate. Mash up. Make transit better!

Station/Stop API

Any web URL for a stop or station can also be requested as JSON or XML, depending on the extension:

web:
https://myttc.ca/finch_station

api:
https://myttc.ca/finch_station.json
https://myttc.ca/finch_station.xml

See below for a commented example of the JSON output for Spadina Station.

PROTIP: We also watch for the HTTP "Accept" header, so ajax library functions like jQuery's $.getJSON() don't require an extension; we'll return JSON automatically. Same goes for XML.

Undocumented APIs

We have several APIs which we haven't documented, but they may change unexpectedly. There is a chance we might give you head up on the google group, but currently they are experimental.

Take look at:
https://myttc.ca/near/43.6557074,-79.3850234.json
https://myttc.ca/near/steeles_and_bathurst.json
https://myttc.ca/vehicles/near/bay_and_dundas.json

API key

We find API keys to be such a nuisance, don't you? That's why we've opted not to use them! That said, please be respectful and try not to hammer our servers. If you have an app that requires heaps of data all the time, please consider downloading the entire dataset from our Google Group.

MyTTC developer Google Group

You can find a full dump of our data in either raw SQL or GTFS format from here: http://groups.google.com/group/myttc

Don't be a stranger

We'd love to hear about your project! Drop us a line using the feedback box and we'll add you to the third party apps section :-)

JSON Example (commented)

{
// Name of the location
"name": "Drewry and Cactus-Gardenia Court",
// The URI of the location, locations are groups of stops - they can be
// intersections, stations or even specific addresses.
// generally a Location has more then one stop, but sometimes there are
// stops without an opposing direction stop and sits in a location by itself.
//
// Notes:
// All locations and/or routes have a unique
// human-readable URI that identify them in the system.
//
// All requests to the API use these URIs in the format
// http://myttc.ca/:uri[.json|.xml]
//
"uri": "drewry_and_cactus-gardenia_court",
// Time at which the API request was made
"time": 1260254483,
// (array) All stops that belong to this location
//
// stops can be grouped for specific directions, nearside/farside,
// platforms in a station, stops for individual routes or blue night only stops
"stops": [
{
// name of the stop
"name": "Eastbound on Drewry at Gardenia Court",
// uri of the stop (see above - doing a request
// to this uri returns the same result)
"uri": "eastbound_on_drewry_at_gardenia_court",
// (array) All the routes that *stop here*
// this stop only has one route stop at it, but some stops have near a dozen
"routes": [
{
// name for the route
"name": "125 Drewry",
// agency for this route
"agency": "Toronto Transit Commission",
// uri for the route
"uri": "125_drewry",
// (array) Upcoming vehicle departure times at this stop for this route
//
// Notes:
// Ordered by time, in ascending order.
//
// There will always be at least 3 of each distinct shape.
//
// In this case, there is only a single shape, so only 3 times
//
"stop_times": [
{
// (unix timestamp) Time of vehicle departure
//
// Notes:
// This is the timestamp of the vehicle departure.
//
// This value MAY NOT be for today - for example,
// there are a few Sunday-only routes in the system
// whose next 3 stoptimes may not occur for several
// days - this should always be used in lieu of the
// "departure_time" field for calculating the date.
//
"departure_timestamp": 1260269360,
// Vehicle headsign
//
// Notes:
// This is what's actually printed on the headsign of the vehicle.
//
// Useful for people to identify a particular branch
//
"shape": "125 Drewry to Finch Station",
// Time of vehicle departure (all pretty like)
//
// Notes:
// This field is for display purposes only - saves you
// having to generate a pretty time.
//
// There is NO DATE INFORMATION encoded in this field (see above)
//
"departure_time": "5:49a",
},
// repeats - for more documentation jump to the bottom
{
"departure_timestamp": 1260269840,
"shape": "125 Drewry to Finch Station",
"departure_time": "5:57a",
},
{
"departure_timestamp": 1260270320,
"shape": "125 Drewry to Finch Station",
"departure_time": "6:05a",
}
]
}
]
},
// next stop, repeats for all stops in the location
{
"name": "Northbound on Cactus at Drewry Farside",
"uri": "northbound_on_cactus_at_drewry_farside",
"agency": "Toronto Transit Commission",
"routes": [
{
"name": "98 Willowdale-Senlac",
"uri": "98_willowdale-senlac",
// this route has 2 shapes, the stop times are still sorted
// by time, but there are 6 stop times
"stop_times": [
{
"departure_timestamp": 1260269377,
"shape": "98A Willowdale-Senlac to Sheppard-Yonge Station via Senlac",
"departure_time": "5:49a",
},
{
"departure_timestamp": 1260270473,
"shape": "98 Willowdale-Senlac to Peckham via Sheppard-Yonge Station",
"departure_time": "6:07a",
},
{
"departure_timestamp": 1260271177,
"shape": "98A Willowdale-Senlac to Sheppard-Yonge Station via Senlac",
"departure_time": "6:19a",
},
{
"departure_timestamp": 1260272273,
"shape": "98 Willowdale-Senlac to Peckham via Sheppard-Yonge Station",
"departure_time": "6:37a",
},
{
"departure_timestamp": 1260272977,
"shape": "98A Willowdale-Senlac to Sheppard-Yonge Station via Senlac",
"departure_time": "6:49a",
},
{
"departure_timestamp": 1260274073,
"shape": "98 Willowdale-Senlac to Peckham via Sheppard-Yonge Station",
"departure_time": "7:07a",
}
]
}
]
},
{
"name": "Southbound on Cactus at Drewry",
"uri": "southbound_on_cactus_at_drewry",
"agency": "Toronto Transit Commission",
"routes": [
{
"name": "98 Willowdale-Senlac",
"uri": "98_willowdale-senlac",
"stop_times": [
{
"departure_timestamp": 1260269114,
"shape": "98A Willowdale-Senlac to Peckham via Senlac",
"departure_time": "5:45a",
},
{
"departure_timestamp": 1260270725,
"shape": "98 Willowdale-Senlac to Steeles via Senlac",
"departure_time": "6:12a",
},
{
"departure_timestamp": 1260270914,
"shape": "98A Willowdale-Senlac to Peckham via Senlac",
"departure_time": "6:15a",
},
{
"departure_timestamp": 1260272525,
"shape": "98 Willowdale-Senlac to Steeles via Senlac",
"departure_time": "6:42a",
},
{
"departure_timestamp": 1260272714,
"shape": "98A Willowdale-Senlac to Peckham via Senlac",
"departure_time": "6:45a",
},
{
"departure_timestamp": 1260274325,
"shape": "98 Willowdale-Senlac to Steeles via Senlac",
"departure_time": "7:12a",
}
]
}
]
},
{
"name": "Westbound on Drewry at Cactus",
"uri": "westbound_on_drewry_at_cactus",
"agency": "Toronto Transit Commission",
"routes": [
{
"name": "125 Drewry",
"uri": "125_drewry",
"stop_times": [
{
"departure_timestamp": 1260270461,
"shape": "125 Drewry to Bathurst Torresdale",
"departure_time": "6:07a",
},
{
"departure_timestamp": 1260270941,
"shape": "125 Drewry to Bathurst Torresdale",
"departure_time": "6:15a",
},
{
"departure_timestamp": 1260271421,
"shape": "125 Drewry to Bathurst Torresdale",
"departure_time": "6:23a",
}
]
}
]
}
]
}
view raw JSON Example.js hosted with ❤ by GitHub