Help Center/ Web Application Firewall/ API Reference/ APIs/ Policy Management/ Querying a Protection Policy by ID
Updated on 2025-09-17 GMT+08:00

Querying a Protection Policy by ID

Function

This API is used to copy a protection policy by ID.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/waf/policies/{src_policy_id}/copy

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID, which is used to identify the project to which the tenant belongs. To obtain the project ID, log in to the console, click the username, choose My Credentials, locate the project in the Projects list, and check the project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

src_policy_id

Yes

String

Definition

Source policy ID, which is the unique ID of the policy to be copied. You can obtain the policy ID by calling the API for querying the protection policy list.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

Definition

Enterprise project ID. You can obtain the enterprise project ID by calling the ListEnterpriseProject API of Enterprise Project Management Service (EPS). To query the resources associated with all enterprise projects of the current account, you do not need to specify this parameter.

Constraints

N/A

Range

N/A

Default Value

N/A

dest_policy_name

Yes

String

Definition

Name of the new policy, which is used to identify the copied protection policy. The name must comply with the naming rules (for example, special characters not allowed and length limit).

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

Tenant token, which is used for identity authentication. You can obtain the token by calling the IAM API for obtaining a user token. The token is the value of X-Subject-Token in the response header.

Constraints

N/A

Range

N/A

Default Value

N/A

Content-Type

Yes

String

Definition

Content type, which specifies the data format of the request body.

Constraints

N/A

Range

N/A

Default Value

application/json;charset=utf8

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

id

String

Definition

Protection policy ID.

Range

N/A

name

String

Definition

Protection policy name.

Range

Enter a maximum of 64 characters. Only letters, digits, underscores (_), hyphens (-), colons (:), and periods (.) are allowed.

level

Integer

Definition

Basic web protection level.

Range

  • 1: Low. At this level, only requests with obvious attack characteristics are blocked. If a large number of false alarms are reported, this level is recommended.

  • 2: Medium. This is the default level, which meets web protection requirements in most scenarios.

  • 3: Strict. At this level, WAF provides the finest granular protection and can intercept attacks with complex bypass features, such as Jolokia cyber attacks, common gateway interface (CGI) vulnerability detection, and Druid SQL injection attacks.

full_detection

Boolean

Definition

Detection mode in the precise protection rule.

Range

  • false: Instant detection. If a request matches a configured precise protection rule, WAF immediately ends threat detection and blocks the request.

  • true: Full detection. If a request matches a configured precise protection rule, WAF does not block the request immediately. Instead, WAF continues to detect other threats and then blocks the request.

robot_action

Action object

Protective actions for each rule in anti-crawler protection.

action

PolicyAction object

Protective action

options

PolicyOption object

Whether a protection type is enabled in protection policy.

modulex_options

Map<String,Object>

Definition

Configurations of intelligent access control protection items. Currently, this feature is still in the open beta test (OBT) phase and available only in certain sites.

Range

N/A

hosts

Array of strings

Definition

ID array of protected domain names bound to a protection policy.

Range

N/A

bind_host

Array of BindHost objects

Array of domain names protected with the protection policy. Compared with the hosts field, this field contains more details.

extend

Map<String,String>

Definition

Extended field, which is used to store the switch configuration of basic web protection.

Range

N/A

timestamp

Long

Definition

Time the policy was created.

Range

N/A

Table 5 Action

Parameter

Type

Description

category

String

Definition

Protective action information in feature anti-crawler

Range

  • log: Only logs are recorded.

  • block: WAF blocks attacks.

Table 6 PolicyAction

Parameter

Type

Description

category

String

Definition

Basic web protection action (log: record only; block: block)

Range

  • block

  • log

followed_action_id

String

Definition

Attack penalty rule ID.

Range

N/A

Table 7 PolicyOption

Parameter

Type

Description

webattack

Boolean

Definition

Whether basic web protection is enabled.

Range

  • true

  • false

common

Boolean

Definition

Whether general check is enabled.

Range

  • true

  • false

crawler

Boolean

Definition

Reserved parameter. The value is always true and can be ignored.

