Skip to content

Official Built-in Rule Library



POST /api/v1/sensitive_data_scanner/inner_rules/list

Overview

Query the official built-in rule library.

Before Calling and Usage Steps

Query the official built-in rule library. If titles is omitted or an empty array is passed, all categories are returned. You can use the returned children[].pattern to fill in the rule's regularExpression. The data scope is the workspace to which the API Key belongs.

Request Headers

Parameter Type Required Description
DF-API-KEY string Y Access key.
Example: <DF-API-KEY>
How to get or enter: Obtain the key required for the current API from API Key Management in the target workspace.

Body Request Parameters

Parameter Type Required Description
titles array Array of category title strings. If omitted or an empty array is passed, all built-in libraries are returned.
Allow null: False
Example: []
How to get or enter: Use content[].title of an existing built-in category. For the first query, you can omit it or pass an empty array.
titles[*] string Example: 示例规则库
How to get or enter: Pass the actual category title returned by the built-in rule library.

Additional Parameter Notes

Query the official built-in rule library. The response consists of categories and children, and the pattern in a rule is used as the regularExpression in a create request. titles is optional; an empty array queries all.

Request Example

curl 'https://openapi.truewatch.com/api/v1/sensitive_data_scanner/inner_rules/list' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"titles":[]}'

Response

HTTP 200, application/json.

Field Type Description
content[] object Built-in rule category. Fields include title, type, path, and children.
content[].children[].pattern string Regular expression of the built-in rule.
{
    "code": 200,
    "content": [
        {
            "title": "示例规则库",
            "type": "sensitive-data-scanner",
            "path": "/example",
            "children": [
                {
                    "name": "payment-email",
                    "pattern": "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}",
                    "tags": [
                        "masked:email"
                    ]
                }
            ]
        }
    ],
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-EXAMPLE"
}

Error Responses

For authentication, rate limiting, and common request errors, see Common Error Definitions.

HTTP Status errorCode Trigger Condition Message or Response Description Handling
400 ft.JsonFormatError The top level of the request body is not a JSON object JSON format error Submit a JSON object as the request body.
400 ft.RequestJsonFormatError JSON syntax error Request JSON format error Correct the JSON syntax.
403 ft.Forbidden Insufficient API permissions, or unsupported by the current workspace version Forbidden Confirm the workspace to which the Key belongs, the permissions, and the workspace version.
406 ft.ParameterValidationFailed / ft.InvalidParameter Missing fields or field values violate validation conditions Invalid parameters Check JSON fields, types, and value ranges.