Detect URL risk with Content Moderation-Plus

更新时间:
复制 MD 格式

Content Moderation-Plus provides enhanced detection to identify risks such as fraud, sexual content, and gambling in third-party URLs, safeguarding your platform's content ecosystem. This topic describes the services available in Content Moderation-Plus for URL risk detection and how to use them.

Features

Content Moderation-Plus provides the following moderation services to support URL risk detection. Choose the service that best fits your business needs based on its distinct use cases and features.

Use case

Supported service

Description

Ideal for user chat or comment scenarios that require identifying risks in both text and embedded URLs.

Service name: Comment Detection

Service: comment_detection

  • This service extracts and detects URLs within text content.

  • If the service identifies a risky URL, it returns the contraband risk label. For more information, see Use Content Moderation-Plus to detect text compliance risks.

  • In this use case, content is primarily text-based, so risk features from the text are weighted more heavily.

  • This service does not return basic information about the URL.

Suitable for scenarios where you need to detect risks in standalone URLs, such as in-app browsers, URL publishing or sharing features, and URLs within SMS messages.

Service name: URL risk detection

Service: url_detection

  • This topic focuses on the response parameters for this service, which differ from other text moderation services.

  • This service is designed exclusively for detecting standalone URLs. The input must be a valid URL and cannot be mixed with other text.

  • The service analyzes risks based on a proprietary database of URLs and site information. If the service finds a risky URL, it returns risk labels for categories such as fraud, gambling, or sexual content, and provides basic information about the URL.

Detection capabilities

The Content Moderation-Plus URL detection service uses the following label structure to identify URL risks and return basic information about the URL.

Capability

Description

Risk labels

  • sexual_url: Suspected sexual content website

  • gambling_url: Suspected gambling website

  • phishing_url: Suspected phishing website

  • other_risk_url: Website suspected of fraud or other risks

  • unmarked_url: Unmarked or safe website

Basic information

  • icpType: ICP filing type

  • icpNo: ICP filing number

Supported URL format

The Content Moderation-Plus URL detection service supports URLs that conform to the following format: http(s)://{IP or domain name}{:port}{/path}

Note
  1. The URL can be provided with or without the http:// or https:// prefix.

  2. The domain name consists of letters and numbers separated by periods (.). The top-level domain must be 2 to 6 letters long.

  3. The port number can be 1 to 4 digits.

  4. The path can contain letters, numbers, and common characters such as _!~*'().;?:@&=+$,%#-), but not Chinese characters.

If an input URL does not conform to this format, the API returns the BAD_REQUEST (400) error code.

Billing

Content Moderation-Plus supports pay-as-you-go and resource plan billing.

Pay-as-you-go

After you enable Content Moderation-Plus, the service defaults to pay-as-you-go billing. You are charged daily based on actual usage, and no fees are incurred if you do not use the service.

Moderation type

Supported service

Unit price

Text Moderation Standard (text_standard)

URL risk detection: url_detection

CNY 7.50 per 10,000 requests

Resource plan

If you have a large or consistent volume of moderation tasks, we recommend that you purchase a resource plan in advance. Larger resource plans offer greater discounts. You can purchase and use multiple resource plans. For more information, see Purchase a resource plan for Content Moderation-Plus.

This resource plan covers usage of Content Moderation-Plus and cannot be shared with resource plans for Content Security. The specific deduction factors are as follows:

Moderation type

Supported service

Deduction factor

Text Moderation Standard (text_standard)

URL risk detection: url_detection

A deduction factor of 1 means that each successful API call consumes 1 call from your resource plan.

For example, if you purchase a resource plan with a capacity of 10 calls, one successful API call consumes 1 call, leaving a remaining balance of 9 calls.

Get started

Step 1: Enable the service

Visit the Enable Service page to enable Content Moderation-Plus.

After you enable Content Moderation-Plus, the default billing method is pay-as-you-go. You are charged based on your actual usage, and fees are settled daily. No fees are incurred if you do not use the service. After you integrate the API, the system automatically generates bills based on your usage. For more information, see Billing. You can also purchase resource plans, which offer tiered discounts and are ideal for users with predictable or high-volume usage.

Step 2: Grant permissions to a RAM user

Before you integrate an SDK or API, you must grant permissions to a RAM user. You can create an AccessKey for your Alibaba Cloud account or a RAM user. You must use the AccessKey for authentication when you call Alibaba Cloud APIs. For more information, see Obtain an AccessKey.

Procedure

  1. Log on to the RAM console with your Alibaba Cloud account.

  2. Create a RAM user.

    For details, see Create a RAM user.

  3. Grant the AliyunYundunGreenWebFullAccess system policy to the RAM user.

    After completing these steps, you can call the Content Moderation API as the RAM user.

