本網站上的每個數字,都可以用一次免費的 JSON 呼叫取得。開發者 API
Every figure here is versioned JSON. Free to use, with or without a key.Every figure here is versioned JSON. Free to use, with or without a key.
基本地址 https://otranspo.ca/api/public/v1
Free, key optional · 1,000 a day, 60 a minute · code MIT · version 1.0.0
- 存取方式
Free
key optional
- 速率限制
1,000 a day
60 a minute; more on Developer
- 程式碼授權
MIT 授權
資料沿用其來源的使用條款
- 版本
1.0.0
stable · 180 days’ notice
Plans
Free
1,000 calls a day, 60 a minute. No key needed; a free key counts your calls separately from everyone else on your network.
Credit ‘Data: OTranspo (otranspo.ca)’ wherever you show the data.
Developer
$10 a monthor $100 a year (CAD)
- 100,000 calls a day, 600 a minute
- Bulk downloads and full history
- Support by email
Journalists, students and council staff: the free tier is yours. Write to us if you need more for a story or a study.
How to send a key
curl -H "Authorization: Bearer otr_…" https://otranspo.ca/api/public/v1/route-states限制
Each answer carries X-RateLimit-Remaining (this minute) and X-RateLimit-Daily-Remaining (today, UTC). Over the limit you get 429 with the time it resets.
一次呼叫,從頭到尾
請求
curl https://otranspo.ca/api/public/v1/route-states這是本網站的真實回應,在您提出要求時才會擷取。
回應內容(已縮短) 結構
執行中…
所有資源,共 39 項
除非寫出完整路徑,否則路徑都從 /api/public/v1 開始。開啟任一列,可查看它的 HTTP 狀態、錯誤代碼、存取方式、不確定性和結構。
索引與規格從這裡開始2
API 索引GET /api /public /v1—JSON
HTTP 狀態碼
200
錯誤原因代碼
—
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
endpoints.id · endpoints.path
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
OpenAPI 3.1 介面合約文件GET /openapi.json—JSON
HTTP 狀態碼
200
錯誤原因代碼
—
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
operationId · path
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
目前服務此刻正在發生的狀況5
目前公布的取消班次GET /current-cancellations—JSON
HTTP 狀態碼
200 · 400 · 503
錯誤原因代碼
unsupported_query 400 · current_cancellations_unavailable 503
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
trips.tripId · trips.routeId
來源與不確定性
Only explicit CANCELED/DELETED notices for timetable trips in the current snapshot are listed. Empty or unavailable feeds do not prove that no trips were cancelled; outside-timetable notices may be withheld.
路線狀態:預定與實際所見GET /route-states—JSON
HTTP 狀態碼
200 · 503
錯誤原因代碼
—
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
operatorId · routeId
來源與不確定性
This is not an operator alert. Routes without published positions use positions_not_published; stale or missing feeds return unavailable.
事件通報(英文和法文)GET /incidents—JSON
HTTP 狀態碼
200 · 503
錯誤原因代碼
—
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
publicId · slug · updates.id
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
一則官方警示GET /alerts /{alertId}format=json|csv · alertIdJSON · CSV
HTTP 狀態碼
200 · 400 · 503
錯誤原因代碼
invalid_alert_id 400 · unsupported_format 400 · alert_not_found 400 · alert_unavailable 503
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
alert.id · alert.operatorId
來源與不確定性
The notice is the operator’s own wording. Kept wordings start when we first saw the notice, not when the operator posted it, and an empty list does not prove the notice never changed.
車站時刻板GET /stations /{stationId}format=json|csv · stationIdJSON
HTTP 狀態碼
200 · 400 · 404 · 503
錯誤原因代碼
invalid_station_id 400 · unsupported_format 400 · station_not_found 404 · station_board_unavailable 503
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
station.id · lines.routeRecordId · departures.tripId
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
數據證據和回報每個頁面背後的數據11
可靠度數據依據GET /reliability-evidenceformat=json|csvJSON · CSV
HTTP 狀態碼
200 · 400 · 503
錯誤原因代碼
unsupported_format 400
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
routeId · window
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
路線數據GET /routes /{routeId} /evidenceformat=json|csv · routeIdJSON
HTTP 狀態碼
200 · 400 · 404 · 503
錯誤原因代碼
invalid_route_id 400 · unsupported_format 400 · route_not_found 404 · route_evidence_unavailable 503
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
route.routeId
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
路線每日服務GET /routes /{routeId} /service-evidencewindow=day|week|month|28d · date · format=json|csv · routeIdJSON
HTTP 狀態碼
200 · 400 · 404 · 503
錯誤原因代碼
invalid_route_id 400 · unsupported_window 400 · invalid_service_date 400 · unsupported_format 400 · route_not_found 404 · route_service_evidence_unavailable 503
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
routeId · window
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
車站或選區的服務GET /places /{kind} /{placeId} /service-evidencedate · kind=station|ward · placeIdJSON
HTTP 狀態碼
200 · 400 · 503
錯誤原因代碼
unsupported_place_kind 400 · invalid_place_id 400 · unsupported_query 400 · invalid_service_date 400 · place_service_evidence_unavailable 503
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
kind · placeId · operatorId
來源與不確定性
Observation and cancellation completeness are explicitly unverified; no-position candidate counts remain null and comparison eligibility is false.
下載證據記錄GET /evidence /{evidenceId}format=json|csv · evidenceIdJSON · CSV
HTTP 狀態碼
200 · 400 · 404
錯誤原因代碼
unsupported_format 400 · not_found 404
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
evidenceId
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
選區評分表GET /ward-scorecardsformat=json|csvJSON · CSV
HTTP 狀態碼
200 · 503
錯誤原因代碼
—
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
snapshotId · wardId
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
過去的評分卡版本GET /historical-scorecardssnapshotId=historical-scorecards:<sha256> · routeIdJSON
HTTP 狀態碼
200 · 400 · 404 · 422
錯誤原因代碼
snapshot_id_required 400 · invalid_route_id 400 · invalid_parameters 400 · snapshot_not_found 404 · route_detail_not_published 422 · route_not_in_snapshot 404
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
snapshotId · routeId
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
服務報告存檔GET /service-report-archivekindJSON
HTTP 狀態碼
200 · 400 · 503
錯誤原因代碼
invalid_archive_query 400 · archive_unavailable 503
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
kind · period
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
預測準確度GET /prediction-calibration—JSON
HTTP 狀態碼
200 · 503
錯誤原因代碼
—
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
operatorId · routeId · routeContext · horizonBucket
來源與不確定性
Later observed arrival is a comparison, not ground truth or a validated prediction interval; independent validation is false.
所選的服務報告GET /api /insights /reports /selected?period={period}&date={YYYY-MM-DD}period=day|week|month · date=YYYY-MM-DD · operator=all|oc_transpo|sto · routeJSON
HTTP 狀態碼
200 · 400 · 503
錯誤原因代碼
invalid_selection 400 · selected_report_unavailable 503 · invalid_route_hour_selection 400 · route_hours_unavailable 503
存取與使用次數限制
匿名;此路徑未設定 public-api 限制。
固定識別碼
period · date · operator · method
來源與不確定性
Without route, the selected-report contract is unchanged. With route, the selected-route-hours contract returns at most48 method-separated local-hour prediction groups, preserving requested report operator separately from routeOperator. These mutable retained predictions do not prove physical arrivals, complete archive coverage, zero service or an immutable publication.
預測比較的輸入資料GET /api /insights /reports /selected /comparison-evidence?period={period}&date={YYYY-MM-DD}period=day|week|month · date=YYYY-MM-DD · operator=all|oc_transpo|stoJSON
HTTP 狀態碼
200 · 400 · 503
錯誤原因代碼
invalid_comparison_evidence_selection 400
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
payload.edition · payload.selection · checksum.value
來源與不確定性
This opt-in export preserves the exact captured route/day read results, declared calendar, comparison refusals and measured source-code manifest. It is bounded to 20,000 input rows and 8 MiB and does not claim an atomic database snapshot, statistical independence, confidence intervals, physical service delivery, causation, equivalence or model eligibility. Schema validation alone does not verify checksum or replay; consumers must perform those checks separately.
範例呼叫
GET /api/insights/reports/selected/comparison-evidence?period={period}&date={YYYY-MM-DD}
歷史與重播已經發生的事6
過去的取消班次和缺漏GET /historical-cancellationswindow=day|week|28d|month · date · assessment=noneJSON
HTTP 狀態碼
200 · 400 · 503
錯誤原因代碼
unsupported_query 400 · unsupported_window 400 · invalid_service_date 400 · unsupported_assessment 400 · historical_cancellations_unavailable 503 · historical_cancellation_limit_exceeded 400
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
period · records.tripId
來源與不確定性
Historical polling completeness is unverified and schedule matching may be unassessed; unknown coverage is not zero cancellations.
城市回放GET /replaydate · routeFamily · operator · fromMinute · minutes · summaryJSON
HTTP 狀態碼
200 · 400 · 503
錯誤原因代碼
date_required 400 · invalid_route_family 400 · invalid_operator 400 · replay_positions_unavailable 503 · published_replay_unavailable 503
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
date · routeFamily · operator
來源與不確定性
Replay is historical and never live; only captured/published archive evidence is returned.
看到的車輛,按日GET /fleet-historydate · operator=all|oc_transpo|sto · route · feedIdJSON
HTTP 狀態碼
200 · 400 · 503
錯誤原因代碼
invalid_fleet_history_lookup 400 · invalid_fleet_history_date 400 · invalid_fleet_history_operator 400 · fleet_history_unavailable 503
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
serviceDate · operator · route
來源與不確定性
Retained feed observations are not a physical fleet inventory; missing retention is not zero service.
資料來源中的車輛編號,按日GET /fleet-history /feed-idsdate · operator=all|oc_transpo|sto · cursorJSON
HTTP 狀態碼
200 · 400 · 503
錯誤原因代碼
invalid_fleet_feed_id_selection 400 · invalid_fleet_history_date 400 · invalid_fleet_history_operator 400 · invalid_fleet_feed_id_cursor 400 · fleet_feed_id_census_unavailable 503
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
date · operator · digest · collisionOrdinal
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
同一車輛 ID 的歷史紀錄GET /vehicles /{vehicleId} /visibility-historyformat=json|csv · vehicleIdJSON
HTTP 狀態碼
200 · 400 · 404 · 503
錯誤原因代碼
invalid_vehicle_id 400 · unsupported_format 400 · vehicle_history_unavailable 503 · vehicle_history_not_found 404
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
vehicleId
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
Vehicles seen, in bulkGET /bulk /fleet-historyfrom · to · operator=all|oc_transpo|sto · route · feedIdJSON
HTTP 狀態碼
200 · 400 · 401 · 403 · 429 · 503
錯誤原因代碼
unsupported_query 400 · invalid_bulk_range 400 · invalid_fleet_history_lookup 400 · invalid_fleet_history_operator 400 · fleet_history_unavailable 503 · api_key_required 401 · invalid_api_key 401 · plan_required 403 · rate_limited 429
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
serviceDate · operator · route
來源與不確定性
Each line is the fleet-history evidence for one seven-day window; retained feed observations are not a physical fleet inventory and missing retention is not zero service.
時刻表與離線使用已發布的時刻表6
單一路線的時刻表GET /transit-planning /{routeId}date · routeIdJSON
HTTP 狀態碼
200 · 400 · 503
錯誤原因代碼
invalid_route_or_date 400 · use_history_for_past_dates 400 · planning_baseline_unavailable 503
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
routeId · serviceDate
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
整體路網的時刻表GET /transit-planning /networkdateJSON
HTTP 狀態碼
200 · 400 · 503
錯誤原因代碼
invalid_parameters 400 · invalid_service_date 400 · network_baseline_unavailable 503
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
serviceDate
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
兩點之間的街道路徑POST /transit-planning /street-pathbodyJSON
HTTP 狀態碼
200 · 400 · 503
錯誤原因代碼
invalid_body 400 · invalid_segment 400
存取與使用次數限制
匿名,須為受信任的來源;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
from · to
來源與不確定性
Path may be unavailable when routing source data is absent; no path is not evidence of no accessible route.
離線時刻表套件GET /offline-pack—JSON
HTTP 狀態碼
200 · 503
錯誤原因代碼
offline_pack_not_published 503 · offline_pack_unavailable 503
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
packId · digest
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
離線資料包清單GET /offline-pack /manifestpackJSON
HTTP 狀態碼
200 · 404 · 503
錯誤原因代碼
—
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
packId · shards.id
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
離線資料包的一部分GET /offline-pack /shards /{id}idbytes
HTTP 狀態碼
200 · 404 · 503
錯誤原因代碼
—
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
id · digest
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
登記冊與政策我們改了什麼,以及原因6
更正登記表GET /correctionsformat=json|csvJSON · CSV
HTTP 狀態碼
200 · 400
錯誤原因代碼
unsupported_format 400
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
records.id · records.revision
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
政策登記冊GET /policy-register—JSON
HTTP 狀態碼
200
錯誤原因代碼
—
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
records.id · records.revision
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
無障礙保證GET /accessibility-assurance—JSON
HTTP 狀態碼
200
錯誤原因代碼
—
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
evidence.id · remediationLog.id
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
區域涵蓋範圍與資料時效GET /regional-coverage—JSON
HTTP 狀態碼
200 · 503
錯誤原因代碼
—
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
operators.operatorId
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
通知與求助管道GET /journey-service-policy—JSON
HTTP 狀態碼
200
錯誤原因代碼
—
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
contractVersion · channels.channel
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
車輛外觀檢查GET /fleet-presentation—JSON
HTTP 狀態碼
200 · 503
錯誤原因代碼
—
存取與使用次數限制
匿名存取;啟用分散式速率限制時,每分鐘 60 次。
固定識別碼
evidence.operatorSamples.operatorId
來源與不確定性
Read the response status, evidenceState, source timestamps, limitations and gaps; absence is not proof of zero.
分享連結和社群卡片3
存取與使用
存取與使用Limits, caching, versions, privacy and licence
- 存取方式
- Every GET resource is public and free to use, with or without a key. Bulk and history resources need a Developer key. The two POST resources (making a share link, drawing a street path) only accept requests from otranspo.ca itself.
- 速率限制
- 1,000 calls a day and 60 a minute, with or without a free key; 100,000 a day and 600 a minute on the Developer plan. Read the X-RateLimit-* headers on every answer; X-RateLimit-Status says when limits are degraded.
- Keys
- Send a key as Authorization: Bearer otr_… or X-API-Key. Never in the address. A wrong, revoked or expired key gets 401, never a keyless answer.
- 快取
- The index is kept 30 seconds by your browser and 5 minutes at the edge. Live resources such as cancellations are sent no-store. Offline timetable pieces never change once published.
- 版本
- 每個回應都會標明其 schema 和 schemaVersion。重大變更會使用新的 /v2 路徑,並會提前 180 天,透過 Deprecation、Sunset 和 Link 標頭發出通知。
- 私隱
- 請不要傳送個人資料。傳送到街道路徑的座標只用於該次請求,絕不會被記錄或儲存。回應內容不會包含帳戶 ID、行程搜尋、電子郵件、網路位址或內部證據連結。
- 未知不等於零
- 即使資源存在,回應也可能無法取得。請查看 status、evidenceState、來源時間、涵蓋範圍和限制。路線狀態是把時刻表與實際看到的巴士作比較,並不是營運單位的警示。
- 授權
- 程式碼:MIT。OC Transpo 和 STO 的資料仍依各自的開放資料條款使用,並須註明出處。我們的數據:CC BY 4.0,請註明 otranspo.ca。
- 尚未完成
- No SDK is published, no second city is supported, and partner tenant-key access is not open. This page does not claim them.