Blacklist Management API
Back

From WeChat Official Account Admin Platform
Jump to: navigation, search

Official accounts can blacklist followers after logging in to the WeChat Official Account Admin Platform. In addition, a set of blacklist management APIs are provided for developers to directly manage the blacklist.


Obtaining the Blacklist of an Official Account

This API can be used to obtain the blacklist of an official account. The blacklist is composed of many OpenIDs (encrypted WeChat accounts). The OpenID of each user is unique for each official account. This API pulls up to 10,000 OpenIDs every time and must be called multiple times when there are more OpenIDs.


Request Description

HTTP request method: POST (Use Https protocol)
https://api.wechat.com/cgi-bin/tags/members/getblacklist?access_token=ACCESS_TOKEN
POST data format: JSON
{"begin_openid":"OPENID1"}

When 'begin_openid' is empty, the data is pulled from the beginning by default.

An example of a successful JSON response is as follows:

{
"total":23000,
 "count":10000,
 "data":{"
    openid":[
       "OPENID1",
       "OPENID2",
       ...,
       "OPENID10000"
    ]
  },
  "next_openid":"OPENID10000"
}


An example of a failure JSON response is as follows:

{"errcode":40013,"errmsg":"invalid appid"}

Error Codes

Error Code Description
-1 System busy
40003 Invalid OpenID imported
49003 Imported OpenID does not match the AppID

Please also note:

When the number of blacklisted users of an Official Account exceeds 10,000, you can meet your demand by filling in the value of next_openid to obtain the list several times. Specifically, when the API is called, the value of next_openid returned in the current calling is used as the value of next_openid in the next calling.


Block users

An Official Account can block a batch of users through this API. The blacklist consists of a series of OpenIDs (encrypted WeChat IDs, each user has a unique OpenID corresponding to each Official Account).

Request Description

HTTP request method: POST (Use Https protocol)
https://api.wechat.com/cgi-bin/tags/members/batchblacklist?access_token=ACCESS_TOKEN

Parameter Description

Parameter Required Description
access_token Yes The certificate for the calling API
openid_list Yes Up to 20 OpenIDs can be blacklisted at a time
POST data format: JSON
Example:{"opened_list":["OPENID1”,” OPENID2”]}


An example of a successful JSON response is as follows:

{
"errcode": 0,
"errmsg": "ok"
}

An example of a failure JSON response is as follows:

{"errcode":40013,"errmsg":"invalid appid"}

Error Codes

Error Code Description
-1 System busy
40003 Invalid OpenID imported
49003 Imported OpenID does not match the AppID
40032 Up to 20 users can be blocked at a time


Unblock users

An Official Account can unblock a batch of users through this API. The blacklist consists of a series of OpenIDs (encrypted WeChat IDs, each user has a unique OpenID corresponding to each Official Account).

Request Description

HTTP request method: POST (Use Https protocol)
https://api.wechat.com/cgi-bin/tags/members/batchunblacklist?access_token=ACCESS_TOKEN


Parameter Description

Parameter Required Description
access_token Yes The certificate for the calling API
openid_list Yes Up to 20 OpenIDs can be blacklisted at a time
POST data format: JSON
Example:{"opened_list":["OPENID1”,” OPENID2”]}


An example of a successful JSON response is as follows:

{
"errcode": 0,
"errmsg": "ok"
}

An example of a failure JSON response is as follows:

{"errcode":40013,"errmsg":"invalid appid"}

Error Codes

Error Code Description
-1 System busy
40003 Invalid OpenID imported
49003 Imported OpenID does not match the AppID
40032 Up to 20 users can be blocked at a time
Developer Guide
Custom-defined Menu
WeChat JS-SDK