Step 3: Install and integrate an SDK

The service is available in the regions listed below. For SDK integration, refer to Get started and the Content Moderation-Plus 2.0 SDK and integration guide.

Region

Public endpoint

Internal endpoint

China (Shanghai)

green-cip.cn-shanghai.aliyuncs.com

green-cip-vpc.cn-shanghai.aliyuncs.com

China (Beijing)

green-cip.cn-beijing.aliyuncs.com

green-cip-vpc.cn-beijing.aliyuncs.com

China (Hangzhou)

green-cip.cn-hangzhou.aliyuncs.com

green-cip-vpc.cn-hangzhou.aliyuncs.com

China (Shenzhen)

green-cip.cn-shenzhen.aliyuncs.com

green-cip-vpc.cn-shenzhen.aliyuncs.com

China (Chengdu)

green-cip.cn-chengdu.aliyuncs.com

Not available

API

Usage

Service endpoint: https://green-cip.{region}.aliyuncs.com.

Call this API to create a text content detection task. For information about how to construct an HTTP request, see Request structure. You can also use a pre-constructed HTTP request. For more information, see Get started.

  • Billing:

    This pay-as-you-go API bills only for successful requests that return an HTTP 200 status code. Requests that result in other status codes are not billed. For more information about billing, see Billing.

QPS limit

The QPS limit for this API is 100 queries per second (QPS) per user. If this limit is exceeded, API calls are throttled, which may affect your business.

Request parameters

Parameter

Type

Required

Example

Description

Service

String

Yes

url_detection

The type of moderation service. Valid value:

  • url_detection: URL risk detection

ServiceParameters

JSONString

Yes

A JSON string that contains the parameters required for the service. For field descriptions, see the following table.

Table 1. ServiceParameters

Parameter

Type

Required

Example

Description

content

String

Yes

http://example.com

The URL to be moderated. Maximum length: 600 characters.

accountId

String

No

10123****

The unique ID of an account.

deviceId

String

No

20240307****

The unique ID of a device.

deviceToken

String

No

MzQvo1d7scyZ3tl_RcJ******

The device token obtained from the Risk Control SDK.

Response parameters

Parameter

Type

Example

Description

Code

Integer

200

The status code. For more information, see Status codes.

Data

JSONObject

{"labels":"sexual_url","reason":"..."}

The moderation result data. For more information, see Data.

Message

String

OK

The response message.

RequestId

String

AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****

The request ID.

Table 2. Data

Parameter

Type

Example

Description

Labels

String

sexual_url

The risk labels. Multiple labels are separated by commas (,). Valid values:

  • sexual_url: Suspected sexual content website

  • gambling_url: Suspected gambling website

  • phishing_url: Suspected phishing website

  • other_risk_url: Website suspected of fraud or other risks

  • unmarked_url: Unmarked or safe website

Reason

String

{\"icpType\":\"Enterprise\",\"icpNo\":\"ICP123XXXX789\",\"score\":\"90\"}

A JSON string that contains the following additional information:

  • icpType: The ICP filing type.

  • icpNo: The ICP filing number.

  • score: The risk score.

AccountId

String

10123****

The account ID.

Note

This parameter is returned if you specified accountId in the request.

DeviceId

String

20240307****

The device ID.

Note

This parameter is returned if you specified deviceId in the request.

Examples

Sample request

{
    "Service": "url_detection",
    "ServiceParameters": {
        "content": "http://aliyun.com/abc",
        "accountId": "10123****"
    }
}

Sample success response

{
    "Code": 200,
    "Data": {
        "Labels": "unmarked_url",
        "Reason": "{\"icpType\":\"Enterprise\",\"icpNo\":\"ICP123XXXX789\",\"score\":\"60\"}"
    },
    "Message": "OK",
    "RequestId": "AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****"
}

Status codes

Code

Status code

Description

200

OK

The request was successful.

400

BAD_REQUEST

The request is invalid, likely due to incorrect request parameters. Check the parameters and retry.

407

NOT_SUPPORT

The language is not recognized or supported.

408

PERMISSION_DENY

Permission denied. This can occur if your account is unauthorized, has an overdue payment, has not enabled the service, or is suspended.

500

GENERAL_ERROR

An internal server error occurred. We recommend that you retry the request. If the error persists, contact us through Online Support.

581

TIMEOUT

The request timed out. We recommend that you retry the request. If the error persists, contact us through Online Support.

588

EXCEED_QUOTA

The request rate exceeds the specified limit.