tencent cloud

APIs

ModifyLLMContentRule

ダウンロード
フォーカスモード
フォントサイズ
最終更新日: 2026-11-17 19:19:00

1. API Description

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

This API is used to update the LLM content security rule.

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: ModifyLLMContentRule.
Version Yes String Common Params. The value used for this API: 2018-01-25.
Region Yes String Common Params. For more information, please see the list of regions supported by the product. This API only supports: ap-guangzhou, ap-seoul, ap-singapore.
Name Yes String

Name.

Priority Yes Integer

Priority.

Status Yes Integer

Rule switch.

CheckType Yes Integer

Detection scope. 1: Inbound. 2: Outbound. 3: Inbound and outbound.

RuleItem.N Yes Array of RuleItem

Detection content matching.

Options.N Yes Array of LLMOptionsItem

Matching condition.

Domain No String

Domain name.

ActionType No String

Action. monitor: Observe. Intercept: Intercept.

ResponseText No String

Response prompt content.

SessionApplied.N No Array of String

Session ID for which the rule is to be enabled.

RuleId No String

Rule ID. Enter 0 when adding a rule.

PageId No Integer

Interception page id.

ContentLogicalOp No String

Detection content and/or expression. Defaults to and.

InstanceId No String

Instance id. Required.

ReplyType No Integer

Response type. 1: Built-in trusted model security response. 2: Custom response, which takes effect when ActionType=reply.

Valid values:

  • 1: Built-in trusted model security response
  • 2: Custom response, which takes effect when ActionType=reply
CustomReplyRuleId No String

Custom response template.

ModalType No Integer

Modality type. 0: Text (default). 1: Image.

Valid values:

  • 0: Text
  • 1: Image
Category No String

Rule category. black: Regular rule (default). white: Allowlist rule. If this parameter is left empty, the black category is used. When this parameter is set to white, ActionType can only be set to pass, and RuleItem supports allowlist matching fields (Key: ip/geo/type/content/chat_id/user_id/tool_name/tool_args/keyword_whitelist; Op: belong/not_belong/equal/not_equal/contain/not_contain/prefix/suffix/wildcard).

Domains.N No Array of String

Effective scope of the allowlist rule: a list of multiple serviceId/domain values (used when Category=white), indicating the domains/serviceIds to which the allowlist rule applies. This field is not used for blocklist rules.

AppliedModules.N No Array of Integer

List of module types for which the allowlist takes effect (used when Category=white), indicating the protection modules to which the allowlist rule applies (pass) after a match. Valid values: 2: Compute resource consumption rule; 3: Custom protection rule; 4: ToolCall protection; 5: Prompt attack protection; 6: Content compliance detection; 7: Sensitive data detection.

RiskLevel No String

Severity. critical: Critical. high: High. medium: Medium (default). low: Low. When this rule is matched, the risk level is displayed in attack logs based on this parameter. If this parameter is not passed or is left empty, the medium severity is used.

Valid values:

  • critical: Critical
  • high: High
  • medium: Medium (default)
  • low: Low

3. Output Parameters

Parameter Name Type Description
RuleId String

RuleId of the operation

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 Test Case

Input Example

POST / HTTP/1.1
Host: waf.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyLLMContentRule
<Common request parameters>

{
    "Domain": "jacky12220901.testwaf.com",
    "Name": "ddptest",
    "ActionType": "log",
    "Priority": 50,
    "Status": 1,
    "ResponseText": "ceshi",
    "CheckType": 1,
    "RuleItem": [
        {
            "Key": "inappropriate_info",
            "Op": "contain",
            "Value": [
                "601"
            ],
            "Levels": [
                {
                    "Label": "601",
                    "Level": 400
                }
            ]
        }
    ],
    "SessionApplied": [
        "0"
    ],
    "Options": [
        {
            "Key": "protectpath_business",
            "Op": "belong",
            "Value": [
                "`"
            ],
            "Name": "5300000310"
        }
    ],
    "InstanceId": "waf_2l15d14809yfq9sf",
    "ReplyType": 1,
    "CustomReplyRuleId": "0"
}

Output Example

{
    "Response": {
        "RuleId": "5200039233",
        "RequestId": "23a6c61f-825a-4a88-a03c-00a6859d1928"
    }
}

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 Internal error.
LimitExceeded.ContentRuleErr The number of content rules under the current domain has reached the upper limit.
LimitExceeded.LimitRuleErr The number of compute consumption rules under the current domain has reached the upper limit.
LimitExceeded.SpecificationErr SpecificationErr
UnsupportedOperation The operation is not supported.

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック