← 每天一个高质量 API · 系列目录

每天一个高质量 API · Day 19:TfL 伦敦地铁状态(free-gov-tfl)

Day 19 · 2026-10-28 · 搜蚁智选 AIMALL
系列「每天一个高质量 API」第 19 篇。搜蚁智选(souyi.net.cn)是一个面向 AI Agent 的 API 发现与统一调用平台。今天聊 TfL 伦敦地铁状态(free-gov-tfl)。

11 条地铁线的实时运营状态:正常、延误还是停运,附一句人话原因。

这个 API 能做什么

/Line/Mode/tube/Status 返回伦敦交通局全部地铁线状态:每条线含 id、name、lineStatuses[],其中 statusSeverity 是数字严重度(10 = Good Service,9 / 5 = 各类延误,20 = Service Closed),statusSeverityDescription 是英文描述,reason 是具体原因。

为什么 AI Agent 需要它

怎么用

方式一:直连上游(免费、无需 Key)

curl "https://api.tfl.gov.uk/Line/Mode/tube/Status"

方式二:经搜蚁智选一键调用(带 Key,统一计费 / 限流 / 可观测)

curl -X POST https://souyi.net.cn/api/v1/ai/request \
  -H "X-API-Key: YOUR_AIMALL_KEY" \
  -H "Content-Type: application/json" \
  -d '{"asset_id":"free-gov-tfl","call_data":{}}'
这些免费 API 的上游本身免密;经搜蚁智选代理后,多个数据源可以聚合到同一个 Agent 工作流里,统一走 X-API-Key + 统一计费、限流与可观测,省去每个上游单独接一遍。

返回示例

{
  "lines": 11,
  "first_3": [
    {
      "id": "bakerloo",
      "name": "Bakerloo",
      "status": [
        { "severity": 20, "desc": "Service Closed",
          "reason": "Bakerloo Line: Service will resume later this morning." }
      ]
    },
    { "id": "central", "name": "Central", "status": [{ "severity": 20, "desc": "Service Closed" }] },
    { "id": "circle", "name": "Circle", "status": [{ "severity": 20, "desc": "Service Closed" }] }
  ]
}

价格

免费。TfL 无 Key 有速率限制,生产使用建议在控制台申请 app_key 走认证通道。

怎么拿到 Key

注册 souyi.net.cn → 控制台一键生成 X-API-Key → 即可调用平台全部 API(含本系列 22 个)。

小结

上面这份样本是清晨抓的,全线 20(Service Closed)——正好说明「没有数字阈值就别做自动化判断」。接上 statusSeverity,Agent 才不会把夜间停运误报成事故。

更多免费 API 见 系列目录。

在搜蚁智选上调用这个 API →