{"openapi":"3.0.0","info":{"version":"1.0.0","title":"cf-api-hoo API 接口文档","description":"基于 OpenAPI 和 Zod 自动生成的强类型交互式 API 文档。"},"components":{"schemas":{},"parameters":{}},"paths":{"/ip":{"get":{"summary":"Get the visitor IP address","description":"Returns the client IP from the cf-connecting-ip header.","responses":{"200":{"description":"Request successful","content":{"application/json":{"schema":{"type":"object","properties":{"ip":{"type":"string","example":"1.2.3.4"},"message":{"type":"string","example":"This is your IP address"}},"required":["ip","message"]}}}}},"tags":["未分类"]}},"/ip/detail":{"get":{"summary":"Get visitor IP, geography, and network details","description":"Returns Cloudflare request.cf metadata together with the visitor IP address.","responses":{"200":{"description":"Request successful","content":{"application/json":{"schema":{"type":"object","properties":{"available":{"type":"boolean","example":true},"ip":{"type":"string","nullable":true,"example":"1.2.3.4"},"geography":{"type":"object","properties":{"country":{"type":"string","nullable":true,"example":"US"},"isEUCountry":{"type":"boolean","nullable":true,"example":false},"continent":{"type":"string","nullable":true,"example":"NA"},"region":{"type":"string","nullable":true,"example":"California"},"regionCode":{"type":"string","nullable":true,"example":"CA"},"city":{"type":"string","nullable":true,"example":"San Francisco"},"postalCode":{"type":"string","nullable":true,"example":"94107"},"latitude":{"type":"string","nullable":true,"example":"37.76210"},"longitude":{"type":"string","nullable":true,"example":"-122.39710"},"timezone":{"type":"string","nullable":true,"example":"America/Los_Angeles"},"metroCode":{"type":"string","nullable":true,"example":"807"}},"required":["country","isEUCountry","continent","region","regionCode","city","postalCode","latitude","longitude","timezone","metroCode"]},"network":{"type":"object","properties":{"asn":{"type":"number","nullable":true,"example":13335},"asOrganization":{"type":"string","nullable":true,"example":"Cloudflare, Inc."},"operator":{"type":"string","nullable":true,"example":"Cloudflare, Inc."},"colo":{"type":"string","nullable":true,"example":"SJC"},"clientTcpRtt":{"type":"number","nullable":true,"example":12},"httpProtocol":{"type":"string","nullable":true,"example":"HTTP/3"},"requestPriority":{"type":"string","nullable":true,"example":""},"tlsVersion":{"type":"string","nullable":true,"example":"TLSv1.3"},"tlsCipher":{"type":"string","nullable":true,"example":"AEAD-AES128-GCM-SHA256"}},"required":["asn","asOrganization","operator","colo","clientTcpRtt","httpProtocol","requestPriority","tlsVersion","tlsCipher"]}},"required":["available","ip","geography","network"]}}}}},"tags":["未分类"]}},"/price":{"get":{"summary":"获取模拟 BTC 测试汇率","description":"返回一个静态的模拟 BTC 价格数据。","responses":{"200":{"description":"请求成功","content":{"application/json":{"schema":{"type":"object","properties":{"symbol":{"type":"string","example":"BTC"},"price":{"type":"string","example":"60000"},"currency":{"type":"string","example":"USD"}},"required":["symbol","price","currency"]}}}}},"tags":["未分类"]}},"/door_qsw":{"get":{"summary":"QSW门禁系统开门，需国内反代","description":"读取 KV 中的凭据，代理发送请求以触发远程自动开门。","x-kv-reqs":["door_qsw:ck","door_qsw:deviceSerial","set:cnproxy:url","set:cnproxy:port"],"responses":{"200":{"description":"上游响应成功","content":{"application/json":{"schema":{"type":"object","properties":{"upstreamStatus":{"type":"number","example":200},"response":{"type":"string","example":"{\"code\":200,\"msg\":\"success\"}"}},"required":["upstreamStatus","response"]}}}},"500":{"description":"服务器或 KV 凭证错误","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"502":{"description":"上游网关异常","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}},"required":["error"]}}}}},"tags":["未分类"]}},"/binance/prices":{"get":{"summary":"获取监控币种的最新价格","description":"从 Binance API 批量获取受监控币种的最新价格，并将其缓存至 KV 中。","tags":["币安监控"],"responses":{"200":{"description":"最新价格数据","content":{"application/json":{"schema":{"type":"object","properties":{"symbols":{"type":"array","items":{"type":"string"},"example":["BTCUSDT"]},"prices":{"type":"array","items":{"type":"object","properties":{"symbol":{"type":"string"},"price":{"type":"string"}},"required":["symbol","price"]},"example":[{"symbol":"BTCUSDT","price":"60000.00"}]},"fetchedAt":{"type":"string","format":"date-time"}},"required":["symbols","prices","fetchedAt"]}}}},"500":{"description":"服务器错误","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"502":{"description":"上游网关异常","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"status":{"type":"number"}},"required":["error"]}}}}}}},"/binance/symbols":{"get":{"summary":"获取所监控的币种列表","description":"从 KV 存储中返回当前正在监控的数字货币符号列表。","x-kv-reqs":["binance:symbols"],"tags":["币安监控"],"responses":{"200":{"description":"币种列表","content":{"application/json":{"schema":{"type":"object","properties":{"symbols":{"type":"array","items":{"type":"string"},"example":["BTCUSDT","ETHUSDT"]}},"required":["symbols"]}}}},"500":{"description":"服务器错误","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}},"post":{"summary":"更新所监控的币种列表","description":"更新 KV 存储中正在监控的数字货币符号列表。","tags":["币安监控"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"symbols":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"maxItems":50,"example":["BTCUSDT","ETHUSDT","XRPUSDT"]}},"required":["symbols"]}}}},"responses":{"200":{"description":"更新成功","content":{"application/json":{"schema":{"type":"object","properties":{"symbols":{"type":"array","items":{"type":"string"}},"updated":{"type":"boolean"}},"required":["symbols","updated"]}}}},"400":{"description":"参数校验失败","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"error":{"nullable":true}},"required":["success"]}}}},"500":{"description":"服务器错误","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/ujia":{"get":{"summary":"查询 USDT (U价) 实时场外交易价","description":"调用币安 P2P 接口实时查询 USDT 对 CNY 的场外出售价格。","tags":["金融/行情数据"],"responses":{"200":{"description":"查询成功","content":{"application/json":{"schema":{"nullable":true}}}},"500":{"description":"查询失败","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}},"required":["error"]}}}}}}},"/oil":{"get":{"summary":"查询汽油实时油价,需国内反代","description":"调用中石化接口实时查询当前各类油价，默认会通过 `fetchWithProxy` 切国内节点以防屏蔽。","x-kv-reqs":["set:cnproxy:url","set:cnproxy:port"],"tags":["生活/便民服务"],"responses":{"200":{"description":"查询成功","content":{"application/json":{"schema":{"nullable":true}}}},"500":{"description":"查询失败","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}},"required":["error"]}}}}}}},"/msg/bark":{"get":{"summary":"Bark 苹果推送服务","description":"读取 KV 中存放的 Bark Token，将带有标题和内容的参数转义并拼接为 Bark APP 识别的链接以实现推送。","x-kv-reqs":["msg:bark:token"],"tags":["分类消息通道 (/msg)"],"parameters":[{"schema":{"type":"string","example":"系统报警通知"},"required":true,"name":"title","in":"query"},{"schema":{"type":"string","example":"服务器负载过高"},"required":true,"name":"description","in":"query"},{"schema":{"type":"string","example":"https://example.com"},"required":false,"name":"url","in":"query"}],"responses":{"200":{"description":"推送完成","content":{"application/json":{"schema":{"nullable":true}}}},"500":{"description":"内部错误","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}},"required":["error"]}}}}}}},"/msg/chanify":{"get":{"summary":"Chanify 苹果推送服务","description":"读取 KV 中存放的 Chanify Token，调用 Chanify Sender API 发送定制消息。","x-kv-reqs":["msg:chanify:token"],"tags":["分类消息通道 (/msg)"],"parameters":[{"schema":{"type":"string","example":"系统报警通知"},"required":true,"name":"title","in":"query"},{"schema":{"type":"string","example":"服务器负载过高"},"required":true,"name":"description","in":"query"},{"schema":{"type":"string","example":"https://example.com"},"required":false,"name":"url","in":"query"}],"responses":{"200":{"description":"推送完成","content":{"application/json":{"schema":{"nullable":true}}}},"500":{"description":"内部错误","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}},"required":["error"]}}}}}}},"/msg/feishu":{"get":{"summary":"飞书 (Feishu) Webhook 推送","description":"提取飞书机器人凭证，通过 Web Crypto API 执行底层的 HMAC-SHA256 毫秒级防篡改签名验证，发起 Post JSON 推送富文本对象。","x-kv-reqs":["msg:feishu:url","msg:feishu:key"],"tags":["分类消息通道 (/msg)"],"parameters":[{"schema":{"type":"string","example":"运维报警"},"required":true,"name":"title","in":"query"},{"schema":{"type":"string","example":"监控指标异常"},"required":true,"name":"description","in":"query"},{"schema":{"type":"string","example":"https://example.com"},"required":false,"name":"url","in":"query"}],"responses":{"200":{"description":"推送完成","content":{"application/json":{"schema":{"nullable":true}}}},"500":{"description":"配置缺失或请求错误","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}},"required":["error"]}}}}}}},"/msg/dingding":{"get":{"summary":"钉钉 Webhook 推送","description":"提取钉钉机器人凭证，通过 Web Crypto API 执行底层的 HMAC-SHA256 毫秒级防篡改签名验证，发起 Post JSON 推送链接卡片。","x-kv-reqs":["msg:dingding:url","msg:dingding:key"],"tags":["分类消息通道 (/msg)"],"parameters":[{"schema":{"type":"string","example":"运维报警"},"required":true,"name":"title","in":"query"},{"schema":{"type":"string","example":"监控指标异常"},"required":true,"name":"description","in":"query"},{"schema":{"type":"string","example":"https://example.com"},"required":false,"name":"url","in":"query"}],"responses":{"200":{"description":"推送完成","content":{"application/json":{"schema":{"nullable":true}}}},"500":{"description":"配置缺失或请求错误","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}},"required":["error"]}}}}}}},"/msg/tg":{"get":{"summary":"发送 TG 文本消息","description":"从 KV 读取 Telegram Bot Token 和 Chat ID 配置，将传入的 text 文本内容推送到对应的电报群组/会话。","x-kv-reqs":["msg:tg:bottoken","msg:tg:chatid"],"tags":["分类消息通道 (/msg)"],"parameters":[{"schema":{"type":"string","example":"Hello from cf-api-hoo!"},"required":true,"name":"text","in":"query"}],"responses":{"200":{"description":"上游推送完成 (透传 Telegram 返回信息)","content":{"application/json":{"schema":{"nullable":true}}}},"500":{"description":"KV 凭证缺失或服务器请求异常","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}},"required":["error"]}}}}}}},"/msg/qywx":{"get":{"summary":"企微 Webhook 机器人消息推送","description":"读取 KV 中存放的企业微信群机器人 Webhook Key，通过文本卡片 (Textcard) 格式向所在群组推送图文消息，无 IP 白名单限制。","x-kv-reqs":["msg:qywx:key"],"tags":["分类消息通道 (/msg)"],"parameters":[{"schema":{"type":"string","example":"系统报警通知"},"required":true,"name":"title","in":"query"},{"schema":{"type":"string","example":"CPU 负载过高\n请立即检查"},"required":true,"name":"description","in":"query"},{"schema":{"type":"string","example":"https://example.com"},"required":true,"name":"url","in":"query"}],"responses":{"200":{"description":"推送完成 (透传企微返回结果)","content":{"application/json":{"schema":{"nullable":true}}}},"500":{"description":"KV 凭证缺失或服务器请求异常","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}},"required":["error"]}}}}}}},"/msg/xiaoai":{"get":{"summary":"小米小爱音箱 TTS 语音播报","description":"读取 KV 中存放的小米账号密码，模拟客户端通讯协议并提取获取指令 Token 发起 TTS 播报下发。会自动缓存鉴权 Token 提速防风控。","x-kv-reqs":["msg:xiaoai:phone","msg:xiaoai:password"],"tags":["分类消息通道 (/msg)"],"parameters":[{"schema":{"type":"string","example":"系统报警"},"required":false,"name":"title","in":"query"},{"schema":{"type":"string","example":"服务掉线了"},"required":true,"name":"text","in":"query"},{"schema":{"type":"string","example":"注意："},"required":false,"name":"prefix","in":"query"}],"responses":{"200":{"description":"推送完成","content":{"application/json":{"schema":{"nullable":true}}}},"500":{"description":"内部错误或小米账户失效","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}},"required":["error"]}}}}}}}}}