Vic

PTV Timetable API - Version 3

The PTV Timetable API provides direct access to Public Transport Victoria’s public transport timetable data. The API returns scheduled timetable, route and…

Government & public#openapi#transport

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

Overview

The PTV Timetable API provides direct access to Public Transport Victoria’s public transport timetable data.

The API returns scheduled timetable, route and stop data for all metropolitan and regional train, tram and bus services in Victoria, including Night Network(Night Train and Night Tram data are included in metropolitan train and tram services data, respectively, whereas Night Bus is a separate route type).

The API also returns real-time data for metropolitan train, tram and bus services (where this data is made available to PTV), as well as disruption information, stop facility information, and access to myki ticket outlet data.

This Swagger is for Version 3 of the PTV Timetable API. By using this documentation you agree to comply with the licence and terms of service.

Train timetable data is updated daily, while the remaining data is updated weekly, taking into account any planned timetable changes (for example, due to holidays or planned disruptions). The PTV timetable API is the same API used by PTV for its apps. To access the most up to date data PTV has (including real-time data) you must use the API dynamically.

You can access the PTV Timetable API through a HTTP or HTTPS interface, as follows:

base URL / version number / API name / query string
The base URL is either:

  • http://timetableapi.ptv.vic.gov.au

or

  • https://timetableapi.ptv.vic.gov.au

The Swagger JSON file is available at http://timetableapi.ptv.vic.gov.au/swagger/docs/v3

Frequently asked questions are available on the PTV website at http://ptv.vic.gov.au/apifaq

Links to the following information are also provided on the PTV website at http://ptv.vic.gov.au/ptv-timetable-api/

  • How to register for an API key and calculate a signature
  • PTV Timetable API V2 to V3 Migration Guide
  • Documentation for Version 2 of the PTV Timetable API
  • PTV Timetable API Data Quality Statement

All information about how to use the API is in this documentation. PTV cannot provide technical support for the API.

Credits: This page has been based on Steve Bennett's http://opentransportdata.org/, used with permission.

Endpoints 26

Departures

  • GETView departures for all routes from a stop/v3/departures/route_type/:route_type/stop/:stop_id?platform_numbers=0&direction_id=0&gtfs=true&date_utc=2024-01-01T00:00:00Z&max_results=0&include_cancelled=true&look_backwards=true&expand=All&include_geopath=true&token=string&devid=string&signature=string
  • GETView departures for a specific route from a stop/v3/departures/route_type/:route_type/stop/:stop_id/route/:route_id?direction_id=0&gtfs=true&date_utc=2024-01-01T00:00:00Z&max_results=0&include_cancelled=true&look_backwards=true&expand=All&include_geopath=true&token=string&devid=string&signature=string

Directions

  • GETView directions that a route travels in/v3/directions/route/:route_id?token=string&devid=string&signature=string
  • GETView all routes for a direction of travel/v3/directions/:direction_id?token=string&devid=string&signature=string
  • GETView all routes of a particular type for a direction of travel/v3/directions/:direction_id/route_type/:route_type?token=string&devid=string&signature=string

Disruptions

  • GETView all disruptions for all route types/v3/disruptions?route_types=0&disruption_modes=1&disruption_status=current&token=string&devid=string&signature=string
  • GETGet all disruption modes/v3/disruptions/modes?token=string&devid=string&signature=string
  • GETView all disruptions for a particular route/v3/disruptions/route/:route_id?disruption_status=current&token=string&devid=string&signature=string
  • GETView all disruptions for a particular route and stop/v3/disruptions/route/:route_id/stop/:stop_id?disruption_status=current&token=string&devid=string&signature=string
  • GETView all disruptions for a particular stop/v3/disruptions/stop/:stop_id?disruption_status=current&token=string&devid=string&signature=string
  • GETView a specific disruption/v3/disruptions/:disruption_id?token=string&devid=string&signature=string

FareEstimate

  • GETEstimate a fare by zone/v3/fare_estimate/min_zone/:minZone/max_zone/:maxZone?journey_touch_on_utc=2024-01-01T00:00:00Z&journey_touch_off_utc=2024-01-01T00:00:00Z&is_journey_in_free_tram_zone=true&travelled_route_types=0&token=string&devid=string&signature=string

Outlets

  • GETList all ticket outlets/v3/outlets?max_results=0&token=string&devid=string&signature=string
  • GETList ticket outlets near a specific location/v3/outlets/location/:latitude,:longitude?max_distance=0.0&max_results=0&token=string&devid=string&signature=string

Patterns

  • GETView the stopping pattern for a specific trip/service run/v3/pattern/run/:run_ref/route_type/:route_type?expand=All&stop_id=0&date_utc=2024-01-01T00:00:00Z&include_skipped_stops=true&include_geopath=true&token=string&devid=string&signature=string

