Single Image Synchronous Moderation

Parameter Specification

  • Request URL:

https://isafe.ilivedata.com/api/v2/image/check

  • Image requirements:

    • Supported types: URL, BASE64
    • Supported formats: jpg, png, bmp, gif, webp, tiff, heic
    • Supported image size: < 10M
    • Description of gif/long image: Automatically cut gif/long image (ratio of length and width greater than 5) into frames and check, up to 5 images. Gif/long images are billed according to the actual number of screenshots.
  • HTTP request Header:

Header Value Description
Content-Type application/json;charset=UTF-8 Request body type
Accept application/json;charset=UTF-8 Return type accepted
X-AppId The unique identifier of the project, from Console - Service Configuration
X-TimeStamp The UTC timestamp of the request, formatted per W3C, e.g. 2010-01-31T23:59:59Z. (http://www.w3.org/TR/xmlschema-2/#dateTime)
Authorization Signature value
  • Request method: POST

  • Request body JSON object:

Parameter Required Type Description
type Required Number Image content type: 1: image URL; 2: image BASE64 value.
Note: If the image resource and the moderation service are not in the same region, BASE64 is recommended. Image URL may cause slow download or download failure under poor network.
image Required String Image content. When type=1 it is the image URL; when type=2 it is the image BASE64 value.
strategyId Optional String Strategy ID; uses default strategy DEFAULT when not provided
checkTags Optional List<Number> Restrict detection categories. Supports first-level categories enabled in the strategy; categories not enabled in the strategy are ignored
referImage Optional String Reference image for face comparison. The type must match image (if image is a URL, referImage must also be a URL). Supported formats: jpg, png; size < 10M
userId Optional String Unique end user ID, no more than 32 characters
extra Optional json Extension fields transparently passed through, multiple key/value pairs. e.g. "extra": {"server": "123", "version": "456"}. No more than 20 key/value pairs; a single key must not be nested more than 3 levels deep. If exceeded, the audit log will not record the extra value for this task, but extra transparent passthrough in the response is unaffected
  • Example of request body:
{
  "type": 1,
  "image": "http://abc.com/a.jpg",
  "strategyId": "DEFAULT",
  "userId": "testUser",
  "checkTags": [100, 200],
  "extra": { "server": "123", "version": "456" }
}
  • Request signature:

This API requires the Authorization signature in the request Header. For the signature calculation rule, see Request Signature.

HTTP Response

Content-Type: application/json;charset=UTF-8

The result is in JSON format.

  • Top-level fields:
Parameter Type Description
errorCode Number Error code: 0 success; 100001: image download failed; 100002: image format error
errorMessage String Error message
result Number Moderation result: 0: pass; 1: review; 2: reject
taskId String Task ID
mediaType String Image media type, e.g. image/jpeg, image/png, image/gif, image/webp, image/bmp, image/heic
snapshotUrl String Image snapshot address generated by this audit
imageSpams json object Violation detection details, see imageSpams (omitted when no violation is detected)
ocr json object Recognized text content, see ocr (not returned by default; enable the switch in console to return)
personInfo json object Human/face/gender detection result, see personInfo
labels json array Label info, see labels
extra json Extension fields passed through from the request

imageSpams

Parameter Type Description
tags json array Hit category list, see tags

tags

Parameter Type Description
tag Number First-level category code: 100:politics, 110:violence, 120:contraband, 130:porn, 140:sexy, 150:ad, 160:values, 180:minors, 200:qrcode, 230:no-face-idle, 232:image-quality, 300:icon, 400:text-image, 666:disgusting, 800:label, 888:face-compare, 900:other, 999:user-defined
level Number Category level: 0: normal; 1: suspected; 2: abnormal
confidence Number Confidence score, 0-100. 100 is the highest. When level is suspected/abnormal, higher confidence means more likely hit
nameZh String First-level category name (Chinese)
nameEn String First-level category name (English)
wordList List<String> Violating text returned when text-image is hit (tag=400)
subTags json array Second-level categories, see subTags

subTags

Parameter Type Description
subTag Number Second-level category code, see Category Code Table
level Number Category level: 0: normal; 1: suspected; 2: abnormal
confidence Number Confidence score, 0-100
nameZh String Second-level category name (Chinese)
nameEn String Second-level category name (English)
wordList List<String> Violating text returned when text-image is hit (tag=400)
terTags json array Third-level categories, see terTags (returned when the third-level tag switch is enabled in the console)

terTags

Parameter Type Description
terTag Number Third-level category code
level Number Category level: 0: normal; 1: suspected; 2: abnormal
confidence Number Confidence score, 0-100
nameZh String Third-level category name (Chinese)
nameEn String Third-level category name (English)
wordList List<String> Violating text returned when text-image is hit (tag=400)

ocr

Parameter Type Description
text List<String> OCR recognized text list

personInfo

Parameter Type Description
genders json array Face gender and confidence, see genders
human json object Human count result, example: {"number": 12}
face json object Face count result, example: {"number": 7}

genders

Parameter Type Description
gender String Gender: male / female
confidence Number Gender confidence, 0-100

labels

Parameter Type Description
id String Unique label ID
score Number Model score, higher means higher confidence
nameZh String Label name (Chinese)
nameEn String Label name (English)
  • Example of response:
{
  "errorCode": 0,
  "result": 2,
  "taskId": "ap_634e686ef7e54447af7463f4dd060d6d_1783514588456",
  "mediaType": "image/jpeg",
  "snapshotUrl": "https://cos.example.com/path/to/dumped-image.jpg",
  "imageSpams": {
    "tags": [
      {
        "tag": 100,
        "level": 2,
        "confidence": 90,
        "nameZh": "涉政",
        "nameEn": "politics",
        "subTags": [
          {
            "subTag": 100001,
            "level": 2,
            "confidence": 90,
            "nameZh": "政治人物",
            "nameEn": "political_figure",
            "terTags": [
              {
                "terTag": 100001001,
                "level": 2,
                "confidence": 90,
                "nameZh": "具体政治人物",
                "nameEn": "specific_political_figure"
              }
            ]
          }
        ]
      }
    ]
  },
  "ocr": {
    "text": ["苗华", "赵四"]
  },
  "personInfo": {
    "genders": [
      { "gender": "male", "confidence": 90 }
    ],
    "human": { "number": 12 },
    "face": { "number": 7 }
  },
  "labels": [
    {
      "id": "800001007",
      "score": 31,
      "nameZh": "人脸数",
      "nameEn": "face_num"
    }
  ],
  "extra": {}
}

Error Codes

See Common Exception Codes in Help Center