本网站的每个数字,都可以通过一次免费的 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
访问和频率限制
匿名;此路径未配置公共 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.
历史和回放已经发生的事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.
同一车辆编号随时间的变化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 路径,并通过 Deprecation、Sunset 和 Link 响应头提前180天通知。
- 隐私
- 请不要发送个人数据。发送到街道路径的坐标仅用于该次请求,绝不会被记录或保存。响应中不会包含账户编号、行程搜索、电子邮件或网络地址,也不会包含内部证据链接。
- 未知不等于零
- 即使资源存在,响应也可能不可用。请查看 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.