Quickstart Guide

Content moderation provides external RESTful API services. See the API List below.

1. Access Domain

Service access is realized through domain name resolution. Regional access domain names are as follows:

RegionDomain Name

For other regions, contact customer support.

2. Request Structure

RESTful API HTTP requests use JSON format. The JSON structure varies depending on the service request. See details in API List; click on an API's name for its definition.
To ensure the clarity and security of API communication, request path format and communication method definitions are provided below:

Request Path

The request path differentiates moderation services. For details on all service access paths, see the API Listand click on a API for its definition.
Take the synchronous image content moderation API path as an example; its full request path is https://ai.jocloud.com/app/123456/v1/image/sync?traceId=bd526528-c0d7-4aa4-803b-f5a3fdc05805


  • ai.jocloud.com specifies this particular API's service access domain name;
  • 123456789 is the service ID;
  • v1 is the API version (the current version is v1);
  • /image/sync is the URL of the specific service—i.e. of the synchronous image content moderation API;
  • traceId=bd526528-c0d7-4aa4-803b-f5a3fdc05805 specifies a trace ID for the user to differentiate requests.

Communication Protocol

All APIs send requests by HTTPS protocol. Using HTTP requests will prompt a response to convert to HTTPS.

Character Encoding

Both the request and its return are encoded in UTF-8.

Request Parameters

Enter request parameters into the request body in JSON format. For service parameter details, see the API introduction page.

3. Identity Authentication

Before using the RESTful API, fill in the token field in the HTTP request's header for authentication. This document provides sample code for generating the token field with Java or Go. Refer to the code for the corresponding token values.

You will need to enter the certificate ID and certificate key into the code. To obtain these, log in and navigate to My Center. Click on your account name in the upper righthand corner, then select "API Certificate" from the drop-down menu.

The following is a sample code for Java and python to generate the token field.

Java sample code
Python sample code

4. API List

AI moderation currently supports images, text, audio files and video files, providing API URL-based HTTPS POST requests:

Moderation ObjectFunctionDescription
ImageImage ModerationDetect any illegal content in images
AudioVoice ModerationDetect any illegal content in voice clips
TextText ModerationDetect any illegal content in text passages
VideoVideo ModerationDetect any illegal audio or video content in video clips
StreamStream ModerationDetect any illegal content in real-time audio and/or video streams
Live StreamingLive Streaming ModerationDetect any illegal content within Jocloud's live streaming system

Image Moderation

APIDetection ModeDefault ConcurrencyDescription
app/{appid}/v1/image/syncSynchronous20Synchronous image moderation

Voice Moderation

APIDetection ModeDefault ConcurrencyDescription
app/{appid}/v1/audio/syncSynchronous20Synchronous voice moderation
app/{appid}/v1/audio/asyncAsynchronous20Asynchronous voice moderation

Text Moderation

APIDetection ModeDefault ConcurrencyDescription
app/{appid}/v1/text/syncSynchronous20Synchronous text moderation

Video Moderation

APIDetection ModeDefault ConcurrencyDescription
app/{appid}/v1/video/asyncAsynchronous20Asynchronous video moderation

Stream Moderation

APIDetection ModeDefault ConcurrencyDescription
app/{appid}/v1/video/liveReal-time20Real-time audio/video stream moderation

Live Streaming Moderation

APIDetection ModeDefault ConcurrencyDescription
app/{appId}/v1/ai/audio/liveReal-time20Jocloud Audio Interaction moderation
app/{appId}/v1/ai/video/live/Real-time20Jocloud Video Interaction moderation

5. Response Result

All response result is JSON format

example of result

  "code": 200,          // error code for request
  "message": "OK",
  "traceId": "817ac1c0-7875-41ee-9bea-7edc7d2e9285",
  "requestId": "21028cd6-8d9a-448c-acf6-54a17429b2ad",
  "timestamp": 1590548848,
  "data": [
    {                   // result info of every data in request
      "code": 200,      // error code for data
      "message": "OK",
      "dataId": "sex.jpg",
      "taskId": "af65f1ab-df37-440b-a550-5eab48e87774",
      "results": [
        {               // result info of every action
          "code": 200,  // error code for action
          "message": "OK",
          "action": "porn",
          "label": "sexy",
          "rate": 0.9660250544548035,
          "suggestion": "block"

Error code in request

400IndeterminacyRequest content parsing exception or parameter error
429Too many requestsRequest exceeded traffic limit

Error code in data and action

400IndeterminacyGeneral is input exception
401Download data from URL failedData download failed
402Decode BASE64 data failedData Base64 decoding failed
403Input too largeThe incoming data is too large
410Audio decode failedAbnormal audio decoding
411Input audio too longAudio duration is too long
412Convert audio to text failedAudio to text failed
413Audio check failedAudio recognition failure
420Image decode failedAbnormal picture decoding
421Image check failedPicture recognition failure
500IndeterminacyInternal service exception
503Service temporarily unavailableService temporarily unavailable

Annex 1: Authentication Example Code

Sample Code in Java

String restfulId = "qawsedrftg";        // Your Certificate ID
String restfulSecret = "abcdefghijk";   // Your Certificate Key

// Generate token
String plainIDSecret = restfulId + ":" + restfulSecret;
String base64IDSecret = new String(Base64.encodeBase64(plainIDSecret.getBytes("UTF-8")));

// Generate request object and add token information to request header
Request request = new Request.Builder()
    .addHeader("token", "Basic " + base64IDSecret)

Sample Code in Python

import requests
import base64

appid = 123456                 # Your Service id
restful_id = 'qawsedrftg'      # Your certificate ID
restful_secret = 'abcdefghijk' # Your certificate key

# Fill in http header
headers = {
    "content-type": "application/json"
# Generate Token
auth = base64.b64encode(("%s:%s" % (restful_id, restful_secret)).encode('utf-8'))
headers['token'] = 'Base ' + str(auth,'utf-8')

# request
url = "https://ai.jocloud.com/app/123456/v1/image/sync?traceId=bd526528-c0d7-4aa4-803b-f5a3fdc05805"
body = {}
res = requests.post(url, json=body, headers=headers)

Annex 2: Moderation Flowchart

Synchronous Detection


Asynchronous Detection


Real-Time Tasks Detection


Was this page helpful?

Helpful Not helpful
Submitted! Your feedback would help us improve the website.