Skip to content

Developer Documentation

Getting Started

To access the OC Transpo Live Next Bus Arrival Data Feed, you will need an API key. Register and receive an API key instantly using the API registration form.

Register as a developer to receive an API keyDeveloper sign-in

Once you have provided your name and contact information, we will send you an email with a link to activate your account. Follow the instructions to activate the account, sign in and generate a new Application ID by clicking on the applications section of the Dashboard.

For security purposes, you will be asked for your Application ID and API key with each request. Please ensure you are making your requests using HTTPS.

Methods

  1. GetRouteSummaryForStop: Retrieves the routes for a given stop number.
  2. GetNextTripsForStop: Retrieves next three trips on the route for a given stop number.
  3. GetNextTripsForStopAllRoutes: Retrieves next three trips for all routes for a given stop number.
  4. GTFS: Retrieves specific records from all sections of the GTFS file.

Error Codes

Error Code Error Methods
1

Invalid API key

All
2

Unable to query data source

10

Invalid stop number

GetRouteSummaryForStop

GetNextTripsForStop

GetNextTripsForStopAllRoutes

11

Invalid route number

12

Stop does not service route at this time

GetNextTripsForStop

GetNextTripsForStopAllRoutes

13 No routes available at stop at any time

Vehicle Types

All OC Transpo buses and the O-Train are fully accessible.

Code Description
4 or 40 40-foot buses
6 or 60 60-foot buses
4 and 6 trips can be done by 60 or 40-foot buses
DD Double-Decker buses
B Bike Rack
DEH Diesel Electric Hybrid
IN INVIRO (bus type)
ON ORION (bus type)

Method Descriptions

1) GetRouteSummaryForStop

Retrieves the routes for a given stop number.

Base URL

https://api.octranspo1.com/v2.0/GetRouteSummaryForStop

Request

https://api.octranspo1.com/v2.0/GetRouteSummaryForStop?appID={appID}&apiKey={apiKey}&stopNo={stopNo}&format={format}

Parameters
Parameter Required Description
appID Yes Generated in the developer portal after registration.
apiKey Yes Generated in the developer portal after registration.
stopNo Yes 4-digit stop number found on bus stops. A full list of stops can be found here.
format No Format of the returned data. JSON or XML. Default: JSON.

Response

Field Descriptions
Field Name Value Type Description
StopNo string 4-digit bus stop number.
StopDescription string Stop description.
Error string Error codes. Refer to the Error Codes section for details.
Route - RouteNo string Alpha-numeric route number.
Route - DirectionID integer Route direction identifier.
Route - Direction string Route direction description.
Route - RouteHeading string Route heading.
Response Format
XML
Loading...

JSON
{
    GetRouteSummaryForStopResult: {
        StopNo: "string",
        Error: "string",
        StopDescription: "string",
        Routes: {
            Route: [
                {
                    RouteNo: "string",
                    RouteHeading: "string",
                    Direction: "string",
                    DirectionID: integer
                },
                {
                    RouteNo: "string",
                    RouteHeading: "string",
                    Direction: "string",
                    DirectionID: integer
                }
            ]
        }
    }
}

Response Example
XML
Loading...

JSON
{
    GetRouteSummaryForStopResult: {
        StopNo: "3009",
        Error: "",
        StopDescription: "RIDEAU",
        Routes: {
            Route: [
                {
                    RouteNo: "1",
                    RouteHeading: "Blair",
                    Direction: "",
                    DirectionID: 0
                },
                {
                    RouteNo: "1",
                    RouteHeading: "Tunney's Pasture",
                    Direction: "",
                    DirectionID: 1
                },
                {
                    RouteNo: "9",
                    RouteHeading: "Hurdman",
                    Direction: "",
                    DirectionID: 1
                }
            ]
        }
    }
}

2) GetNextTripsForStop

Retrieves next three trips on the route for a given stop number.

Base URL

https://api.octranspo1.com/v2.0/GetNextTripsForStop

Request

https://api.octranspo1.com/v2.0/GetNextTripsForStop?appID={appID}&apiKey={apiKey}&stopNo={stopNo}&routeNo={routeNo}&format={format}

Parameters
Parameter Required Description
appID Yes Generated in the developer portal after registration.
apiKey Yes Generated in the developer portal after registration.
stopNo Yes 4-digit stop number found on bus stops. A full list of stops can be found here.
routeNo Yes Bus route number.
format No Format of the returned data. JSON or XML. Default: JSON.

Response

