所有接口均通过 POST 方式调用,请求体和响应体均为 JSON 格式。
成功响应中 answer 字段为 10000,失败时返回对应错误码。
部分接口(如 message)支持 JSON + \0 + 二进制数据 的混合请求体格式。
设备登录或刷新注册。将一个或多个号码与设备绑定。如果 uuid 数组为空,则仅清除旧 token。
| 参数 | 类型 | 说明 |
|---|---|---|
| req * | string | 固定值 "login" |
| appid * | string | 应用 ID,2-32 字符 |
| build * | string | 构建版本号,2-16 字符 |
| name * | string | 名称称,2-32 字符 |
| locale * | string | 地区/语言,2-6 字符(如 "zh_CN") |
| token * | string | 推送通知 token,8-228 字符 |
| uuid * | string[] | 号码对应的 UUID 数组,可为空数组 [] |
成功响应:
发送消息(文本或文件)给单个号码。请求体格式为 JSON + \0 + 二进制数据。
| 参数 | 类型 | 说明 |
|---|---|---|
| req * | string | 固定值 "send" |
| uuid * | string | 发送方 UUID |
| callee * | string | 接收方号码 |
| length * | int | 二进制数据长度(字节数) |
| caller_name 可选 | string | 发送方显示名称,2-32 字符。不传则从数据库读取 |
| fname 可选 | string | 文件名,2-100 字符。不传则数据视为 UTF-8 文本 |
请求体格式:
成功响应:
群发消息给多个号码。同一份二进制数据只存储一次,各收件人记录指向同一文件。
| 参数 | 类型 | 说明 |
|---|---|---|
| req * | string | 固定值 "sends" |
| uuid * | string | 发送方 UUID |
| callees * | string[] | 接收方号码数组(非空) |
| length * | int | 二进制数据长度 |
| caller_name 可选 | string | 发送方显示名称 |
| fname 可选 | string | 文件名 |
成功响应:
接收方获取未读消息列表。获取后消息状态自动更新为"已送达"。
| 参数 | 类型 | 说明 |
|---|---|---|
| req * | string | 固定值 "get" |
| uuid * | string[] | 接收方 UUID 数组(非空) |
| after 可选 | int | Unix 时间戳,只获取此时间之后的消息。最早为 1 天前 |
成功响应:
特殊消息: uri 为 "missed.call" 时表示未接来电通知,此时 length 为 0。
| 错误码 | 说明 |
|---|---|
| 10000 | OK — 成功 |
| 10001 | server error — 服务器/数据库错误 |
| 10002 | format error — 请求格式错误(JSON 无效、缺少必要参数等) |
| 10003 | number not available — 号码不可用(已存在或保留号码) |
| 10004 | uuid error — UUID 无效或验证失败 |
| 10005 | link data existed — 关联数据已存在(每个号码仅能设置一次) |
| 10009 | server busy, try again — 服务器繁忙 |
| 10010 | caller number not in use — 主叫号码未注册/未登录 |
| 10011 | callee number not in use — 被叫号码未注册/未登录 |
| 10012 | callid error — 通话 ID 无效或状态不匹配 |
| 10013 | msgid error — 消息 ID 无效 |
| 10020 | debug — 调试占位 |
| 10031 | service not available — AI 通话服务不可用 |
| 10032 | balance not enough — AI 通话余额不足 |
| 10061 | auth error — token 鉴权失败 |
所有错误响应格式: {"answer": <错误码>, "error": "<错误描述>"}