RouteTypes

  • GETView all route types and their names/v3/route_types?token=string&devid=string&signature=string

Routes

  • GETView route names and numbers for all routes/v3/routes?route_types=0&route_name=string&token=string&devid=string&signature=string
  • GETView route name and number for specific route ID/v3/routes/:route_id?include_geopath=true&geopath_utc=2024-01-01T00:00:00Z&token=string&devid=string&signature=string

Runs

  • GETView all trip/service runs for a specific route ID/v3/runs/route/:route_id?expand=All&date_utc=2024-01-01T00:00:00Z&token=string&devid=string&signature=string
  • GETView all trip/service runs for a specific route ID and route type/v3/runs/route/:route_id/route_type/:route_type?expand=All&date_utc=2024-01-01T00:00:00Z&token=string&devid=string&signature=string
  • GETView all trip/service runs for a specific run_ref/v3/runs/:run_ref?expand=All&date_utc=2024-01-01T00:00:00Z&include_geopath=true&token=string&devid=string&signature=string
  • GETView the trip/service run for a specific run_ref and route type/v3/runs/:run_ref/route_type/:route_type?expand=All&date_utc=2024-01-01T00:00:00Z&include_geopath=true&token=string&devid=string&signature=string

Search

  • GETView stops, routes and myki ticket outlets that match the search term/v3/search/:search_term?route_types=0&latitude=0.0&longitude=0.0&max_distance=0.0&include_addresses=true&include_outlets=true&match_stop_by_suburb=true&match_route_by_suburb=true&match_stop_by_gtfs_stop_id=true&token=string&devid=string&signature=string

Stops

  • GETView all stops near a specific location/v3/stops/location/:latitude,:longitude?route_types=0&max_results=0&max_distance=0.0&stop_disruptions=true&token=string&devid=string&signature=string
  • GETView all stops on a specific route/v3/stops/route/:route_id/route_type/:route_type?direction_id=0&stop_disruptions=true&include_geopath=true&geopath_utc=2024-01-01T00:00:00Z&token=string&devid=string&signature=string
  • GETView facilities at a specific stop (Metro and V/Line stations only)/v3/stops/:stop_id/route_type/:route_type?stop_location=true&stop_amenities=true&stop_accessibility=true&stop_contact=true&stop_ticket=true&gtfs=true&stop_staffing=true&stop_disruptions=true&token=string&devid=string&signature=string

API details

Base URL
http://timetableapi.ptv.vic.gov.au
https://timetableapi.ptv.vic.gov.au
Authentication
None declared in the description
Operations
26 operations on 26 pathsGET 26
Main resources
Disruptions 6Runs 4Directions 3Stops 3Departures 2Outlets 2Routes 2FareEstimate 1Patterns 1RouteTypes 1
Response formats
application/json text/html text/json
Description format
OpenAPI 3.0.0, API version v3
Listed from
APIs.guru OpenAPI Directory (CC0-1.0)
Source updated

How to test the PTV Timetable API - Version 3 in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the PTV Timetable API - Version 3 collection, without the publisher's secrets.
  3. Add your credentialsOpen the collection's variables or an environment and enter your API key or token, if the API needs one.
  4. Send a requestPick an endpoint, for example “View departures for all routes from a stop” (GET /v3/departures/route_type/:route_type/stop/:stop_id?platform_numbers=0&direction_id=0&gtfs=true&date_utc=2024-01-01T00:00:00Z&max_results=0&include_cancelled=true&look_backwards=true&expand=All&include_geopath=true&token=string&devid=string&signature=string), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the PTV Timetable API - Version 3?

The PTV Timetable API provides direct access to Public Transport Victoria’s public transport timetable data. The API returns scheduled timetable, route and… It is listed under Government & public and has 26 endpoints.

Who publishes the PTV Timetable API - Version 3?

It is listed from Vic's public API description (an OpenAPI document), not published by Vic on Swastik Codes. Anyone who controls ptv.vic.gov.au can claim the profile by adding a DNS TXT record.

What is the base URL of the PTV Timetable API - Version 3?

Its description lists 2 base URLs: http://timetableapi.ptv.vic.gov.au, https://timetableapi.ptv.vic.gov.au. The first is the usual one; the others are typically sandbox or regional servers.

How do I authenticate with the PTV Timetable API - Version 3?

Its OpenAPI description does not declare an authentication scheme. Some endpoints may be open; check the provider's documentation before relying on that.

How many endpoints does the PTV Timetable API - Version 3 have?

26 operations on 26 paths (26 GET). The largest groups are Disruptions, Runs, Directions, Stops.

Is forking the PTV Timetable API - Version 3 free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.