本页覆盖以下源码中暴露的全部 HTTP 路由:
crates/dockrev-api/src/api/mod.rscrates/dockrev-supervisor/src/app.rs401 auth_required。DOCKREV_AUTH_ALLOWED_USER 与 DOCKREV_AUTH_ALLOWED_GROUP;两者各只接受一个值,同时配置时命中任意一个即可通过。X-Dockrev-Webhook-Secret 必须与服务端配置一致。X-Hub-Signature-256 + X-GitHub-Event + X-GitHub-Delivery。/api/*)| 方法 | 路径 | 鉴权 | 用途 | 关键状态码 |
|---|---|---|---|---|
| GET | /api/health |
公开 | 健康探针 | 200 |
| GET | /api/version |
公开 | 返回 APP 有效版本 | 200 |
| 方法 | 路径 | 鉴权 | 用途 | 关键状态码 |
|---|---|---|---|---|
| GET | /api/stacks |
Forward Auth | 查询 stack 列表(含 archived 过滤) | 200 401 400 |
| POST | /api/stacks |
Forward Auth | 手动注册已禁用(保持接口占位) | 400/405 401 |
| GET | /api/stacks/{stack_id} |
Forward Auth | 查询 stack 详情 | 200 404 401 |
| POST | /api/stacks/{stack_id}/archive |
Forward Auth | 归档 stack | 200 404 401 |
| POST | /api/stacks/{stack_id}/restore |
Forward Auth | 取消归档 stack | 200 404 401 |
| GET | /api/stacks/{stack_id}/lifecycle-status |
Forward Auth | 查询 Stack Compose 生命周期聚合状态与活动服务操作任务 | 200 404 401 |
| POST | /api/stacks/{stack_id}/lifecycle |
Forward Auth | 创建 Stack 启动、停止或重启任务 | 200 400 404 401 409 |
| POST | /api/services/{service_id}/archive |
Forward Auth | 归档 service | 200 404 401 |
| POST | /api/services/{service_id}/restore |
Forward Auth | 取消归档 service | 200 404 401 |
| GET | /api/services/{service_id}/lifecycle-status |
Forward Auth | 查询服务 Compose 生命周期状态与活动服务操作任务 | 200 404 401 |
| POST | /api/services/{service_id}/lifecycle |
Forward Auth | 创建服务启动、停止或重启任务 | 200 400 404 401 409 |
| GET | /api/services/{service_id}/digest-tags |
Forward Auth | 查询 digest tags 调试视图(已改为 snapshot-backed;缺失或刷新中时返回 202 pending) |
200 202 404 401 |
| GET | /api/services/{service_id}/digest-tags-snapshot |
Forward Auth | 查询 digest tags 快照(目标 digest 正在刷新时返回 202 pending) |
200 202 404 401 |
| POST | /api/services/{service_id}/version-inference/refresh |
Forward Auth | 触发指定 digest 的局部版本推断刷新(请求体必须带 digest) |
202 400 404 401 |
| GET | /api/version-inference/overview |
Forward Auth | 版本推断总览 | 200 401 |
| GET | /api/version-inference/events |
Forward Auth | 版本推断事件流(SSE) | 200 401 |
| 方法 | 路径 | 鉴权 | 用途 | 关键状态码 |
|---|---|---|---|---|
| POST | /api/discovery/scan |
Forward Auth | 触发 discovery 扫描任务 | 200 401 |
| GET | /api/discovery/projects |
Forward Auth | discovery 项目列表 | 200 401 |
| POST | /api/discovery/projects/{project}/archive |
Forward Auth | 归档 discovery project | 200 404 401 |
| POST | /api/discovery/projects/{project}/restore |
Forward Auth | 恢复 discovery project | 200 404 401 |
| POST | /api/checks |
Forward Auth | 创建 check 任务 | 200 400 401 409 |
| POST | /api/runtime-scans |
Forward Auth | 创建 runtime 扫描任务 | 200 400 401 409 |
| POST | /api/updates |
Forward Auth | 创建 update 任务 | 200 400 401 409 |
GET /api/discovery/projects 的 status 可为 active、stopped、missing 或 invalid。stopped 表示保存的 Compose 文件仍可读且可解析,但当前没有运行容器;关联 Stack 保持未归档,可使用既有生命周期接口启动。扫描 job 的 summary 包含 stacksStopped,动作可为 marked_stopped。仅所有保存文件均为 ENOENT 时才会以 auto_archive_compose_files_missing 自动归档;混合缺失、权限/I-O 或解析异常保持 invalid。人工归档不会被扫描解除。
POST /api/updates 契约:
scope=service:必须显式携带 serviceId + targetTag + targetDigest + pullTags。scope=stack|all:必须显式携带 targets[],元素为 { serviceId, targetTag, targetDigest, pullTags }。mode=dry-run 做预检查。服务生命周期契约:
GET /api/stacks/{stack_id}/lifecycle-status 聚合 Stack 内服务状态,并返回覆盖任一服务的 queued/running update、rollback、service lifecycle 或 stack lifecycle 任务。POST /api/stacks/{stack_id}/lifecycle 请求体同样为 { "action": "start" | "stop" | "restart" }。Compose V2 启动执行项目级 up -d --pull never --no-recreate,Compose V1 执行项目级 start;停止和重启执行项目级对应命令。GET /api/services/{service_id}/lifecycle-status 返回 state=running|stopped|partial|unknown,并在存在同服务更新、回滚或生命周期任务时返回 activeJob。POST /api/services/{service_id}/lifecycle 请求体为 { "action": "start" | "stop" | "restart" }。Compose V2 启动执行 up -d --pull never --no-recreate --no-deps,Compose V1 执行 start(仅启动已有容器);两者都不会拉取镜像、替换已有容器或启动依赖服务。Compose V1 不存在容器时返回不可用。停止和重启分别执行对应 Compose 命令。409 和 existingJobId。Dockrev 自身服务以及包含 Dockrev 的 Stack 不支持普通生命周期接口。| 方法 | 路径 | 鉴权 | 用途 | 关键状态码 |
|---|---|---|---|---|
| GET | /api/jobs |
Forward Auth | 作业列表 | 200 401 |
| GET | /api/jobs/events |
Forward Auth | 作业事件流(SSE) | 200 401 |
| GET | /api/jobs/{job_id} |
Forward Auth | 单作业详情 | 200 404 401 |
| GET | /api/jobs/{job_id}/events |
Forward Auth | 单作业事件流(SSE) | 200 404 401 |
| 方法 | 路径 | 鉴权 | 用途 | 关键状态码 |
|---|---|---|---|---|
| GET | /api/ignores |
Forward Auth | 忽略规则列表 | 200 401 |
| POST | /api/ignores |
Forward Auth | 新建忽略规则 | 200 400 401 |
| DELETE | /api/ignores |
Forward Auth | 删除忽略规则 | 200 400 401 |
| GET | /api/services/{service_id}/settings |
Forward Auth | 服务级设置查询 | 200 404 401 |
| PUT | /api/services/{service_id}/settings |
Forward Auth | 服务级设置更新 | 200 400 404 401 |
| GET | /api/notifications |
Forward Auth | 通知配置读取(botToken 不回传,botTokenConfigured + chatId 明文) |
200 401 |
| PUT | /api/notifications |
Forward Auth | 通知配置更新 | 200 400 401 |
| POST | /api/notifications/test |
Forward Auth | 发送测试通知 | 200 400 401 |
| GET | /api/settings |
Forward Auth | 系统设置读取 | 200 401 |
| PUT | /api/settings |
Forward Auth | 系统设置更新 | 200 400 401 |
POST /api/notifications/test 从 2026-03-05 起将测试通知下游 payload 切换为 v2(breaking):
type/ts/message。schema/kind/sentAt/channel/human/debug。title/body,用于 Service Worker 直接展示通知。| 方法 | 路径 | 鉴权 | 用途 | 关键状态码 |
|---|---|---|---|---|
| GET | /api/github-packages/settings |
Forward Auth | 读取 GHCR webhook 配置(PAT 掩码) | 200 401 |
| PUT | /api/github-packages/settings |
Forward Auth | 更新 GHCR webhook 配置 | 200 400 401 |
| GET | /api/github-packages/repos |
Forward Auth | 仓库分页列表与筛选 | 200 401 |
| POST | /api/github-packages/repos/selected |
Forward Auth | 设置单仓库 selected | 200 400 401 |
| POST | /api/github-packages/repos/delete |
Forward Auth | 删除单仓库跟踪 | 200 400 401 |
| POST | /api/github-packages/repos/bulk-selected |
Forward Auth | 批量设置 selected | 200 400 401 |
| POST | /api/github-packages/targets/add |
Forward Auth | 添加 target(repo/owner 输入) | 200 400 401 |
| POST | /api/github-packages/targets/remove |
Forward Auth | 删除 target | 200 400 401 |
| POST | /api/github-packages/resolve |
Forward Auth | 解析 repo/owner 输入并返回仓库候选 | 200 400 401 422 |
| GET | /api/github-packages/webhook/overview |
Forward Auth | GHCR webhook 状态聚合(repo + job) | 200 401 |
| GET | /api/github-packages/webhook/deliveries/events |
Forward Auth | GHCR webhook 收件箱事件流(SSE) | 200 401 |
| POST | /api/github-packages/webhook/sync-all |
Forward Auth | 触发全量 webhook 状态同步(复用未完成任务) | 200 400 401 |
| POST | /api/github-packages/webhook/sync-repo |
Forward Auth | 触发单仓库 webhook 状态同步(同仓库未完成任务复用) | 200 400 401 404 409 |
| POST | /api/github-packages/sync |
Forward Auth | 与 GitHub webhook 状态同步 | 200 400 401 |
GET /api/github-packages/webhook/deliveries/events 返回 text/event-stream,事件名固定为 github_packages_delivery_event 与 github_packages_delivery_events_error。afterId 与 Last-Event-ID 续传;服务端取两者最大值作为 cursor。| 方法 | 路径 | 鉴权 | 用途 | 关键状态码 |
|---|---|---|---|---|
| POST | /api/web-push/subscriptions |
Forward Auth | 创建/更新 Web Push 订阅 | 200 400 401 |
| DELETE | /api/web-push/subscriptions |
Forward Auth | 删除 Web Push 订阅 | 200 400 401 |
| POST | /api/webhooks/trigger |
Webhook Secret | 外部触发 check/update 任务(action=update 必须显式携带 targets[]) |
200 400 401 |
| POST | /api/webhooks/github-packages |
GitHub Signature | 接收 GH package webhook,并优先触发命中服务的 check.service;零命中时回退到 1 个 discovery |
200 202 400 401 |
| GET | /api/deploy-check/report |
Forward Auth | 返回部署预检报告快照;有缓存时可带 refreshing=true,无缓存或刷新未就绪时返回 202 pending |
200 202 401 |
| POST | /api/deploy-check/report/refresh |
Forward Auth | 仅触发 deploy-check report 后台刷新并返回 pending envelope |
202 401 |
| GET | /api/deploy-welcome |
Forward Auth | 查询 deploy welcome 状态 | 200 401 |
| PUT | /api/deploy-welcome |
Forward Auth | 更新 deploy welcome 状态 | 200 400 401 |
/supervisor)| 方法 | 路径 | 鉴权 | 用途 | 关键状态码 |
|---|---|---|---|---|
| GET | /supervisor/health |
Forward Auth | Supervisor 健康探针(受保护) | 200 401 |
| GET | /supervisor/version |
Forward Auth | Supervisor 元信息(version + repository + developerName + developerUrl) |
200 401 |
| GET | /supervisor/self-upgrade |
Forward Auth | 查询当前自升级状态 | 200 401 |
| POST | /supervisor/self-upgrade |
Forward Auth | 发起自升级(dry-run/apply) | 200 400 401 409 |
| POST | /supervisor/self-upgrade/rollback |
Forward Auth | 回滚当前操作 | 200 400 401 |
| GET | /supervisor/favicon.png |
公开 | UI favicon | 200 |
| GET | /supervisor/ |
Forward Auth | Supervisor UI 页面 | 200 401 |
GET /supervisor/self-upgrade 在 state=running 时会返回可选字段 request(mode + rollbackOnFailure),用于页面恢复当前运行按钮状态;空闲/历史状态下该字段可缺省。说明:
POST /api/webhooks/trigger在action=update时会拒绝未携带targets[]的旧 payload,返回400 invalid_argument。 webhook update 同样支持scope=service,但仍需显式提供serviceId,并在targets[]中给出对应{ serviceId, targetTag, targetDigest, pullTags }。
GET /api/jobs 支持不透明 cursor、limit(默认 100,最大 200)、type(逗号分隔)、status、stackId 与 serviceId。响应按 createdAt DESC, id DESC 稳定排序,并在有下一页时返回 nextCursor;无效游标返回 400 invalid_jobs_cursor。