Skip to content

PTV Timetable API - Version 3 API

by ptv.vic.gov.au

Open documentation ↗

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.

PTV Timetable API - Version 3 is a transportation API from ptv.vic.gov.au. It needs no API key. It is served over plain HTTP. Its OpenAPI description documents 26 endpoints.

At a glance

Authentication
No auth
HTTPS
No
CORS
Unknown
Base URL
http://timetableapi.ptv.vic.gov.au
Version
v3
Endpoints
26
Spec updated
2021-06-30

Make a first request

Replace the placeholders; the documentation says exactly where credentials go.

cURL
curl -X GET "http://timetableapi.ptv.vic.gov.au/v3/disruptions" \
  -H "Accept: application/json"
JavaScript
const response = await fetch("http://timetableapi.ptv.vic.gov.au/v3/disruptions", {
  method: "GET",
  headers: {
    "Accept": "application/json",
  },
});
const data = await response.json();
console.log(data);
Python
import requests

response = requests.request(
    "GET",
    "http://timetableapi.ptv.vic.gov.au/v3/disruptions",
    headers={
    "Accept": "application/json",
    },
    timeout=30,
)
print(response.json())

Endpoints

MethodPathWhat it does
GET/v3/departures/route_type/{route_type}/stop/{stop_id}View departures for all routes from a stop
GET/v3/departures/route_type/{route_type}/stop/{stop_id}/route/{route_id}View departures for a specific route from a stop
GET/v3/directions/route/{route_id}View directions that a route travels in
GET/v3/directions/{direction_id}View all routes for a direction of travel
GET/v3/directions/{direction_id}/route_type/{route_type}View all routes of a particular type for a direction of travel
GET/v3/disruptionsView all disruptions for all route types
GET/v3/disruptions/modesGet all disruption modes
GET/v3/disruptions/route/{route_id}View all disruptions for a particular route
GET/v3/disruptions/route/{route_id}/stop/{stop_id}View all disruptions for a particular route and stop
GET/v3/disruptions/stop/{stop_id}View all disruptions for a particular stop
GET/v3/disruptions/{disruption_id}View a specific disruption
GET/v3/fare_estimate/min_zone/{minZone}/max_zone/{maxZone}Estimate a fare by zone
GET/v3/outletsList all ticket outlets
GET/v3/outlets/location/{latitude},{longitude}List ticket outlets near a specific location
GET/v3/pattern/run/{run_ref}/route_type/{route_type}View the stopping pattern for a specific trip/service run
GET/v3/route_typesView all route types and their names
GET/v3/routesView route names and numbers for all routes
GET/v3/routes/{route_id}View route name and number for specific route ID
GET/v3/runs/route/{route_id}View all trip/service runs for a specific route ID
GET/v3/runs/route/{route_id}/route_type/{route_type}View all trip/service runs for a specific route ID and route type
GET/v3/runs/{run_ref}View all trip/service runs for a specific run_ref
GET/v3/runs/{run_ref}/route_type/{route_type}View the trip/service run for a specific run_ref and route type
GET/v3/search/{search_term}View stops, routes and myki ticket outlets that match the search term
GET/v3/stops/location/{latitude},{longitude}View all stops near a specific location
GET/v3/stops/route/{route_id}/route_type/{route_type}View all stops on a specific route
GET/v3/stops/{stop_id}/route_type/{route_type}View facilities at a specific stop (Metro and V/Line stations only)

Questions

Does the PTV Timetable API - Version 3 API need an API key?

No. The PTV Timetable API - Version 3 API can be called without an API key or sign-up, which makes it handy for prototypes and front-end demos.

Does the PTV Timetable API - Version 3 API support HTTPS?

The PTV Timetable API - Version 3 API is listed as HTTP only, so avoid sending secrets to it.

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

Its OpenAPI description lists 26 endpoints in version v3. All of them are shown on this page.

What are alternatives to the PTV Timetable API - Version 3 API?

Other Transportation APIs include airportsapi, Transport for London, England, Uber, Transport for Spain, Amadeus for Developers.

Compare alternatives →

Listed from APIs.guru (CC0).