tencent cloud

BindSecurityTemplateToEntity
Last updated: 2025-10-30 22:02:15
BindSecurityTemplateToEntity
Last updated: 2025-10-30 22:02:15

1. API Description

Domain name for API request: teo.intl.tencentcloudapi.com.

This API is used to bind/unbind a domain name to/from a specific policy template.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: BindSecurityTemplateToEntity.
Version Yes String Common Params. The value used for this API: 2022-09-01.
Region No String Common Params. This parameter is not required.
ZoneId Yes String Site ID of the policy template to be bound to or unbound from.
Entities.N Yes Array of String List of domain names to bind to/unbind from a policy template
Operate Yes String Bind or unbind operation option. valid values:.
  • Bind: bind the domain name to the policy template.
  • .
  • unbind-keep-policy: unbind a domain name from the policy template while retaining the current policy.
  • .
  • unbind-use-default: unbind a domain name from the policy template and use the default blank policy.
  • note: the unbinding operation currently only supports unbinding a single domain name. that is, when the Operate parameter value is unbind-keep-policy or unbind-use-default, the Entities parameter list only supports filling in one domain name.
    TemplateId Yes String Specifies the ID of the policy template or the site global policy to be bound or unbound.
  • To bind to a policy template, or unbind from it, specify the policy template ID.
  • .
  • To bind to the site's global policy, or unbind from it, use the @ZoneLevel@domain parameter value.
  • .

    Note: After unbinding, the domain name will use an independent policy and rule quota will be calculated separately. Please make sure there is sufficient rule quota before unbinding.
    OverWrite No Boolean If the imported domain name has already been bound to a policy template (including a site-level security policy), this parameter indicates whether to replace the template by setting it. the default value is true. values:
  • true: replace the template currently bound to the domain.
  • false: do not replace the template currently bound to the domain.
  • note: when set to false, if the imported domain name has already been bound to a policy template, the API will return an error; a site-level security policy is also a type of policy template.

    3. Output Parameters

    Parameter Name Type Description
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Unbinding a domain name from a policy template

    In this example, we unbind the domain name a.test.com from the policy template temp-cuwg1hki of the site zone-2aq0e8rhu6jx. Only one domain name can be unbound at one time. There are two options:

    1. unbind-keep-policy: Unbind the domain name from the specified policy and create a new policy for the domain name with the same configuration as the original one. This takes additional rule quota.
    2. unbind-use-default: Unbind the domain name from the specified policy and then bind it with the default policy with default configurations. Custom rules no longer take effect.

    Note: To use unbind-keep-policy, make sure your rule quota is enough. If the remaining quota is insufficient, the unbinding fails and the domain name remains bound to the current policy template.

    Input Example

    POST / HTTP/1.1
    Host: teo.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: OperateSecurityTemplate
    <Common request parameters>
    
    {
        "ZoneId": "zone-2aq0e8rhu6jx",
        "Entities": [
            "a.test.com"
        ],
        "TemplateId": "temp-cuwg1hki",
        "Operate": "unbind-keep-policy"
    }

    Output Example

    {
        "Response": {
            "RequestId": "09ce3d28-1119-49cd-xxxx-27cb34dac669"
        }
    }

    Example2 Binding domain names to a policy template

    In this example, we bind two domain names (a.test.com and b.example.com) to the policy template temp-cuwg1hki under the site zone-2aq 0e8rhu6jx.

    Note: You need to have permissions to the related sites.

    Input Example

    POST / HTTP/1.1
    Host: teo.intl.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: OperateSecurityTemplate
    <Common request parameters>
    
    {
        "ZoneId": "zone-2aq0e8rhu6jx",
        "Entities": [
            "a.test.com",
            "b.example.com"
        ],
        "TemplateId": "temp-cuwg1hki",
        "Operate": "bind",
        "OverWrite": true
    }

    Output Example

    {
        "Response": {
            "RequestId": "09ce3d28-1119-49cd-xxxx-27cb34dac669"
        }
    }

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    InternalError.ConfigLocked The configuration is locked. Please unlock and try again.
    InternalError.ProxyServer An unknown error occurred in the backend server.
    InvalidParameter.Security Invalid parameter.
    OperationDenied Operation denied.
    ResourceInUse The resource is occupied.
    UnauthorizedOperation.CamUnauthorized CAM is not authorized.
    UnsupportedOperation Unsupported operation.
    Was this page helpful?
    You can also Contact Sales or Submit a Ticket for help.
    Yes
    No

    Feedback