准备工作
先在主站申请 API 凭据
登录 RedLine,打开“微信授权 → API接口”。AppSecret 可以随时重置。重置后旧 AppSecret 立即失效。
所有接口
在请求头中携带凭据
AppKey: RL-A1B2C3
AppSecret: RLS-XXXXXXXXXXXXXXXXXX
Content-Type: application/json
请求头名称不区分大小写。缺失或错误的凭据统一返回 HTTP 401。
GET
wxauth
/api/wmpf/wxauth查询账户的积分、微信配额、今日调用额度和微信账号。默认包含离线账号;在URL中添加 ?valid_only=true 只返回当前有效账号。本接口免费且不占每日次数。
import requests
response = requests.get(
"https://wechat.316199.xyz/api/wmpf/wxauth",
params={"valid_only": "true"},
headers={
"AppKey": "你的 AppKey",
"AppSecret": "你的 AppSecret",
},
timeout=30,
)
result = response.json()
for account in result.get("data", {}).get("accounts", []):
print(account["remark"], account["wxid"], account["is_valid"])
查看返回结构
{
"success": true,
"message": "微信授权信息获取成功",
"data": {
"user": { "username": "demo", "points": 120.5 },
"quota": 2,
"used": 1,
"accounts": [{
"remark": "常用微信",
"wxid": "wxid_xxx",
"nickname": "昵称",
"status": "online",
"is_valid": true
}],
"billing": {
"billing_date_cn": "2026-08-08",
"free_quota": 3,
"used_success_count": 0,
"over_quota_cost_points": 10
}
}
}POST
getcode
/api/wmpf/getcode调用JSLogin接口获取指定小程序的登录 code。
wxid从 wxauth 返回中选择,只能使用自己的账号appid目标小程序 AppIDcurl -X POST "https://wechat.316199.xyz/api/wmpf/getcode" \
-H "AppKey: 你的 AppKey" \
-H "AppSecret: 你的 AppSecret" \
-H "Content-Type: application/json" \
-d '{"wxid":"wxid_xxx","appid":"wx1234567890abcdef"}'POST
getuserinfo
/api/wmpf/getuserinfo调用GetUserInfo,返回 rawData、signature、encryptedData 和 iv。
{
"wxid": "wxid_xxx",
"appid": "wx1234567890abcdef"
}POST
getphone
/api/wmpf/getphone调用GetPhone,返回手机号、phone_code 与授权状态。
result = requests.post(
"https://wechat.316199.xyz/api/wmpf/getphone",
headers={"AppKey": APP_KEY, "AppSecret": APP_SECRET},
json={"wxid": WXID, "appid": APPID},
timeout=30,
).json()
print(result.get("data", {}).get("mobile"))POST
getwxdata
/api/wmpf/getwxdata调用JSOperateWxData。data.api_name 必填,data.data 按目标微信 API 的协议填写。
{
"wxid": "wxid_xxx",
"appid": "wx1234567890abcdef",
"data": {
"api_name": "webapi_getuserencryptkey",
"data": {}
},
"opt": 0
}成功才结算
每日免费次数与积分
3普通用户
6钻石会员
10尊享会员
+2已绑定妖火
四个操作接口共享上述额度。额度用完后,每次成功调用扣 10 积分;积分不足时在请求 WMPF 前返回 402。参数错误、账号无权使用、账号离线或接口调用失败均不会扣除积分或免费次数。计费信息仅由 wxauth 接口返回。
{
"success": true,
"message": "获取 code 成功",
"data": { "code": "WMPF 返回的 Data" }
}排查问题
状态码与处理方式
400请求参数错误,或微信账号已离线
401AppKey 或 AppSecret 无效
402免费次数已用完且积分不足
403wxid 不属于当前凭据对应的用户,或用户已被封禁
413请求体超过 64KiB
502WMPF 暂时不可用、超时或返回异常
{
"success": false,
"message": "该 wxid 不属于当前用户",
"error_code": "ACCOUNT_FORBIDDEN"
}