Field Descriptions
Field Name Value Type Description
StopNo string 4-digit bus stop number.
StopLabel string Stop description.
Error string Error codes. Refer to the Error Codes section for details.
RouteDirection - RouteNo string Alpha-numeric route number.
RouteDirection - RouteLabel string Route heading.
RouteDirection - Direction string Route direction description.
RouteDirection - Error string Error codes. Refer to the Error Codes section for details.
RouteDirection - RequestProcessingTime string API request time.
Trip - Longitude string Longitude.
Trip - Latitude string Latitude.
Trip - GPSSpeed string This value has been removed from the API and will return a blank string.
Trip - TripDestination string Trip heading.
Trip - TripStartTime string Trip scheduled start time.
Trip - AdjustedScheduleTime string Time until trip is estimated to arrive at stop.
Trip - AdjustmentAge string The time since the scheduled was adjusted in whole and fractional minutes. The higher the number the less reliable the AdjustedScheduleTime is. If this value is negative, it indicates that the AdjustedScheduleTime contains the planned scheduled time.
Trip - LastTripOfSchedule boolean Last trip of the day.
Trip - BusType string Vehicle type. Refer to the Bus Type section for details.
Response Format
XML
Loading...

JSON
{
    GetNextTripsForStopResult: {
        StopNo: "string",
        StopLabel: "string",
        Error: "string",
        Route: {
            RouteDirection: [
                {
                    RouteNo: "string",
                    RouteLabel: "string",
                    Direction: "string",
                    Error: "string",
                    RequestProcessingTime: "string",
                    Trips: {
                        Trip: [
                            {
                                Longitude: "string",
                                Latitude: "string",
                                GPSSpeed: "blank string",
                                TripDestination: "string",
                                TripStartTime: "string",
                                AdjustedScheduleTime: "string",
                                AdjustmentAge: "string",
                                LastTripOfSchedule: boolean,
                                BusType: "string"
                            },
                            {
                                Longitude: "string",
                                Latitude: "string",
                                GPSSpeed: "blank string",
                                TripDestination: "string",
                                TripStartTime: "string",
                                AdjustedScheduleTime: "string",
                                AdjustmentAge: "string",
                                LastTripOfSchedule: boolean,
                                BusType: "string"
                            },
                            {
                                Longitude: "string",
                                Latitude: "string",
                                GPSSpeed: "blank string",
                                TripDestination: "string",
                                TripStartTime: "string",
                                AdjustedScheduleTime: "string",
                                AdjustmentAge: "string",
                                LastTripOfSchedule: boolean,
                                BusType: "string"
                            }
                        ]
                    }
                },
                {
                    RouteNo: "string",
                    RouteLabel: "string",
                    ...
                }
            ]
        }
    }
}

Response Example
XML
Loading...

JSON
{
    GetNextTripsForStopResult: {
        StopNo: "3034",
        StopLabel: "BILLINGS BRIDGE",
        Error: "",
        Route: {
            RouteDirection: [
                {
                    RouteNo: "97",
                    RouteLabel: "Airport",
                    Direction: "",
                    Error: "",
                    RequestProcessingTime: "20201104112747",
                    Trips: {
                        Trip: [
                            {
                                Longitude: "-75.66520690917969",
                                Latitude: "45.412139892578125",
                                GPSSpeed: "",
                                TripDestination: "Airport",
                                TripStartTime: "11:36",
                                AdjustedScheduleTime: "13",
                                AdjustmentAge: "1",
                                LastTripOfSchedule: false,
                                BusType: ""
                            },
                            {
                                Longitude: "-75.73878479003906",
                                Latitude: "45.40216827392578",
                                GPSSpeed: "",
                                TripDestination: "Airport",
                                TripStartTime: "11:51",
                                AdjustedScheduleTime: "28",
                                AdjustmentAge: "1",
                                LastTripOfSchedule: false,
                                BusType: ""
                            },
                            {
                                Longitude: "",
                                Latitude: "",
                                GPSSpeed: "",
                                TripDestination: "Airport",
                                TripStartTime: "12:06",
                                AdjustedScheduleTime: "43",
                                AdjustmentAge: "-1",
                                LastTripOfSchedule: false,
                                BusType: ""
                            }
                        ]
                    }
                },
                {
                    RouteNo: "97",
                    RouteLabel: "Hurdman & N Rideau",
                    ...
                }
            ]
        }
    }
}

3) GetNextTripsForStopAllRoutes

Retrieves next three trips for all routes for a given stop number.

Base URL

https://api.octranspo1.com/v2.0/GetNextTripsForStopAllRoutes

Request

https://api.octranspo1.com/v2.0/GetNextTripsForStopAllRoutes?appID={appID}&apiKey={apiKey}&stopNo={stopNo}&format={format}

Parameters
Parameter Required Description
appID Yes Generated in the developer portal after registration.
apiKey Yes Generated in the developer portal after registration.
stopNo Yes 4-digit stop number found on bus stops. A full list of stops can be found here.
format No Format of the returned data. JSON or XML. Default: JSON.

Response