Range

  • true

  • false

crawler_engine

Boolean

Definition

Whether the search engine is enabled.

Range

  • true

  • false

crawler_scanner

Boolean

Definition

Whether the anti-crawler detection is enabled.

Range

  • true

  • false

crawler_script

Boolean

Definition

Whether the JavaScript anti-crawler is enabled.

Range

  • true

  • false

crawler_other

Boolean

Definition

Whether other crawler check is enabled.

Range

  • true

  • false

webshell

Boolean

Definition

Whether web shell detection is enabled

Range

  • true

  • false

cc

Boolean

Definition

Whether the CC attack protection rule is enabled.

Range

  • true

  • false

custom

Boolean

Definition

Whether precise protection is enabled.

Range

  • true

  • false

whiteblackip

Boolean

Definition

Whether blacklist and whitelist protection is enabled.

Range

  • true

  • false

geoip

Boolean

Definition

Whether geolocation access control is enabled.

Range

  • true

  • false

ignore

Boolean

Definition

Whether false alarm masking is enabled.

Range

  • true

  • false

privacy

Boolean

Definition

Whether data masking is enabled.

Range

  • true

  • false

antitamper

Boolean

Definition

Whether the web tamper protection is enabled.

Range

  • true

  • false

antileakage

Boolean

Definition

Whether the information leakage prevention is enabled.

Range

  • true

  • false

bot_enable

Boolean

Definition

Whether the website anti-crawler function is enabled.

Range

  • true

  • false

modulex_enabled

Boolean

Definition

Whether CC attack protection for moduleX is enabled. This feature is in the open beta test (OBT). During the OBT, only the log only mode is supported.

Range

  • true

  • false

Table 8 BindHost

Parameter

Type

Description

id

String

Definition

Domain name ID.

Constraints

N/A

Range

N/A

Default Value

N/A

hostname

String

Definition

Domain name.

Constraints

N/A

Range

N/A

Default Value

N/A

waf_type

String

Definition

Domain name mode. The value can be cloud for cloud mode or premium for dedicated mode.

Constraints

N/A

Range

  • cloud

  • premium

Default Value

N/A

mode

String

Definition

This parameter is required only by the dedicated mode.

Constraints

N/A

Range

N/A

Default Value

N/A

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

You can call the decode-authorization-message interface of the STS service to decode the rejection reason. For details, see the STS5 joint commissioning and self-verification. This parameter is returned only when an IAM 5 authentication error occurs.

details

Array of IAM5ErrorDetails objects

The set of error messages reported when a downstream service is invoked. This parameter is returned only when an IAM 5 authentication error occurs.

Table 10 IAM5ErrorDetails

Parameter

Type

Description

error_code

String

Error codes of the downstream service.

error_msg

String

Error messages of the downstream service.

Status code: 401

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

You can call the decode-authorization-message interface of the STS service to decode the rejection reason. For details, see the STS5 joint commissioning and self-verification. This parameter is returned only when an IAM 5 authentication error occurs.

details

Array of IAM5ErrorDetails objects

The set of error messages reported when a downstream service is invoked. This parameter is returned only when an IAM 5 authentication error occurs.

Table 12 IAM5ErrorDetails

Parameter

Type

Description

error_code

String

Error codes of the downstream service.

error_msg

String

Error messages of the downstream service.

Status code: 500

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

You can call the decode-authorization-message interface of the STS service to decode the rejection reason. For details, see the STS5 joint commissioning and self-verification. This parameter is returned only when an IAM 5 authentication error occurs.

details

Array of IAM5ErrorDetails objects

The set of error messages reported when a downstream service is invoked. This parameter is returned only when an IAM 5 authentication error occurs.

Table 14 IAM5ErrorDetails

Parameter

Type

Description

error_code

String

Error codes of the downstream service.

error_msg

String

Error messages of the downstream service.

Example Requests

None

Example Responses

None

Status Codes

Status Code

Description

200

OK

400

Request failed.

401

The token does not have required permissions.

500

Internal server error.

Error Codes

See Error Codes.