Skip to content
POST{BASE_URL}/api/room/sessionQueryList
只读已实测群JSON · Bearer 调用凭证 · body appid

查询置顶 / 免打扰会话 ​

查询当前账号置顶、免打扰的会话(部分账号还有收藏)。

说明与注意 ​

  • 没有数据的列表不会出现在返回里,解析时每个键都要判空。
  • remoteId 用 BigInt 或 json-bigint 解析,不要转成 Number。

请求参数 ​

参数必填类型说明
appid是string实例 appid,标识操作哪个已登录账号。示例:we_xxxxxxxxxxxxxxx

请求示例 ​

http
POST {BASE_URL}/api/room/sessionQueryList
Authorization: Bearer <你的调用凭证>
Content-Type: application/json

{
  "appid": "we_xxxxxxxxxxxxxxx"
}
bash
curl -X POST '{BASE_URL}/api/room/sessionQueryList' \
  -H 'Authorization: Bearer <你的调用凭证>' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "appid": "we_xxxxxxxxxxxxxxx"
}'
python
import requests

url = "{BASE_URL}/api/room/sessionQueryList"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = """{
  "appid": "we_xxxxxxxxxxxxxxx"
}"""

resp = requests.post(url, headers=headers, data=body.encode("utf-8"))
print(resp.text)
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

String url = "{BASE_URL}/api/room/sessionQueryList";
String body = "{\n" +
    "  \"appid\": \"we_xxxxxxxxxxxxxxx\"\n" +
    "}";

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
    .header("Authorization", "Bearer <你的调用凭证>")
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(body))
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
php
<?php

$url = '{BASE_URL}/api/room/sessionQueryList';
$body = <<<'JSON'
{
  "appid": "we_xxxxxxxxxxxxxxx"
}
JSON;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer <你的调用凭证>',
    'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;

响应示例 ​

json
{
  "code": 0,
  "data": {
    "shieldSessions": [
      {
        "conversationType": 1,
        "remoteId": 10786447466811918,
        "remainTime": -1,
        "forwardId": 0,
        "foldState": 1
      },
      {
        "conversationType": 3,
        "remoteId": 10031,
        "remainTime": -1,
        "forwardId": 0,
        "foldState": 0
      }
    ],
    "topSessions": [
      {
        "conversationType": 1,
        "remoteId": 10786447466811918,
        "forwardId": 0
      }
    ]
  },
  "detail": "",
  "message": "ok",
  "time": "2026-11-10 14:57:17"
}

响应字段 ​

响应字段(16 项)
字段类型说明
codeint64统一封套状态码:0=成功,负数=失败
dataobject会话组
data.shieldSessionsarray<object>免打扰的会话;没有时不返回
data.shieldSessions[].conversationTypeint640 好友单聊、1 群;其他值是企微内部会话,跳过
data.shieldSessions[].remoteIdint64会话对端 id:群是 roomId,单聊是对方 userId
data.shieldSessions[].forwardIdint64转发来源 id,通常为 0
data.shieldSessions[].remainTimeint64示例里为 -1,原样保存即可
data.shieldSessions[].foldStateint64折叠状态,0 或 1
data.topSessionsarray<object>置顶的会话;没有时不返回
data.topSessions[].conversationTypeint640 好友单聊、1 群;其他值是企微内部会话,跳过
data.topSessions[].remoteIdint64会话对端 id:群是 roomId,单聊是对方 userId
data.topSessions[].forwardIdint64转发来源 id,通常为 0
data.collectSessionsarray<object>收藏的会话;部分账号才返回
detailstring附加明细,通常为空
messagestring文案:成功为 ok;失败形如 -码|描述
timestring服务端处理时间 YYYY-MM-DD HH:MM:SS

下一步 ​