# security.imgSecCheck
Call this API at the server side. For more information, see Server API.
This API supports Cloud Calls. The WeChat DevTools version must be
1.02.1904090
or later (download the latest stable version here), and thewx-server-sdk
version must be0.4.0
or later.
Checks whether a picture contains illegal or infringing content.
Use Cases:
- Intelligent detection of porn pictures: Detects photos taken by camera-related apps (for example, Mei Pai and photo recognition applications) and uploaded by users, pictures of e-commerce commodities, and pictures in media articles.
- Recognition of sensitive faces: Detects profile photos, pictures in media articles, and photos uploaded by social network users. Frequency limit: Each AppID can be called for a maximum of 2000 times per minute and 200,000 times per day.* (Maximum picture size: 1 MB)
Calling methods:
# HTTPS Call
# Request Address
POST https://api.weixin.qq.com/wxa/img_sec_check?access_token=ACCESS_TOKEN
# Request Parameters
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
access_token | string | Yes | Credentials to call API | |
media | FormData | Yes | The image files to be detected. PNG, JPEG, JPG, and GIF files not larger than 750x1334 pixels are supported. |
# Return Value
# Object
JSON data package that is returned
Property | Type | Description |
---|---|---|
errcode | number | Error code |
errMsg | string | Error message |
Valid values of errcode
Value | Description | Minimum Version |
---|---|---|
0 | Proper content | |
87014 | The picture contains illegal or infringing content. |
Valid values of errMsg
Value | Description | Minimum Version |
---|---|---|
"ok" | Proper content | |
"risky content" | The picture contains illegal or infringing content. |
# Calling Example
curl -F media=@test.jpg 'https://api.weixin.qq.com/wxa/img_sec_check?access_token=ACCESS_TOKEN'
# Cloud Call
Cloud call is a capability provided by Mini Program·Cloud Base that allows you to call WeChat APIs in a cloud function. It must be used via
wx-server-sdk
in the cloud function.
# API Calling Method
openapi.security.imgSecCheck
You need to configure the permissions for the
security.imgSecCheck
API viaconfig.json
. Details
# Request Parameters
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
media | FormData | Yes | The data of the media file |
media is composed as follows
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
contentType | string | Yes | The data type. It is MIME type. | |
value | Buffer | Yes | The file buffer |
# Return Value
# Object
JSON data package that is returned
Attribute | Type | Description |
---|---|---|
errCode | number | Error code |
errMsg | string | Error message |
Valid values of errCode
Value | Description | Minimum Version |
---|---|---|
0 | Succeeded |
# Exceptions
# Object
Thrown Exceptions
Property | Type | Description |
---|---|---|
errCode | number | Error code |
errMsg | string | Error message |
Valid values of errCode
Value | Description | Minimum Version |
---|---|---|
87014 | The picture contains illegal or infringing content. |
Valid values of errMsg
Value | Description | Minimum Version |
---|---|---|
"ok" | Proper content | |
"risky content" | The picture contains illegal or infringing content. |
# SDK Calling Example
// cloud = require('wx-server-sdk')
// ...
// The method returns Promise
cloud.openapi.security.imgSecCheck({
media: {
contentType: 'image/png',
value: Buffer
}
})