Transport for Ottawa, Canada API

Transportation / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

The OC Transpo API provides real-time GPS bus tracking and schedule data for Ottawa's public transit system in Canada. You need to register for an API key on the OC Transpo developer page to access the data. The API returns XML or JSON and is useful for building apps that show live bus locations and next departures.

💡

Beginner Tip

Register for an API ID and key at octranspo.com/en/plan-your-trip/travel-tools/developers and use the GetNextTripsForStop method to get upcoming arrivals at any stop by its four-digit stop number. Stop numbers are printed on every bus stop sign in Ottawa.

Available Data

match scores and results
team standings
player statistics
schedule and fixtures
Use case: Integrate oc transpo api data into web and mobile applications

Example Response

JSON Response
{
  "route": "Line 1",
  "origin": "Station A",
  "destination": "Station B",
  "departure": "08:30",
  "arrival": "09:15",
  "status": "On Time",
  "delays_min": 0
}

Field Reference

StopNo The four-digit identifier of the queried bus stop, matching the number printed on the stop sign.
StopDescription Human-readable location description of the stop, such as RIDEAU / WALLER.
RouteNo The route number of the bus service returning trips for this stop.
TripDestination The final destination of the trip, shown as it appears on the bus headsign.
AdjustedScheduleTime Adjusted arrival time in minutes from now, combining schedule data with real-time GPS updates.
GPSSpeed Current speed of the bus in km/h as reported by the onboard GPS unit.

Implementation Example

const url = "https://www.octranspo.com/en/plan-your-trip/travel-tools/developers";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

"InvalidAppIDError" or "InvalidApiKeyError" in response The appID or apiKey parameters are incorrect or the account is not activated.
Double-check both the appID and apiKey from your OC Transpo developer account; both are required in every request.
Empty TripList in response The bus route does not serve the specified stop, or no trips are scheduled in the next few hours.
Verify the routeNo and stopNo combination using the OC Transpo route planner before calling the API.
XML returned instead of JSON The format=JSON parameter was omitted or misspelled.
Always append &format=JSON to your query string; without it the API defaults to XML output.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 5/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Transportation
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →