> ## Documentation Index
> Fetch the complete documentation index at: https://www.worldmonitor.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 航运咽喉要道状态 API

> 使用 TypeScript 或 curl 通过 CC BY 4.0 每日开放数据集、免密钥沙盒样例、REST 端点 /api/supply-chain/v1/get-chokepoint-status 或 MCP 工具查询全球 13 条航运咽喉要道的实时中断评分、航行警告与流量状态。

使用 TypeScript、curl 或 MCP 查询全球 13 条主要航运咽喉要道（霍尔木兹海峡、苏伊士运河、曼德海峡、巴拿马运河、马六甲海峡、刻赤海峡、台湾海峡等）的实时或每日中断状态。

## 1. 免密钥 TypeScript 工具（CC BY 4.0 每日开放数据集）

通过每日更新的 CC BY 4.0 开放数据集，\*\*无需 API 密钥、无需账号、支持跨域（`CORS: *`）\*\*即可直接接入（详见 [数据集说明与 Schema](https://www.worldmonitor.app/data/v1/chokepoints/README.md)）：

```ts theme={null}
export interface ChokepointRow {
  id: string;
  name: string;
  status: 'green' | 'yellow' | 'red';
  disruption_score: number;
  war_risk_tier: string;
  congestion_level: string | null;
  active_warnings: number;
  ais_disruptions: number;
  transit_today_total: number | null;
  flow_ratio: number | null;
  flow_disrupted: boolean | null;
}

export async function getChokepointStatusOpenData(chokepointId?: string) {
  const res = await fetch('https://www.worldmonitor.app/data/v1/chokepoints/latest.json', {
    headers: { 'User-Agent': 'chokepoint-agent-tool/1.0 (+https://example.com)' },
    signal: AbortSignal.timeout(10_000),
  });
  if (!res.ok) throw new Error(`Chokepoint dataset HTTP ${res.status}`);
  const data = (await res.json()) as {
    snapshot_date: string;
    source_fetched_at: string;
    chokepoints: ChokepointRow[];
  };
  const rows = chokepointId
    ? data.chokepoints.filter((row) => row.id === chokepointId)
    : data.chokepoints;
  return {
    snapshotDate: data.snapshot_date,
    sourceFetchedAt: data.source_fetched_at,
    chokepoints: rows,
  };
}
```

除 `latest.json` 外，每个 UTC 日还会同步发布：

* 最新 JSON：`https://www.worldmonitor.app/data/v1/chokepoints/latest.json`
* 最新 CSV：`https://www.worldmonitor.app/data/v1/chokepoints/latest.csv`
* 日期索引：`https://www.worldmonitor.app/data/v1/chokepoints/index.json`
* JSON Schema：`https://www.worldmonitor.app/data/v1/chokepoints/schema.json`

## 2. 5 分钟实时 REST API 与沙盒响应

如需日内实时更新（融合每 10 分钟刷新的 AIS 航次、每小时更新的 NGA 航行警告与每 6 小时同步的 IMF PortWatch 历史序列），调用 `GET /api/supply-chain/v1/get-chokepoint-status`：

```ts theme={null}
export async function getLiveChokepointStatus(apiKey: string) {
  const url =
    'https://api.worldmonitor.app/api/supply-chain/v1/get-chokepoint-status' +
    '?jmespath=chokepoints%5B%5D.%7Bid%3Aid%2Cname%3Aname%2Cstatus%3Astatus%2Cscore%3AdisruptionScore%2Cwarnings%3AactiveWarnings%7D';
  const res = await fetch(url, {
    headers: {
      'X-WorldMonitor-Key': apiKey,
      'User-Agent': 'chokepoint-agent-tool/1.0 (+https://example.com)',
    },
    signal: AbortSignal.timeout(10_000),
  });
  if (!res.ok) throw new Error(`World Monitor API HTTP ${res.status}`);
  return res.json();
}
```

如需免密钥查看未裁剪的 REST 响应外层，可拉取确定性沙盒样例并解包 `.response.body`。注意该样例基于 OpenAPI 契约包裹 `{chokepoints, fetchedAt, upstreamUnavailable}` 的精简示例（示例行仅包含部分字段，不含 `id`、`name`、`status` 和 `disruptionScore`），不能直接作为上方 `getLiveChokepointStatus` 所返回 `jmespath` 裁剪数组的测试数据：

```bash theme={null}
curl -sS https://www.worldmonitor.app/sandbox/get-chokepoint-status.json | jq '.response.body'
```

## 3. Claude、ChatGPT、Codex 与 Cursor 的 MCP 工具

如果你的 Agent 支持 MCP，可直接连接 `https://worldmonitor.app/mcp` 并调用 `get_chokepoint_status`（免费 World Monitor 账号通过 OAuth 每天包含 5 次缓存数据调用；付费 API 或 Pro 方案提供更高配额）。详见 [MCP 快速开始](https://www.worldmonitor.app/docs/zh/mcp-quickstart.md) 与 [官方 SDK](https://www.worldmonitor.app/docs/zh/sdks.md)（`npm install worldmonitor`、`pip install worldmonitor-sdk`）。

## World Monitor 与直接使用 IMF PortWatch 的对比

* **直接使用 IMF PortWatch**：当你需要覆盖全部 28 条全球咽喉要道（以及 PortWatch 覆盖的数千个全球港口目录）并直接批量下载历史过境序列时（注意：PortWatch 每日统计通常有约 7–9 天的发布滞后）。
* **使用 World Monitor**：当你的 Agent 需要针对 13 条核心战略航道融合日内 AIS 过境计数（`aisstream.io`）、实时 NGA 航行警告、战争险等级与 0–100 综合中断评分时——可通过每日 CC BY 4.0 开放数据集免密钥获取，或通过 REST / MCP 获取日内实时结果。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.