PTV Timetable Gem Build Status

A ruby gem for interacting with the PTV timetable API version 2.0.


To use this gem you will need to request a devid and secret key. Instructions on how to do this are available in the API specificationn.

For all API calls you will need a valid devid and secret_key.

api ='devid', 'secret_key')

Health Check

The Health Check will test a number of the key services that deliver the PTV Timetable API and let you know if there are any problems with connectivity, availability or reachability.


N.B. Calling the Health Check API at the start of each sequence of APIs flushes out any system problems.

Stops Nearby

Stops Nearby returns up to 30 stops nearest to a specified coordinate.

api.near_me(-37.82392124423254, 144.9462017431463)

Transport POIs by Map

Transport POIs by Map returns a set of locations consisting of stops and/or myki ticket outlets (collectively known as points of interest) within a region demarcated on a map through a set of latitude and longitude coordinates.

api.points_of_interest(-37.82205143151239, 144.9779160007277, -37.81393456848758, 144.9859159992726)

# Or just myki ticket outlets
api.points_of_interest(-37.82205143151239, 144.9779160007277, -37.81393456848758, 144.9859159992726, PtvTimetable::TICKET_OUTLET)


The Search API returns all stops and lines that match the input search text.'Alamein')

Broad Next Departures

Broad Next Departures returns the next departure times at a prescribed stop irrespective of the line and direction of the service.

For example, if the stop is Camberwell Station, Broad Next Departures will return the times for all three lines (Belgrave, Lilydale and Alamein) running in both directions (towards the city and away from the city).

api.broad_next_departures(PtvTimetable::BUS, 28905)

Specific Next Departures

Specific Next Departures returns the times for the next departures at a prescribed stop for a specific mode, line and direction.

For example, if the stop is Camberwell Station, Specific Next Departures returns only the times

api.specific_next_departures(PtvTimetable::BUS, 5111, 2896, 28905, 515)

Stopping Pattern

The Stopping Pattern API returns the stopping pattern for a specific run (i.e. transport service) from a prescribed stop at a prescribed time. The stopping pattern is comprised of timetable values ordered by stopping order.

api.stopping_pattern(PtvTimetable::BUS, 1464, 1108, '2013-11-13T05:24:25Z')

Stops on a Line

The Stops on a Line API returns a list of all the stops for a requested line, ordered by location name.

api.line_stops(PtvTimetable::BUS, 1818)


Add this line to your application's Gemfile:

gem 'ptv_timetable'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ptv_timetable


  1. Fork it ( )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Disclaimer & Attribution

This ruby gem and it's developers are in no way affiliated with Public Transport Victoria (PTV). Any trademarks referred to are the property of their respective trademark holders. We declare no affiliation, sponsorship, nor any partnerships with any registered trademarks.

The API specification titled "Timetable API" was released under the Creative Commons license. I attribute this publication - Source: Licensed from Public Transport Victoria under a Creative Commons Attribution 3.0 Australia Licence.