This API is used to obtain the Official Account's follower list, which consists of a batch of OpenIDs (an OpenID is an encrypted Weixin ID that is unique to each user for each Official Account). You can fetch the list multiple times. A maximum of 10,000 follower OpenIDs can be fetched at a time.
API Request Format
HTTP request method: GET (use the HTTPS protocol)
https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID
Parameter | Required | Description |
---|---|---|
access_token | Yes | The credential for calling the API |
next_openid | Yes | The first OpenID to be fetched. If it is left empty, the list is fetched from the beginning. |
Response
The JSON packet returned for a successful request:
{
"total":2,
"count":2,
"data":{
"openid":["OPENID1","OPENID2"]},
"next_openid":"NEXT_OPENID"
}
Parameter | Description |
---|---|
total | Total number of the Official Account followers |
count | Number of the OpenIDs to be fetched. Maximum is 10,000. |
data | List data (list of OpenIDs) |
next_openid | The OpenID of the last user in the fetched list. |
The JSON packet returned for a failed request (in this case, the error is caused by an invalid AppID):
{"errcode":40013,"errmsg":"invalid appid"}
Note:
When the number of the Official Account followers exceeds 10,000, you can fetch the list multiple times by entering the value of next_openid.
When the API is called, the next_openid value in the response for the previous request is used as the next_openid value in the current request.
Example:
The Official Account A has 23,000 followers. If you want to obtain the list of all followers, call this API multiple times using the following request URLs: https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN Response:
{
"total":23000,
"count":10000,
"data":{"
openid":[
"OPENID1",
"OPENID2",
...,
"OPENID10000"
]
},
"next_openid":"OPENID10000"
}https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID1 Response:
{
"total":23000,
"count":10000,
"data":{
"openid":[
"OPENID10001",
"OPENID10002",
...,
"OPENID20000"
]
},
"next_openid":"OPENID20000"
}https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID2 Response: (When all the followers are returned, the next_openid returned is null):
{
"total":23000,
"count":3000,
"data":{"
"openid":[
"OPENID20001",
"OPENID20002",
...,
"OPENID23000"
]
},
"next_openid":"OPENID23000"
}