Field Descriptions
Field Name Value Type Description
StopNo string 4-digit bus stop number.
StopDescription string Stop description.
Error string Error codes. Refer to the Error Codes section for details.
Route - RouteNo string Alpha-numeric route number.
Route - RouteHeading string Route heading.
Route - DirectionID integer Route direction identifier.
Route - Direction string Route direction description.
Trip - Longitude string Longitude.
Trip - Latitude string Latitude.
Trip - GPSSpeed string This value has been removed from the API and will return a blank string.
Trip - TripDestination string Trip heading.
Trip - TripStartTime string Trip scheduled start time.
Trip - AdjustedScheduleTime string Time until trip is estimated to arrive at stop.
Trip - AdjustmentAge string The time since the scheduled was adjusted in whole and fractional minutes. The higher the number the less reliable the AdjustedScheduleTime is. If this value is negative, it indicates that the AdjustedScheduleTime contains the planned scheduled time.
Trip - LastTripOfSchedule boolean Last trip of the day.
Trip - BusType string Vehicle type. Refer to the Bus Type section for details.
Response Format
XML
Loading...

JSON
{
    GetRouteSummaryForStopResult: {
        StopNo: "string",
        Error: "string",
        StopDescription: "string",
        Routes: {
            Route: [
                {
                    RouteNo: "string",
                    RouteHeading: "string",
                    DirectionID: integer,
                    Direction: "string",
                    Trips: [
                        {
                            Longitude: "string",
                            Latitude: "string",
                            GPSSpeed: "blank string",
                            TripDestination: "string",
                            TripStartTime: "string",
                            AdjustedScheduleTime: "string",
                            AdjustmentAge: "string",
                            LastTripOfSchedule: boolean,
                            BusType: "string"
                        },
                        {
                            Longitude: "string",
                            Latitude: "string",
                            GPSSpeed: "blank string",
                            TripDestination: "string",
                            TripStartTime: "string",
                            AdjustedScheduleTime: "string",
                            AdjustmentAge: "string",
                            LastTripOfSchedule: boolean,
                            BusType: "string"
                        },
                        {
                            Longitude: "string",
                            Latitude: "string",
                            GPSSpeed: "blank string",
                            TripDestination: "string",
                            TripStartTime: "string",
                            AdjustedScheduleTime: "string",
                            AdjustmentAge: "string",
                            LastTripOfSchedule: boolean,
                            BusType: "string"
                        }
                    ]
                },
                {
                    RouteNo: "string",
                    RouteHeading: "string",
                    ...
                },
                {
                    RouteNo: "string",
                    RouteHeading: "string",
                    ...
                }
            ]
        }
    }
}

Response Example
XML
Loading...

JSON
{
    GetRouteSummaryForStopResult: {
        StopNo: "7633",
        Error: "",
        StopDescription: "HAWTHORNE / COLONEL BY",
        Routes: {
            Route: [
                {
                    RouteNo: "5",
                    RouteHeading: "Rideau",
                    DirectionID: 1,
                    Direction: "",
                    Trips: [
                        {
                            Longitude: "-75.67637802124024",
                            Latitude: "45.406397399902346",
                            GPSSpeed: "",
                            TripDestination: "Rideau",
                            TripStartTime: "11:01",
                            AdjustedScheduleTime: "1",
                            AdjustmentAge: "0",
                            LastTripOfSchedule: false,
                            BusType: ""
                        },
                        {
                            Longitude: "-75.67637802124024",
                            Latitude: "45.406397399902346",
                            GPSSpeed: "",
                            TripDestination: "Rideau",
                            TripStartTime: "12:01",
                            AdjustedScheduleTime: "53",
                            AdjustmentAge: "1",
                            LastTripOfSchedule: false,
                            BusType: ""
                        },
                        {
                            Longitude: "",
                            Latitude: "",
                            GPSSpeed: "",
                            TripDestination: "Rideau",
                            TripStartTime: "12:31",
                            AdjustedScheduleTime: "83",
                            AdjustmentAge: "-1",
                            LastTripOfSchedule: false,
                            BusType: ""
                        }
                    ]
                },
                {
                    RouteNo: "55",
                    RouteHeading: "Bayshore",
                    ...
                },
                {
                    RouteNo: "56",
                    RouteHeading: "Tunney's Pasture",
                    ...
                }
            ]
        }
    }
}

4) GTFS

Retrieves specific records from all sections of the GTFS file.

Base URL

https://api.octranspo1.com/v2.0/Gtfs

Request

https://api.octranspo1.com/v2.0/Gtfs?appID={appID}&apiKey={apiKey}&table={table}&id={id}&column={column}&value={value}&order_by={order_by}&direction={direction}&limit={limit}&format={format}

