Machine API 参考

生成的操作列表与机器可读的 Discovery。

最近更新: 2026年9月30日

如何阅读本参考

操作列表由与 OpenAPI 相同的注册表生成,而不是从旧文档复制而来。方法、路径、Scope、条件 Scope 和幂等支持遵循注册表;说明来自一个以 operationId 为键的已翻译词典。无法识别的操作需要在每种语言中补充翻译,而不是悄悄显示英文。

OpenAPI 目前为许多操作使用通用的请求/响应对象。其通用的钱包请求示例并不是每个 POST 的有效载荷。这些工作流程请使用认证、充值和 Watchdog 中经过检验的示例。该文档是 Discovery 参考,并不断言每条路由都共享相同的响应状态或字段。

API 边界

本模块涵盖 x402 机器计费和 Watchdog 自动化。计量数据路由使用其现有的 API,并单独列出。MCP 是只读的工具接口,具有独立的 OAuth 账户流程;本模块不更改其实现。Credits 和 MCP 用户指南是独立的文档部分。

操作参考

  • GET /api/x402/account — Scope: read; 获取 Credits 余额和 Ledger.
  • GET /api/x402/account/terms — Scope: read; 获取条款接受状态.
  • POST /api/x402/account/terms — Scope: write; 接受当前条款.
  • GET /api/x402/alerts — Scope: read; 列出告警历史.
  • DELETE /api/x402/alerts — Scope: write; 删除选定的告警历史.
  • DELETE /api/x402/alerts/{id} — Scope: write; 删除一条告警.
  • GET /api/x402/alerts/export — Scope: read; 将告警历史导出为 CSV.
  • POST /api/x402/auth/challenge — Scope: 无需认证; 创建带 Scope 的 SIWE Challenge.
  • POST /api/x402/auth/token — Scope: 无需认证; 用已签名的 SIWE 兑换 Bearer-Token.
  • GET /api/x402/auth/tokens — Scope: read; 列出钱包的 API Token.
  • DELETE /api/x402/auth/tokens/{id} — Scope: write; 撤销一个 API Token.
  • GET /api/x402/channels — Scope: read; 列出通道状态.
  • PUT /api/x402/channels/{key} — Scope: write; 配置输入型通道; 支持 Idempotency-Key.
  • DELETE /api/x402/channels/{key} — Scope: write; 移除通道目标.
  • POST /api/x402/channels/{key}/test — Scope: write; 发送通道测试.
  • POST /api/x402/message-preview — Scope: read; 预览本地化消息.
  • GET /api/x402/openapi.json — Scope: 无需认证; 获取此 OpenAPI 文档.
  • GET /api/x402/pricing — Scope: 无需认证; 发现价格、产品、Watch、信号和帮助.
  • GET /api/x402/provider-fsp — Scope: read; 获取 Provider FSP 视图.
  • GET /api/x402/recipients — Scope: read; 列出具名收件人.
  • POST /api/x402/recipients — Scope: write; 创建输入型收件人; 支持 Idempotency-Key.
  • PATCH /api/x402/recipients/{id} — Scope: write; 更新收件人.
  • DELETE /api/x402/recipients/{id} — Scope: write; 删除收件人.
  • POST /api/x402/recipients/{id}/test — Scope: write; 测试收件人.
  • POST /api/x402/recipients/telegram-link — Scope: write; 创建 Telegram 收件人关联.
  • GET /api/x402/settings — Scope: read; 获取通知设置.
  • PUT /api/x402/settings — Scope: write; 替换通知设置.
  • GET /api/x402/stats — Scope: 无需认证; 获取公开计费汇总.
  • GET /api/x402/subscriptions — Scope: read; 列出订阅和容量.
  • POST /api/x402/subscriptions — Scope: spend; 购买订阅容量; 支持 Idempotency-Key.
  • PATCH /api/x402/subscriptions — Scope: write (autoRenew 为 true 时需要 spend); 更新 Auto-Renew.
  • GET /api/x402/subscriptions/quote — Scope: read; 订阅容量报价.
  • POST /api/x402/subscriptions/trial — Scope: write; 开始一次性试用.
  • POST /api/x402/topup — Scope: write; 创建充值草稿; 支持 Idempotency-Key.
  • GET /api/x402/topup/{handle} — Scope: read; 获取充值状态.
  • POST /api/x402/topup/{handle}/confirm — Scope: write; 确认充值交易.
  • GET /api/x402/watches — Scope: read; 列出 Watch.
  • POST /api/x402/watches — Scope: write; 创建 Watch; 支持 Idempotency-Key.
  • GET /api/x402/watches/{id} — Scope: read; 获取 Watch.
  • PATCH /api/x402/watches/{id} — Scope: write; 更新 Watch.
  • DELETE /api/x402/watches/{id} — Scope: write; 删除 Watch.