{"openapi":"3.0.3","info":{"title":"Turtle SMS API (乌龟卡短信提醒智能体接口)","version":"2.8.0","description":"专为 AI 智能体设计的定时短信提醒与即时通知服务。支持自然语言延时(X分钟/小时后)、指定时间、公历/农历周期提醒以及即时短信下发。成功发出的短信可在 HERMES_ENDPOINT 与 HERMES_API_KEY 同时配置时以 markdown 卡片格式同步推送到 Hermes 微信通道。"},"servers":[{"url":"https://sms.benext.uk","description":"当前 Worker 接口服务地址"}],"paths":{"/api/tasks":{"get":{"operationId":"listReminders","summary":"获取所有提醒任务列表","description":"查询当前系统中已创建的所有提醒任务及其下一次触发时间。","responses":{"200":{"description":"成功获取任务列表","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"count":{"type":"integer"},"tasks":{"type":"array","items":{"type":"object"}}}}}}}}},"post":{"operationId":"createReminder","summary":"创建短信提醒任务","description":"为用户创建一个短信定时提醒任务。支持相对延时（如30分钟后）、指定时间、每月/每年固定日（公历/农历）等模式。","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"title":{"type":"string","description":"提醒任务简明标题，如：'取快递'、'信用卡还款'、'妈妈生日'。留空将自动从内容提取。"},"message":{"type":"string","description":"要发送给用户的短信正文内容。支持占位符 {{title}}、{{date}}、{{lunar}}。"},"delayMinutes":{"type":"integer","description":"相对延时（分钟）：从现在起多少分钟后提醒（如用户说'30分钟后提醒我'，填 30）。"},"delayHours":{"type":"integer","description":"相对延时（小时）：从现在起多少小时后提醒（如用户说'2小时后提醒我'，填 2）。"},"delayDays":{"type":"integer","description":"相对延时（天）：从现在起多少天后提醒（如用户说'3天后提醒我'，填 3）。"},"runAt":{"type":"string","description":"指定具体提醒时间（北京时间，如 '2026-08-17 15:30:00' 或 ISO 格式）。"},"calendarType":{"type":"string","enum":["solar","lunar"],"default":"solar","description":"日历类型：solar(公历/阳历，默认)，lunar(农历/阴历，用于农历生日或传统节日)。"},"frequency":{"type":"string","enum":["once","interval","weekly","monthly","yearly"],"default":"once","description":"提醒频率：once(单次，默认)，interval(按天数间隔)，weekly(每周固定星期几)，monthly(每月固定日)，yearly(每年固定日/生日)。"},"intervalDays":{"type":"integer","default":25,"description":"间隔天数（如每 25 天提醒一次，仅在 frequency 为 interval 时有效）。"},"weekday":{"type":"integer","description":"每周几提醒：0=周日，1=周一 ... 6=周六。仅在 frequency 为 weekly 时有效（如每周六填 6）。"},"weeklyTime":{"type":"string","default":"09:00","description":"每周提醒时间 (HH:mm)，如 '10:00'，北京时间。仅在 frequency 为 weekly 时有效。"},"monthlyDay":{"type":"integer","description":"每月固定几号提醒 (1-31)，仅在 frequency 为 monthly 且 calendarType 为 solar 时有效。"},"monthlyTime":{"type":"string","default":"09:00","description":"每月提醒时间 (HH:mm)，如 '09:00'。"},"yearlyMonth":{"type":"integer","description":"公历每年月份 (1-12)，仅在 frequency 为 yearly 且 calendarType 为 solar 时有效。"},"yearlyDay":{"type":"integer","description":"公历每年日期 (1-31)，仅在 frequency 为 yearly 且 calendarType 为 solar 时有效。"},"yearlyTime":{"type":"string","default":"09:00","description":"每年提醒时间 (HH:mm)，如 '09:00'。"},"lunarMonth":{"type":"integer","description":"农历月份 (1-12)，用于农历生日/节日（如八月十五填 8）。"},"lunarDay":{"type":"integer","description":"农历日期 (1-30)，用于农历生日/节日（如八月十五填 15）。"},"lunarTime":{"type":"string","default":"09:00","description":"农历提醒时间 (HH:mm)，如 '09:00'。"},"autoDeleteOnComplete":{"type":"boolean","default":true,"description":"单次提醒发送完毕后是否自动删除该任务（默认 true）。"}}}}}},"responses":{"201":{"description":"成功创建提醒任务","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"humanSummary":{"type":"string","description":"人类可读的确认语，可直接回复给用户"},"task":{"type":"object"}}}}}}}}},"/api/tasks/{id}":{"get":{"operationId":"getReminder","summary":"获取指定提醒任务详情","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"任务ID"}],"responses":{"200":{"description":"获取成功"},"404":{"description":"任务不存在"}}},"delete":{"operationId":"deleteReminder","summary":"取消/删除指定提醒任务","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"任务ID"}],"responses":{"200":{"description":"删除成功","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"humanSummary":{"type":"string"}}}}}}}}},"/api/notify":{"post":{"operationId":"sendInstantNotification","summary":"立即发送短信通知","description":"直接触发短信通道秒级下发短信，无需排队定时。适合紧急告警、即时验证码通知等场景。","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"即时短信正文内容"},"title":{"type":"string","description":"通知标题（可选）"}}}}}},"responses":{"200":{"description":"短信发送成功","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"humanSummary":{"type":"string"}}}}}}}}},"/api/sent-messages":{"get":{"operationId":"listSentMessages","summary":"增量查询已成功发送的短信记录","description":"查询所有已成功下发的短信记录。支持通过 since 参数（毫秒时间戳）做增量轮询：仅返回发送时间严格晚于 since 的记录，按发送时间升序排列。记录保留 30 天。首次调用可不传 since 获取全部记录，之后每次用上次结果中最新一条的 sentAt 时间戳作为 since。","parameters":[{"name":"since","in":"query","required":false,"schema":{"type":"integer","format":"int64"},"description":"起始时间戳（毫秒）。仅返回 sentAt 晚于该时间点的记录；不传则返回全部（受 limit 限制）。"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"minimum":1,"maximum":200},"description":"单次返回的最大记录条数，默认 100，最大 200。"}],"responses":{"200":{"description":"成功获取已发送短信列表","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"count":{"type":"integer","description":"本次返回的记录条数"},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"记录唯一ID"},"taskId":{"type":"string","description":"来源提醒任务ID（即时通知时为临时任务ID）","nullable":true},"title":{"type":"string","description":"短信标题"},"message":{"type":"string","description":"实际发送的短信正文内容"},"sentAt":{"type":"string","format":"date-time","description":"发送时间（ISO 8601 UTC，如 2026-08-18T15:00:00.000Z）"}}}}}}}}},"400":{"description":"since 参数不是合法的毫秒时间戳"}}}},"/api/quota":{"get":{"operationId":"getQuotaStatus","summary":"查询当前短信额度与使用情况","responses":{"200":{"description":"成功获取额度状态"}}}}},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"在 Header 中传入 Authorization: Bearer <API_TOKEN>"},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"在 Header 中传入 X-API-Key: <API_TOKEN>"}}},"security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}]}