Parameters
Parameter Required Description
appID Yes Generated in the developer portal after registration.
apiKey Yes Generated in the developer portal after registration.
table Yes The table to query (Tables Listed Below).
id No A specific row in a table by the id value.
column No A specific column in a table. The use of column requires the use of the value parameter (Columns listed below).
value No* A specific value in a column. *Required if column is specified.
order_by No Specify a column to sort by.
direction No Specify the direction of sorted records. asc or desc. Default asc.
limit No

Specify a maximum limit of returned records.

format.

format No Format of the returned data. JSON or XML. Default: JSON.
GTFS Query: Tables and Columns
Table Columns JSON
agency
  • id
  • agency_name
  • agency_url
  • agency_timezone
  • agency_lang
{
    "Query": {
        "table": "agency",
        "direction": "ASC",
        "column": "id",
        "value": "1",
        "format": "json"
    },
    "Gtfs": [
        {
            "id": "1",
            "agency_name": "OC Transpo-a",
            "agency_url": "http:\/\/www.octranspo.com",
            "agency_timezone": "America\/Montreal",
            "agency_lang": "en"
        }
    ]
}
calendar
  • id
  • service_id
  • monday
  • tuesday
  • wednesday
  • thursday
  • friday
  • saturday
  • sunday
  • start_date
  • end_date
{
    "Query": {
        "table": "calendar",
        "direction": "ASC",
        "column": "id",
        "value": "1",
        "format": "json"
    },
    "Gtfs": [
        {
            "id": "1",
            "service_id": "JUN26-JUNDA13-Weekday-01",
            "monday": "1",
            "tuesday": "1",
            "wednesday": "1",
            "thursday": "1",
            "friday": "1",
            "saturday": "0",
            "sunday": "0",
            "start_date": "20130626",
            "end_date": "20130627"
        }
    ]
}
calendar_dates
  • id
  • service_id
  • date
  • exception_type
{
    "Query": {
        "table": "calendar_dates",
        "direction": "ASC",
        "column": "id",
        "value": "1",
        "format": "json"
    },
    "Gtfs": [
        {
            "id": "1",
            "service_id": "JUN13-JUNDA13-Weekday-99",
            "date": "20130701",
            "exception_type": "2"
        }
    ]
}
routes
  • id
  • route_id
  • route_short_name
  • route_long_name
  • route_desc
  • route_type
{
    "Query": {
        "table": "routes",
        "direction": "ASC",
        "column": "id",
        "value": "1",
        "format": "json"
    },
    "Gtfs": [
        {
            "id": "1",
            "route_id": "1-146",
            "route_short_name": "1",
            "route_long_name": "",
            "route_desc": "",
            "route_type": "3"
        }
    ]
}
stops
  • id
  • stop_id
  • stop_code
  • stop_name
  • stop_desc
  • stop_lat
  • stop_lon
  • stop_street
  • stop_city
  • stop_region
  • stop_postcode
  • stop_country
  • zone_id
{
    "Query": {
        "table": "stops",
        "direction": "ASC",
        "column": "stop_id",
        "value": "AA010",
        "format": "json"
    },
    "Gtfs": [
        {
            "id": "1",
            "stop_id": "AA010",
            "stop_code": "8767",
            "stop_name": "SUSSEX \/ CHUTE RIDEAU FALLS",
            "stop_desc": "",
            "stop_lat": "45.4399",
            "stop_lon": "-75.6958",
            "stop_street": "",
            "stop_city": "",
            "stop_region": "",
            "stop_postcode": "",
            "stop_country": "",
            "zone_id": ""
        }
    ]
}
NOTE: stops table requires stop_id, stop_code or id values specified.
stop_times
  • id
  • trip_id
  • arrival_time
  • departure_time
  • stop_id
  • stop_sequence
  • pickup_type
{
    "Query": {
        "table": "stop_times",
        "direction": "ASC",
        "column": "stop_id",
        "value": "AA010",
        "format": "json"
    },
    "Gtfs": [
        {
            "id": "133436",
            "trip_id": "27212870-CADA13-CADA13-Sunday-71",
            "arrival_time": "08:29:00",
            "departure_time": "08:29:00",
            "stop_id": "AA010",
            "stop_sequence": "20",
            "pickup_type": "0",
            "drop_off_type": "0"
        }
    ]
}
NOTE: stop_times table requires trip_id, stop_id or id values specified.
trips
  • id
  • route_id
  • service_id
  • trip_id
  • trip_headsign
  • block_id
{
    "Query": {
        "table": "trips",
        "direction": "ASC",
        "column": "route_id",
        "value": "135-147",
        "format": "json"
    },
    "Gtfs": [
        {
            "id": "1",
            "route_id": "135-147",
            "service_id": "CADA13-CADA13-Sunday-71",
            "trip_id": "27210104-CADA13-CADA13-Sunday-71",
            "trip_headsign": "Esprit",
            "block_id": "3406628"
        }
    ]
}
NOTE: trips table requires route_id or id values specified.

XML Format Description

Loading...