Skip to content
POST{BASE_URL}/wx-api/api/contact/getSyncList
只读实测 2026-09-06联系人JSON · Bearer App Token · body appid

同步通讯录 ID 列表

拉取内部通讯录(成员 + 部门)的「节点列表 + 游标」,是通讯录同步的第一步。

说明与注意

  • 响应 data 包含 changeneedFullUpdatesvrVersionnodeList 列表。

请求参数

参数必填类型说明
appidstring实例 appid,标识操作哪个已登录账号。示例:we_xxxxxxxxxxxxxxx
svrVersion增量时必填string增量版本号,首次传空

请求示例

http
POST {BASE_URL}/wx-api/api/contact/getSyncList
Authorization: Bearer <你的 App Token>
Content-Type: application/json

{
  "appid": "we_xxxxxxxxxxxxxxx",
  "svrVersion": ""
}
bash
curl -X POST '{BASE_URL}/wx-api/api/contact/getSyncList' \
  -H 'Authorization: Bearer <你的 App Token>' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "appid": "we_xxxxxxxxxxxxxxx",
  "svrVersion": ""
}'
python
import requests

url = "{BASE_URL}/wx-api/api/contact/getSyncList"
headers = {"Authorization": "Bearer <你的 App Token>", "Content-Type": "application/json"}
body = """{
  "appid": "we_xxxxxxxxxxxxxxx",
  "svrVersion": ""
}"""

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}/wx-api/api/contact/getSyncList";
String body = "{\n" +
    "  \"appid\": \"we_xxxxxxxxxxxxxxx\",\n" +
    "  \"svrVersion\": \"\"\n" +
    "}";

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
    .header("Authorization", "Bearer <你的 App Token>")
    .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}/wx-api/api/contact/getSyncList';
$body = <<<'JSON'
{
  "appid": "we_xxxxxxxxxxxxxxx",
  "svrVersion": ""
}
JSON;

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

响应示例

json
{
  "code": 0,
  "data": {
    "change": true,
    "needFullUpdate": true,
    "svrVersion": "7681680474451738625_7681681438009196545_3_7223956814780432385_2_7681681438009196545_0",
    "nodeList": [
      {
        "type": 2,
        "partyId": 1688856489464990,
        "seq": 7223519559452459009
      },
      {
        "type": 1,
        "vid": 1688856489464987,
        "partyId": 1688857448448992,
        "seq": 7231081125865586689
      }
    ],
    "corpScale": 1
  },
  "detail": "",
  "message": "ok",
  "time": "2026-09-06 11:12:58"
}

响应字段

响应字段(13 项)
字段类型说明
codeint64统一封套状态码:0=成功,负数=失败
dataobject业务数据
data.changeboolean相较上次是否有变化
data.needFullUpdateboolean是否需要全量更新(通常首次为 true
data.svrVersionstring增量版本号;首次传空串=全量,之后回传上次返回值=增量
data.nodeListarray<object>通讯录节点列表
data.nodeList[].typeint641 成员(带 vid)、2 部门
data.nodeList[].partyIdint64部门/组织 id
data.nodeList[].seqint64同步游标(增量翻页位置)
data.corpScaleint64企业规模标识,含义待确认
detailstring附加明细,通常为空
messagestring文案:成功为 ok;失败形如 -码|描述
timestring服务端处理时间 YYYY-MM-DD HH:MM:SS

下一步