兄弟聊 IM 向已签约商户与合作伙伴提供标准 HTTPS REST API 与 WebSocket 实时通道,便于将即时通讯、群组、钱包与商圈等能力接入自有业务系统。本文档为接口能力一览:所列地址均为示意路径,不包含真实域名、完整参数与签名算法。 XDL IM provides standard HTTPS REST APIs and a WebSocket real-time channel for contracted merchants and partners. This overview lists illustrative paths only — not production domains, full parameters, or signature algorithms.
开放能力覆盖以下模块 / Available modules:
主要特点 / Key characteristics:
/v1)请勿在客户端、移动应用或前端页面中内嵌 AppSecret。服务端接口应由商户自己的业务服务器发起。 / Never embed the AppSecret in a client app. Server APIs must be called from your own backend.
所有 REST 请求均相对于以下示意根路径,实际接入域名于签约后提供。{your-domain} 为商户专属或平台分配的接入域名占位符。
All REST requests are relative to the illustrative root below. {your-domain} is a placeholder for a dedicated or assigned access domain. The production domain is provided after contract signing.
https://api.{your-domain}/v1
wss://api.{your-domain}/v1/realtime
平台采用双重鉴权模型。 / The platform uses a dual authentication model.
服务端调用 Server-to-server
每个应用分配 AppKey 与 AppSecret,AppSecret 仅可保存在商户服务器。请求需携带 AppKey、时间戳、随机数与签名;签名由 AppSecret 与请求要素计算,具体算法于正式文档中提供。时间戳用于防止重放,超出有效窗口的请求将被拒绝。
Each application is issued an AppKey and an AppSecret (store the secret on your server only). Requests carry the AppKey, a timestamp, a nonce and a signature. The exact algorithm is documented in the official reference. Timestamps prevent replay; requests outside the validity window are rejected.
用户请求 User requests
用户登录成功后颁发 Token,用于消息、好友、群组等用户态接口。Token 具有有效期,过期后需重新获取。 / A Token is issued after a successful sign-in and is required for user-scoped APIs such as messaging, friends and groups. Tokens expire and must be refreshed.
其他安全机制 Other safeguards
429。 / Rate limits apply per application and endpoint; exceeding the limit returns 429.请求 Request
Content-Type: application/json,以及鉴权相关字段(AppKey、Token、签名等,字段名以正式文档为准)示例请求头(字段名为示意,并非最终规范)/ Sample headers (field names are illustrative, not the final specification):
Content-Type: application/json
X-App-Key: {AppKey}
X-Timestamp: {unix_timestamp}
X-Nonce: {nonce}
X-Signature: {signature}
Authorization: Bearer {Token}
响应包体 Response envelope
接口统一返回 JSON 包体。 / APIs return a consistent JSON envelope.
{
"code": 0,
"message": "OK",
"data": {}
}
| 字段 Field | 类型 Type | 说明 Description |
|---|---|---|
code |
int | 业务状态码,0 表示成功。 Business code; 0 means success. |
message |
string | 提示信息。 Human-readable message. |
data |
object / array | 业务数据,失败时可能为空。 Payload; may be empty on failure. |
常用状态码 Common Status Codes
| code | HTTP | 说明 Description |
|---|---|---|
| 0 | 200 | 成功 Success |
| 400 | 400 | 请求参数错误 Bad request / invalid parameters |
| 401 | 401 | 未授权,Token 或签名无效、过期 Unauthorized — invalid or expired Token or signature |
| 403 | 403 | 无权限访问 Forbidden |
| 404 | 404 | 资源不存在 Not found |
| 429 | 429 | 调用频率超限 Rate limited |
| 500 | 500 | 服务器内部错误 Internal server error |
其他业务错误码(例如余额不足、重复提交等)将在签约后的完整文档中列出。频率限制按 AppKey 与接口维度执行,具体配额可按业务量调整。
Additional business error codes (for example insufficient balance or a duplicated request) are listed in the full documentation. Rate-limit quotas can be adjusted after contract signing based on expected traffic.
以下路径均为示意,仅用于说明可对接的能力范围,并非线上真实地址。完整路径、参数与权限说明于签约后提供。
The paths below are placeholders that illustrate the available capabilities. They are not production URLs. Full paths, parameters and permission rules are provided after contract signing.
| 模块 Module | Method | Endpoint | 说明 Description |
|---|---|---|---|
| 账号 Account | POST |
/v1/users/register |
注册新用户 / Register a new user |
| 账号 Account | POST |
/v1/users/login |
用户登录 / Sign in |
| 账号 Account | POST |
/v1/users/guest |
游客进入 / Enter as a guest |
| 账号 Account | POST |
/v1/users/logout |
退出登录 / Sign out |
| 账号 Account | GET |
/v1/users/profile |
获取个人资料 / Get the user profile |
| 账号 Account | PUT |
/v1/users/profile |
更新个人资料 / Update the user profile |
| 账号 Account | GET |
/v1/users/qrcode |
获取个人二维码 / Get the user QR code |
| 账号 Account | GET |
/v1/users/search |
搜索用户 / Search for users |
| 好友 Friends | GET |
/v1/friends |
好友列表 / List friends |
| 好友 Friends | POST |
/v1/friends/requests |
发送好友申请 / Send a friend request |
| 好友 Friends | GET |
/v1/friends/requests |
申请列表(收到 / 发出) / List incoming and outgoing requests |
| 好友 Friends | PUT |
/v1/friends/requests/{id} |
同意或拒绝申请 / Accept or decline a request |
| 好友 Friends | DELETE |
/v1/friends/{id} |
删除好友 / Remove a friend |
| 好友 Friends | PUT |
/v1/friends/{id} |
设置备注与标签 / Set a remark and tags |
| 好友 Friends | GET |
/v1/friends/blocks |
黑名单列表 / List blocked users |
| 好友 Friends | POST |
/v1/friends/blocks |
加入黑名单 / Block a user |
| 好友 Friends | DELETE |
/v1/friends/blocks/{id} |
移出黑名单 / Unblock a user |
| 消息 Messages | POST |
/v1/messages/send |
发送消息(文字、图片、语音、文件等) / Send a message (text, image, voice, file, etc.) |
| 消息 Messages | GET |
/v1/messages |
拉取历史消息 / Retrieve message history |
| 消息 Messages | POST |
/v1/messages/recall |
撤回消息 / Recall a message |
| 消息 Messages | POST |
/v1/messages/forward |
转发或群发 / Forward or broadcast messages |
| 消息 Messages | GET |
/v1/messages/search |
搜索聊天记录 / Search chat history |
| 消息 Messages | POST |
/v1/messages/read |
标记已读 / Mark messages as read |
| 会话 Conversations | GET |
/v1/conversations |
会话列表 / List conversations |
| 会话 Conversations | PUT |
/v1/conversations/{id}/pin |
置顶会话 / Pin a conversation |
| 会话 Conversations | PUT |
/v1/conversations/{id}/mute |
设置免打扰 / Mute a conversation |
| 会话 Conversations | DELETE |
/v1/conversations/{id} |
删除会话 / Delete a conversation |
| 群组 Groups | POST |
/v1/groups |
创建群组 / Create a group |
| 群组 Groups | GET |
/v1/groups/{id} |
获取群资料 / Get the group profile |
| 群组 Groups | PUT |
/v1/groups/{id} |
更新群资料 / Update the group profile |
| 群组 Groups | GET |
/v1/groups/{id}/qrcode |
获取群二维码 / Get the group QR code |
| 群组 Groups | POST |
/v1/groups/{id}/join |
申请或加入群 / Request to join or join a group |
| 群组 Groups | POST |
/v1/groups/{id}/leave |
退出群组 / Leave a group |
| 群组 Groups | GET |
/v1/groups/{id}/members |
群成员列表 / List group members |
| 群组 Groups | POST |
/v1/groups/{id}/members |
邀请成员 / Invite members |
| 群组 Groups | DELETE |
/v1/groups/{id}/members/{uid} |
移除成员 / Remove a member |
| 群组 Groups | PUT |
/v1/groups/{id}/roles |
管理权限与管理员 / Manage roles and permissions |
| 群组 Groups | PUT |
/v1/groups/{id}/settings |
群规与媒体控制 / Update group rules and media settings |
| 群组 Groups | POST |
/v1/groups/{id}/mute |
禁言成员 / Mute a member |
| 群组 Groups | PUT |
/v1/groups/{id}/owner |
转让群主 / Transfer group ownership |
| 群组 Groups | DELETE |
/v1/groups/{id} |
解散群组 / Disband a group |
| 群组 Groups | GET |
/v1/groups/{id}/announcements |
群公告 / List or read announcements |
| 音视频 A/V | POST |
/v1/calls |
发起一对一语音或视频通话 / Start a one-to-one audio or video call |
| 音视频 A/V | PUT |
/v1/calls/{id} |
接听、拒绝或挂断 / Answer, decline or hang up |
| 音视频 A/V | GET |
/v1/calls/{id} |
查询通话状态 / Get call status |
| 钱包 Wallet | GET |
/v1/wallet/balance |
查询余额 / Get the wallet balance |
| 钱包 Wallet | POST |
/v1/wallet/deposits |
创建充值订单 / Create a deposit order |
| 钱包 Wallet | GET |
/v1/wallet/deposits |
充值记录 / List deposit orders |
| 钱包 Wallet | POST |
/v1/wallet/transfers |
向好友转账 / Transfer funds to a friend |
| 钱包 Wallet | POST |
/v1/wallet/red-packets |
发送红包 / Send a red packet |
| 钱包 Wallet | POST |
/v1/wallet/red-packets/{id}/claim |
领取红包 / Claim a red packet |
| 钱包 Wallet | GET |
/v1/wallet/transactions |
交易记录 / List transactions |
| 钱包 Wallet | POST |
/v1/wallet/withdrawals |
申请提现 / Request a withdrawal |
| 钱包 Wallet | POST |
/v1/wallet/bank-cards |
绑定银行卡 / Bind a bank card |
| 钱包 Wallet | PUT |
/v1/wallet/payment-password |
设置或修改支付密码 / Set or change the payment password |
| 钱包 Wallet | GET |
/v1/wallet/pay-code |
收付款码 / Payment or collection code |
| 商圈 Circle | GET |
/v1/circle/apps |
商圈应用列表 / List Business Circle apps |
| 商圈 Circle | GET |
/v1/circle/apps/{id} |
应用详情 / Get app details |
| 商圈 Circle | POST |
/v1/circle/apps/{id}/favorite |
收藏应用 / Favorite an app |
| 商圈 Circle | POST |
/v1/circle/agents |
申请成为商圈代理 / Apply to become a Business Circle agent |
| 商圈 Circle | GET |
/v1/circle/agents/me |
我的代理信息 / Get my agent profile |
| 会员 Membership | GET |
/v1/membership/plans |
会员套餐列表 / List membership plans |
| 会员 Membership | POST |
/v1/membership/subscriptions |
开通或续费会员 / Subscribe to or renew a plan |
| 会员 Membership | GET |
/v1/membership/status |
当前会员状态 / Get membership status |
| 会员 Membership | POST |
/v1/rewards/check-in |
每日签到 / Daily check-in |
| 会员 Membership | GET |
/v1/rewards/invites |
我的邀请记录 / List invitations |
| 会员 Membership | GET |
/v1/rewards/invite-code |
邀请码与推广二维码 / Get the invite code and QR code |
| 其他 Others | GET |
/v1/exchange-rates |
实时汇率 / Get exchange rates |
| 其他 Others | POST |
/v1/reports |
提交举报或投诉 / Submit a report |
| 其他 Others | GET |
/v1/reports |
查询投诉进度 / List report status |
| 其他 Others | POST |
/v1/support/sessions |
联系在线客服 / Start a support session |
实时消息投递、输入状态与通话信令通过 WebSocket 通道完成,不必轮询 REST 接口。 / Real-time message delivery, typing indicators and call signaling are carried over the WebSocket channel and do not require REST polling.
商户可配置回调 URL。平台以 HTTPS POST + JSON 推送事件,请求带签名以便校验来源,失败将有限次重试。 / Merchants may register a callback URL to receive signed HTTPS POST + JSON event notifications, with limited retries on failure.
| 事件 Event | 说明 Description |
|---|---|
user.registered |
用户注册成功 / A user has registered |
user.login |
用户登录 / A user has signed in |
friend.request |
新的好友申请 / A friend request was sent |
message.sent |
消息已发送 / A message was sent |
message.recalled |
消息已撤回 / A message was recalled |
group.created |
群组已创建 / A group was created |
group.member_joined |
成员入群 / A member joined a group |
call.started |
音视频通话开始 / A call has started |
wallet.deposit |
充值到账 / A deposit has been credited |
wallet.transfer |
转账完成 / A transfer has completed |
report.created |
新的举报或投诉 / A new report was submitted |
载荷示意(字段为示例)/ Illustrative payload (fields are examples):
{
"event": "message.sent",
"timestamp": 1732170000,
"data": {}
}
回调地址配置、重试策略与签名校验方法于正式文档中提供。 / Callback URL configuration, retry policy and signature verification are provided in the official documentation.
如需在自有应用中嵌入聊天能力,可申请客户端 SDK。Web、iOS、Android 与 H5 等主流平台支持可按需提供,具体版本与接入方式于签约后沟通确认。 / Client SDKs for Web, iOS, Android and H5 are available on request. Versions and integration details are confirmed after contract signing.
完整接口文档、参数说明、签名算法与测试环境于签约后提供。
Full API reference, parameters, signing algorithm and sandbox access are provided after contract signing.
如需对接,请联系兄弟聊商务团队。 / To start integration, please contact the XDL business team.