组件 API 参考
获取状态页的所有组件
端点:
GET /v2/:page_id/components?page=:page&per_page=:per_page
- page 默认为 1。
- per_page 默认为 50,每页最多 100 条。
响应示例:
[{"id": "ckf01fvnxywz60a35wdbn5gz5","name": "App","status": "OPERATIONAL","uniqueEmail": "nasa-app-1nozrueut@automation.instatus.com","description": "","showUptime": true,"order": 0,"group": null},{"id": "ckf01fvnxywz50a35nh1qzssm","name": "Website","status": "OPERATIONAL","description": "","showUptime": true,"order": 0,"group": null,"uniqueEmail": "nasa-website-1nozrueut@automation.instatus.com"}]
获取单个组件
端点:
GET /v2/:page_id/components/:component_id
响应示例
{"id": "ckf01fvnxywz50a35nh1qzssm","name": "Website","description": "","status": "OPERATIONAL","uniqueEmail": "nasa-website-1nozrueut@automation.instatus.com","showUptime": true,"order": 0,"group": null}
获取状态页的正常运行时间
端点:
GET /v2/:page_id/uptime?start=:start&end=:end
start和end为 ISO 8601 格式的日期。不传时默认为最近 30 天。- 时间范围最长 395 天,且
start必须早于end。
响应示例:
{"start": "2026-10-01T00:00:00.000Z","end": "2026-10-31T00:00:00.000Z","uptime": 99.97,"components": [{"id": "ckf01fvnxywz60a35wdbn5gz5","name": "App","uptime": 99.95,"isParent": false,"children": []},{"id": "ckf01fvnxywz40a35p2c1xk7q","name": "API","uptime": 99.98,"isParent": true,"children": [{"id": "ckf01fvnxywz50a35nh1qzssm","name": "Auth","uptime": 99.96,"isParent": false,"children": []},{"id": "ckf01fvnxywz70a35r8m2wq4d","name": "Search","uptime": 100,"isParent": false,"children": []}]}]}
- 顶层的
uptime代表整个页面:即所有组件的平均值,计算方式与分组的正常运行时间相同。 - 分组的
isParent为true,其组件列在children中。 - 只计入已发布的故障,因此数据与你的状态页一致。
创建组件
端点:
POST /v1/:page_id/components
请求示例:
{"name": "Test component","description": "Testing","status": "OPERATIONAL","order": 6,"showUptime": true,"grouped": false,"archived": false,"translations": {"name": {"fr": "Composant de test"},"description": {"fr": "En test"}}}
响应示例:
{"id": "ckf1d4f6a4aaf0a356vqg0rdm","name": "Test component","description": "Testing","uniqueEmail": "nasa-test-component-oomaksikj@automation.instatus.com","status": "OPERATIONAL","showUptime": true,"order": 8,"group": null,"translations": {"name": {"fr": "Composant de test"},"description": {"fr": "En test"}}}
如果你想把组件添加到某个分组下,可以把 grouped 设为 true,并把 group 设为目标分组的 ID。
更新组件
端点:
PUT /v2/:page_id/components/:component_id
请求示例:
{"name": "Test component 4","description": "Test test test","status": "OPERATIONAL","order": 6,"showUptime": true,"grouped": false,"archived": true,"translations": {"name": {"fr": "Composant de test 4"},"description": {"fr": "Test test test"}}}
响应示例:
{"id": "ckf1d4f6a4aaf0a356vqg0rdm","name": "Test component 4","uniqueEmail": "nasa-test-component-oomaksikj@automation.instatus.com","status": "OPERATIONAL","description": "Test test test","showUptime": true,"order": 6,"group": null,"translations": {"name": {"fr": "Composant de test 4"},"description": {"fr": "Test test test"}}}
如果你想修改组件所属的分组,可以把 grouped 设为 true,并把 groupId 设为目标分组的 ID。
删除组件
端点:
DELETE /v1/:page_id/components/:component_id
{"id": "ckf1d4f6a4aaf0a356vqg0rdm"}