Appearance
微信4.x HTTP接口文档
支持版本: 4.1.5.16 / 4.1.6.14 / 4.1.6.46 / 4.1.7.30 / 4.1.8.27 / 4.1.8.28 / 4.1.8.67
基础地址: http://127.0.0.1:{port}/api/(端口为动态分配)
所有接口均为 POST 请求,参数以 JSON 格式传递。
登录相关
初始化微信
POST /api/wechat_init
登录成功后先调用,加载联系人列表和群列表
json
{}检查登录状态
POST /api/check_login
json
{}刷新二维码
POST /api/reflash_qrcode
json
{}扫描二维码登录
POST /api/qrscan
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| path | string | 是 | 二维码图片本地路径 |
json
{"path": "C:\\path\\to\\qrcode.png"}退出登录
POST /api/logout
json
{}自动登录 4.1.7.30+
POST /api/auto_login
json
{}获取配置路径
POST /api/get_config_path
json
{}个人信息
获取个人信息(缓存)
POST /api/get_profile_cache
json
{}获取个人信息(网络)
POST /api/get_profile_new
json
{}获取个人二维码
POST /api/get_my_qrocde
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid | string | 是 | 自己的wxid |
| style | string | 是 | 二维码风格(1-8) |
| opcode | string | 是 | 操作码 |
| info | string | 否 | 说明信息 |
json
{"wxid": "wxid_xxx", "style": "1", "opcode": "0", "info": ""}修改个人昵称
POST /api/mod_self_nick_name
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| newName | string | 是 | 新昵称 |
json
{"newName": "新昵称"}修改个人签名
POST /api/mod_self_nick_signature
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| newSignature | string | 是 | 新个性签名 |
json
{"newSignature": "这是我的签名"}修改个人头像
POST /api/upload_head_img
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| filepath | string | 是 | 头像图片路径 |
json
{"filepath": "C:\\path\\to\\headimg.png"}发送消息
发送文本消息
POST /api/send_text_msg
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid | string | 是 | 接收人wxid |
| msg | string | 是 | 消息内容 |
json
{"wxid": "filehelper", "msg": "Hello World!"}发送群@消息
POST /api/send_at_text
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxids | string | 是 | 被@人的wxid,多个用逗号分隔 |
| msg | string | 是 | 消息内容(需包含@昵称) |
| roomId | string | 是 | 群聊ID |
@全体成员时 wxids 传
notify@all
json
{"wxids": "wxid_xxx,wxid_yyy", "msg": "@昵称 你好", "roomId": "123456789@chatroom"}发送图片
POST /api/send_image_msg
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid | string | 是 | 接收人wxid |
| filepath | string | 是 | 图片本地路径 |
json
{"wxid": "wxid_xxx", "filepath": "C:\\path\\to\\image.png"}发送文件
POST /api/send_file_msg
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid | string | 是 | 接收人wxid |
| filepath | string | 是 | 文件本地路径 |
json
{"wxid": "wxid_xxx", "filepath": "C:\\path\\to\\file.txt"}发送名片
POST /api/send_card_msg
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| towxid | string | 是 | 接收人wxid |
| fromwxid | string | 是 | 名片对应的wxid |
json
{"towxid": "wxid_xxx", "fromwxid": "wxid_yyy"}发送语音
POST /api/send_voice
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| toWxid | string | 是 | 接收人wxid |
| silkPath | string | 是 | silk格式语音文件路径 |
json
{"toWxid": "wxid_xxx", "silkPath": "C:\\path\\to\\voice.silk"}发送拍一拍
POST /api/send_pat
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| roomId | string | 是 | 群聊ID |
| wxid | string | 是 | 被拍人wxid |
json
{"roomId": "123456789@chatroom", "wxid": "wxid_xxx"}发送位置消息
POST /api/send_location_msg
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid | string | 是 | 接收人wxid |
| label | string | 是 | 位置名称 |
| poiname | string | 是 | 详细地址 |
| x | string | 是 | 经度 |
| y | string | 是 | 纬度 |
json
{"wxid": "wxid_xxx", "label": "位置名称", "poiname": "详细地址", "x": "116.3975", "y": "39.9087"}发送链接卡片
POST /api/send_xml
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid | string | 是 | 接收人wxid |
| title | string | 是 | 文章标题 |
| description | string | 是 | 文章描述 |
| thumbUrl | string | 是 | 封面图URL |
| url | string | 是 | 文章链接 |
json
{"wxid": "wxid_xxx", "title": "标题", "description": "描述", "thumbUrl": "https://example.com/thumb.jpg", "url": "https://example.com"}发送引用消息 不支持4.1.5.16
POST /api/send_quote
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| sendto | string | 是 | 接收人wxid或群聊ID |
| fromUsr | string | 是 | 被引用消息的发送者wxid |
| referContent | string | 是 | 被引用的消息内容 |
| msgSource | string | 是 | 消息来源XML |
| newmsgid | string | 是 | 被引用消息的newMsgId |
| createTime | number | 是 | 被引用消息的创建时间戳 |
| reply | string | 是 | 回复内容 |
json
{
"sendto": "wxid_xxx",
"fromUsr": "wxid_yyy",
"referContent": "引用内容",
"msgSource": "[msg_source_xml]",
"newmsgid": "1234567890123456789",
"createTime": 1700000000,
"reply": "回复内容"
}好友管理
获取好友列表
POST /api/get_frien_lists
json
{}获取联系人信息
POST /api/get_contact
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid | string | 是 | 联系人wxid |
json
{"wxid": "wxid_xxx"}搜索好友
POST /api/net_scene_search_contact
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| search | string | 是 | 搜索关键词 |
json
{"search": "微信号或手机号"}添加好友
POST /api/add_friend
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| v3 | string | 是 | v3数据 |
| v4 | string | 是 | v4数据 |
| scene | string | 是 | 添加来源场景值 |
| friendFlag | string | 是 | 好友标志 |
| verifyContent | string | 是 | 验证消息 |
json
{"v3": "v3_xxx@stranger", "v4": "v4_xxx@stranger", "scene": "3", "friendFlag": "0", "verifyContent": "你好"}通过好友验证
POST /api/verify_friend
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| v3 | string | 是 | v3数据 |
| v4 | string | 是 | v4数据 |
| scene | string | 是 | 添加来源场景值 |
json
{"v3": "v3_xxx@stranger", "v4": "v4_xxx", "scene": "3"}删除联系人
POST /api/del_contact
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid | string | 是 | 要删除的联系人wxid |
json
{"wxid": "wxid_xxx"}设置联系人备注
POST /api/remark_contact
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid | string | 是 | 联系人wxid |
| remark | string | 是 | 备注名 |
json
{"wxid": "wxid_xxx", "remark": "备注名"}群聊管理
获取群聊列表
POST /api/get_chatroom_list
json
{}获取群聊信息
POST /api/get_chatroom_info
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| roomId | string | 是 | 群聊ID |
json
{"roomId": "123456789@chatroom"}获取群成员列表
POST /api/get_room_members
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| room_id | string | 是 | 群聊ID |
json
{"room_id": "123456789@chatroom"}创建群聊
POST /api/creat_chat_room
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxids | string | 是 | 成员wxid,多个用逗号分隔(至少2人) |
json
{"wxids": "wxid_xxx,wxid_yyy"}添加群成员
POST /api/add_member_to_chat_room
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| room_id | string | 是 | 群聊ID |
| wxid_list | string | 是 | 要添加的wxid |
json
{"room_id": "123456789@chatroom", "wxid_list": "wxid_xxx"}移除群成员
POST /api/del_member_from_chat_room
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid_list | string | 是 | 要移除的wxid |
| room_id | string | 是 | 群聊ID |
json
{"wxid_list": "wxid_xxx", "room_id": "123456789@chatroom"}设置群公告
POST /api/set_room_announcement_pb
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| roomId | string | 是 | 群聊ID |
| announcement | string | 是 | 公告内容 |
json
{"roomId": "123456789@chatroom", "announcement": "这是群公告内容"}修改群名称
POST /api/mod_chatroom_topic
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid | string | 是 | 群聊ID |
| topic | string | 是 | 新群名称 |
json
{"wxid": "123456789@chatroom", "topic": "新群名称"}聊天设置
置顶聊天
POST /api/set_top
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid | string | 是 | 联系人或群聊wxid |
json
{"wxid": "filehelper"}取消置顶
POST /api/cancel_top
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid | string | 是 | 联系人或群聊wxid |
json
{"wxid": "filehelper"}消息免打扰
POST /api/set_mute_user
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid | string | 是 | 联系人wxid |
json
{"wxid": "filehelper"}加入黑名单
POST /api/black_user
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| wxid | string | 是 | 联系人wxid |
json
{"wxid": "wxid_xxx"}红包/转账
确认转账
POST /api/ten_pay_trans_fer_confirm
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| transferid | string | 是 | 转账交易ID |
| invalid_time | number | 是 | 过期时间戳 |
json
{"transferid": "[transfer_id]", "invalid_time": 1700000000}退还转账
POST /api/un_ten_pay_trans_fer_confirm
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| transferid | string | 是 | 转账交易ID |
| invalid_time | number | 是 | 过期时间戳 |
json
{"transferid": "[transfer_id]", "invalid_time": 1700000000}数据库操作
获取数据库句柄
POST /api/get_db_handle
json
{}执行SQL语句
POST /api/sqlite3_exec
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| db_name | string | 是 | 数据库名称 |
| sql_fmt | string | 是 | SQL语句 |
json
{"db_name": "contact.db", "sql_fmt": "SELECT name FROM sqlite_master WHERE type='table';"}CDN下载
POST /api/cdn_download
imgType: 1=高清图片 2=普通图片 3=略缩图 4=视频 5=文件
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| fileid | string | 是 | CDN文件ID |
| imgType | string | 是 | 文件类型 |
| asekey | string | 是 | AES解密密钥 |
| out | string | 是 | 文件保存路径 |
json
{"fileid": "[file_id]", "imgType": "5", "asekey": "[aes_key]", "out": "C:\\path\\to\\save\\file.xlsx"}其他功能
获取A8Key
POST /api/get_a8key
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| url | string | 是 | 目标URL |
| urlType | string | 是 | URL类型 |
| scene | string | 是 | 场景值 |
json
{"url": "https://...", "urlType": "0", "scene": "0"}获取小程序登录码
POST /api/js_login
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| waId | string | 是 | 小程序AppID |
json
{"waId": "wx1234567890abcdef"}防撤回开关
POST /api/anti_revoke
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| swtich | string | 是 | 开关("true"=开启, "false"=关闭) |
json
{"swtich": "true"}