REST API 参考
KYRA MDR REST API 提供对告警、事件、收集器和其他平台资源的程序化访问。使用它将 KYRA MDR 与您现有的工具集成、自动化工作流或构建自定义仪表板。
基础 URL: https://api.seekerslab.com/api/v1
认证
所有 API 请求需要在 Authorization 头中包含 Bearer 令牌。
生成 API 密钥
- 打开 KYRA MDR 控制台
- 前往 设置 > API Keys
- 点击 Create API Key
- 为密钥命名(例如”SIEM Integration”)
- 选择权限范围(只读或读写)
- 复制密钥 — 它不会再次显示
使用 API 密钥
在每个请求中包含密钥:
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://api.seekerslab.com/api/v1/alerts认证错误
| 状态码 | 含义 |
|---|---|
401 Unauthorized | API 密钥缺失或无效 |
403 Forbidden | API 密钥缺少所需权限 |
429 Too Many Requests | 超出速率限制(见下文) |
速率限制
| 计划 | 速率限制 |
|---|---|
| FREE | 60 请求/分钟 |
| MDR | 300 请求/分钟 |
| PRO | 1,000 请求/分钟 |
| CUSTOM | 自定义 |
速率限制头包含在每个响应中:
X-RateLimit-Limit: 300X-RateLimit-Remaining: 297X-RateLimit-Reset: 1700000060通用参数
| 参数 | 类型 | 描述 |
|---|---|---|
page | integer | 页码(默认:1) |
size | integer | 每页项目数(默认:20,最大:100) |
sort | string | 排序字段(例如 created_at) |
order | string | 排序方向:asc 或 desc |
from | ISO 8601 | 时间范围开始 |
to | ISO 8601 | 时间范围结束 |
告警
列出告警
GET /alerts查询参数:
| 参数 | 类型 | 描述 |
|---|---|---|
severity | string | 按严重等级过滤:critical、high、medium、low、info |
status | string | 按状态过滤:open、in_progress、resolved、false_positive |
source_type | string | 按来源过滤:fortigate、windows、aws-cloudtrail 等 |
示例:
# 获取过去 24 小时所有开放的严重告警curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.seekerslab.com/api/v1/alerts?severity=critical&status=open&from=2026-03-21T00:00:00Z"响应:
{ "data": [ { "id": "alert-550e8400-e29b", "title": "Brute Force Authentication Attempt", "severity": "high", "status": "open", "source_type": "windows", "source_ip": "10.0.1.55", "mitre_tactic": "Credential Access", "mitre_technique": "T1110", "created_at": "2026-03-22T08:15:30Z", "event_count": 47, "ai_summary": "47 failed logon attempts (Event ID 4625) from 10.0.1.55 targeting 3 accounts in 2 minutes." } ], "pagination": { "page": 1, "size": 20, "total": 1, "total_pages": 1 }}获取告警详情
GET /alerts/{alert_id}更新告警状态
PATCH /alerts/{alert_id}curl -X PATCH \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"status": "resolved", "comment": "False positive - authorized penetration test"}' \ https://api.seekerslab.com/api/v1/alerts/alert-550e8400-e29b事件
列出事件
GET /incidents| 参数 | 类型 | 描述 |
|---|---|---|
severity | string | 按严重等级过滤 |
status | string | open、investigating、contained、resolved、closed |
assignee | string | 按分配的分析师过滤 |
获取事件详情
GET /incidents/{incident_id}返回完整事件,包含时间线、相关告警、受影响资产和响应操作。
添加事件评论
POST /incidents/{incident_id}/comments收集器
列出收集器
GET /collectors获取收集器详情
GET /collectors/{collector_id}返回详细信息,包括健康指标、配置的数据源和缓冲状态。
日志搜索
搜索事件
POST /searchcurl -X POST \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "source_type:windows AND event_id:4625", "from": "2026-03-21T00:00:00Z", "to": "2026-03-22T00:00:00Z", "size": 50 }' \ https://api.seekerslab.com/api/v1/search搜索查询语法
| 运算符 | 示例 | 描述 |
|---|---|---|
| 字段匹配 | source_type:windows | 精确字段匹配 |
| AND | severity:critical AND status:open | 两个条件都满足 |
| OR | src_ip:10.0.1.1 OR src_ip:10.0.1.2 | 任一条件 |
| NOT | NOT source_type:sysmon | 排除匹配 |
| 通配符 | user:admin* | 前缀匹配 |
| 范围 | event_count:[10 TO 100] | 数值范围 |
Webhook
创建 Webhook
POST /webhookscurl -X POST \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Slack Critical Alerts", "url": "https://hooks.slack.com/services/T00/B00/xxx", "events": ["alert.created"], "filters": { "severity": ["critical", "high"] } }' \ https://api.seekerslab.com/api/v1/webhooksWebhook 事件
| 事件 | 描述 |
|---|---|
alert.created | 检测到新告警 |
alert.updated | 告警状态变更 |
incident.created | 新事件创建 |
incident.updated | 事件状态变更 |
collector.disconnected | 收集器离线 |
错误响应
所有错误遵循一致的格式:
{ "error": { "code": "INVALID_PARAMETER", "message": "Invalid severity value. Allowed: critical, high, medium, low, info", "details": { "parameter": "severity", "value": "urgent" } }}| HTTP 状态码 | 错误码 | 描述 |
|---|---|---|
| 400 | INVALID_PARAMETER | 无效的请求参数 |
| 401 | UNAUTHORIZED | API 密钥缺失或无效 |
| 403 | FORBIDDEN | 权限不足 |
| 404 | NOT_FOUND | 资源未找到 |
| 429 | RATE_LIMITED | 请求过多 |
| 500 | INTERNAL_ERROR | 服务器错误 — 请联系支持 |
SDK 和库
REST API 可与任何 HTTP 客户端配合使用。以下是常见语言的示例:
# Python 示例import requests
API_KEY = "your-api-key"BASE_URL = "https://api.seekerslab.com/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}
# 获取开放的严重告警response = requests.get( f"{BASE_URL}/alerts", headers=headers, params={"severity": "critical", "status": "open"})
alerts = response.json()["data"]for alert in alerts: print(f"[{alert['severity']}] {alert['title']}")需要帮助?
- API 问题:api-kyra@seekerslab.com
- 速率限制提升:联系 kyra@seekerslab.com
- Bug 报告:报告问题时请包含
X-Request-Id响应头