CertH API 参考 — 端点 / 参数 / 示例
CertH API 完整参考:扫描、历史、排行榜、监控与告警端点,含鉴权、限流、错误码与 curl 示例。
POST
/api/scan
关注域名、历史趋势与告警: 无
即时扫描任意域名,返回评分、等级、因子与证书信息;按节流策略落库。
curl -X POST https://certh.csr.plus/api/scan -H "Content-Type: application/json" -d '{"domain":"stripe.com"}'
GET
/api/public/domains/:domain/history
关注域名、历史趋势与告警: 可选 API Key
榜单域名评分历史:免费 45 天,API Key 按套餐解锁更长(Pro 90 / Agency 365)。
curl "https://certh.csr.plus/api/public/domains/notion.so/history?days=90" -H "x-api-key: ch_xxx"
GET
/api/leaderboard
关注域名、历史趋势与告警: 无
全球 TLS 健康度排行,支持 page/pageSize/sort/grade/q 参数。
curl "https://certh.csr.plus/api/leaderboard?page=1&pageSize=50&sort=score&grade=A%2B"
GET
/api/domain/:domain
关注域名、历史趋势与告警: 无
某域名最新扫描状态(latest_snapshot 单行)。
curl https://certh.csr.plus/api/domain/stripe.com
GET
/api/plans
关注域名、历史趋势与告警: 无
套餐列表(免费/Pro/Agency 与能力边界)。
curl https://certh.csr.plus/api/plans
GET
/api/me
关注域名、历史趋势与告警: Session Cookie (OAuth) 或 ?api_key=
当前登录用户信息、套餐与 API Key。
curl -b cookie.txt https://certh.csr.plus/api/me
GET/POST/DELETE
/api/domains
关注域名、历史趋势与告警: JWT
监控域名管理(添加/列表/移除,添加时立即扫描落库)。
curl -X POST https://certh.csr.plus/api/domains -H "Authorization: Bearer <jwt>" -H "Content-Type: application/json" -d '{"domain":"example.com"}'
GET
/api/domains/:domain/history|events
关注域名、历史趋势与告警: JWT
用户私有域名的历史快照与变更事件(告警/轮换等)。
curl "https://certh.csr.plus/api/domains/example.com/history?days=90" -H "Authorization: Bearer <jwt>"
POST
/api/ingest
关注域名、历史趋势与告警: API Key
自有服务器扫描结果上报(高级套餐),与监控管道共用落库。
curl -X POST https://certh.csr.plus/api/ingest -H "x-api-key: ch_xxx" -H "Content-Type: application/json" -d '{"domain":"example.com","result":{...}}'
GET
/api/discover
关注域名、历史趋势与告警: JWT
CT 日志发现的新子域/新证书事件。
curl https://certh.csr.plus/api/discover -H "Authorization: Bearer <jwt>"
GET/POST/DELETE
/api/alert-rules
关注域名、历史趋势与告警: JWT
告警规则管理(评分下降/到期/轮换等事件通知)。
curl -X POST https://certh.csr.plus/api/alert-rules -H "Authorization: Bearer <jwt>" -H "Content-Type: application/json" -d '{"domain":"example.com","type":"GRADE_CHANGE","target":"you@x.com"}'
限流与数据策略
- 公开查询落库:新域名每 IP 每日 ≤20 个;同域名 1 小时最多 1 次快照。
- 历史保留:榜单(system)数据全量保留 ≥365 天,免费 API 层截断为 45 天。
- 徽章图片:边缘缓存 1 小时(max-age=3600),URL 加任意查询参数可强制刷新。
- 错误码:400 参数错误 / 401 未鉴权 / 403 权限不足或超限 / 404 无数据 / 422 扫描失败 / 429 限流。
常见问题
免费用户能获取多少历史数据?
免费无需注册即可获取最近 45 天评分历史;注册并升级 Pro 可用 API Key 解锁 90 天,Agency 解锁 365 天。
API Key 在哪里获取?
登录监控台后自动生成,以 ch_ 开头;通过 x-api-key 请求头或 ?api_key 查询参数传入。
查询会写入数据库吗?
公开查询会按节流策略落库:首次查询创建记录,重复查询追加评分历史(同域名每小时最多 1 次)。