All Products
Search
Document Center

Web Application Firewall:DescribeDefenseTemplates

Last Updated:Mar 20, 2026

Retrieves a paginated list of protection templates.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

yundun-waf:DescribeDefenseTemplates

list

*All Resource

*

  • acs:ResourceGroupId
None

Request parameters

Parameter

Type

Required

Description

Example

TemplateIds

string

No

The IDs of the protection templates that you want to query. You can specify this parameter to query the protected objects for which multiple protection templates take effect. Separate multiple template IDs with commas (,).

189731,189539,189538,189531,189540,189542,189541

TemplateName

string

No

The name of the protection template to query.

test

InstanceId

string

Yes

The ID of the WAF instance.

Note

You can call the DescribeInstance operation to query the ID of the WAF instance.

waf_v3prepaid_public_cn-pe33b****03

TemplateId

integer

No

The ID of the protection template.

39395

TemplateType

string

No

The type of the protection template that you want to create. Valid values:

  • user_default: default protection template.

  • user_custom: custom protection template.

user_default

DefenseScene

string

No

The protection scenario. For more information, see the description of the DefenseScene parameter in the CreateDefenseRule topic.

region_block

Resource

string

No

The name of the protected object or protected object group, or the ID of the protected asset.

Note

You must specify the Resource and ResourceType parameters to filter query results.

ruiqiu.cc-ecs

ResourceType

string

No

The type of the protected resource. Valid values:

  • single (default): a protected object.

  • group: a protected object group.

  • asset: a protected asset.

Note

You must specify the Resource and ResourceType parameters to filter query results.

single

DefenseSubScene

string

No

The sub-scenario of the protection template. Valid values:

  • web: the web protection template for bot management.

  • app: the app protection template for bot management.

  • basic: the basic protection template for bot management.

  • bot_custom_acl: the advanced custom protection rule template for bot management.

basic

PageNumber

integer

No

The number of the page to return. Default value: 1.

1

PageSize

integer

No

The number of entries to return on each page. Default value: 20.

10

RegionId

string

No

The region where the WAF instance resides. Valid values:

  • cn-hangzhou: the Chinese mainland.

  • ap-southeast-1: outside the Chinese mainland.

cn-hangzhou

ResourceManagerResourceGroupId

string

No

The ID of the resource group.

rg-acfmvyknl****fa

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the request.

4F26D2F1-E288-5104-8518-05E240E337A4

TotalCount

integer

The total number of protection templates returned.

100

Templates

array<object>

An array of protection templates.

object

A protection template.

DefenseScene

string

The protection scenario. Valid values:

  • waf_group: Basic Protection.

  • antiscan: Scan Protection.

  • ip_blacklist: IP Blocklist.

  • custom_acl: Custom Rule.

  • whitelist: Allowlist.

  • region_block: Geographic Blocking.

  • custom_response: Custom Response.

  • cc: HTTP Flood Protection.

  • tamperproof: Webpage Tamper Protection.

  • dlp: Data Loss Prevention.

  • bot_manager: Bot Management.

whitelist

GmtModified

integer

The last modification time of the protection template. This value is a UNIX timestamp in milliseconds.

1683776070000

TemplateId

integer

The ID of the protection template.

56477

TemplateName

string

The name of the protection template.

template-blockarea1

TemplateOrigin

string

The origin of the protection template to be created. The value is custom, which indicates a user-defined template.

custom

TemplateStatus

integer

The status of the protection template. Valid values:

  • 0: Disabled.

  • 1: Enabled.

1

TemplateType

string

The type of the protection template. Valid values:

  • user_default: The user's default protection template.

  • user_custom: A custom protection template defined by the user.

user_custom

DefenseSubScene

string

The sub-scenario for the Bot Management template. This parameter is returned only when DefenseScene is set to bot_manager. Valid values:

  • web: web protection

  • app: app protection

  • basic: basic protection

  • bot_custom_acl: The protection template for advanced Custom Rules in Bot Management.

basic

Description

string

The description of the template.

testTemplate

Examples

Success response

JSON format

{
  "RequestId": "4F26D2F1-E288-5104-8518-05E240E337A4",
  "TotalCount": 100,
  "Templates": [
    {
      "DefenseScene": "whitelist",
      "GmtModified": 1683776070000,
      "TemplateId": 56477,
      "TemplateName": "template-blockarea1",
      "TemplateOrigin": "custom",
      "TemplateStatus": 1,
      "TemplateType": "user_custom",
      "DefenseSubScene": "basic",
      "Description": "testTemplate"
    }
  ]
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.