Update Rule¶
POST /api/v1/sensitive_data_scanner/{sensitive_rule_uuid}/modify
Overview¶
Submit the complete editable configuration.
Before You Call and Usage Steps¶
Submit the complete editable configuration. If the optional filters or tags are omitted, they are treated as empty arrays. Obtain the rule UUID from the Rule List. The data scope is the workspace that the API Key belongs to.
Route Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| sensitive_rule_uuid | string | Y | UUID of the rule in the current workspace. Allows null: False Maximum length: 48 Example: sdsr_32cc36108f2c4194a70fc12554583f20 How to obtain or fill in: Get content.data[].uuid from the Sensitive Data Scanning Rule List, or get content.ruleUUIDs[] from the create response. |
Request Headers¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | Access key. Example: <DF-API-KEY>How to obtain or fill in: Obtain the key required by this API from API Key Management in the target workspace. |
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| dataTypes | array | Y | Scanned data type, a single-element string array. Available values: logging, object, custom_object, keyevent, tracing, rum, dialtest, network, profiling, billing, llm, agent_monitor. Use keyevent for events. Allows null: False Minimum length: 1 Maximum length: 1 Example: ['logging'] How to obtain or fill in: Select the data type to scan and put only one valid value in the array. |
| dataTypes[*] | string | Available values: ['logging', 'object', 'custom_object', 'keyevent', 'tracing', 'rum', 'dialtest', 'network', 'profiling', 'billing', 'llm', 'agent_monitor'] Example: loggingHow to obtain or fill in: Choose one value from the available enumeration that matches the data to be scanned. |
|
| filters | array | Array of filter rows. Omit it or use [] for no filtering. Each row consists of name (letters, digits, underscores, or hyphens), operation (in or not_in), value (a non-empty string array; each item cannot contain an English comma), and condition (and or or, default and). The condition must be the same across all rows, including the first row. Allows null: False Example: [{'name': 'service', 'operation': 'in', 'value': ['payment', 'checkout'], 'condition': 'or'}, {'name': 'env', 'operation': 'not_in', 'value': ['test'], 'condition': 'or'}] How to obtain or fill in: Build the filter conditions from the actual fields and values of the target data. |
|
| filters[*] | json | Example: {"name":"service","operation":"in","value":["payment"],"condition":"and"}How to obtain or fill in: One row corresponds to one field and its matching conditions. |
|
| filters[*].name | string | Conditionally required | Filter field name. Only letters, digits, underscores, and hyphens are allowed. Example: serviceHow to obtain or fill in: Obtain an actually existing field name from the target data. |
| filters[*].operation | string | Conditionally required | in matches any of the specified values; not_in excludes the specified values. Available values: ['in', 'not_in'] Example: inHow to obtain or fill in: Choose in to match or not_in to exclude as needed. |
| filters[*].value | array | Conditionally required | Non-empty string array. Each item cannot contain an English comma. Minimum length: 1 Example: ["payment"]How to obtain or fill in: Select the values to match or exclude from the actual values of the corresponding field. |
| filters[*].value[*] | string | Example: paymentHow to obtain or fill in: Enter an actual field value. Each item must not contain an English comma. |
|
| filters[*].condition | string | Relationship for the whole group. It must be the same for all rows; defaults to and when omitted. Available values: ['and', 'or'] Example: andHow to obtain or fill in: Choose and or or for the overall filter relationship and keep it consistent across all rows. |
|
| maskFieldCfg | json | Y | Masked fields. Applies only to scannable string fields. Allows null: False Example: {"type":"include","fields":["message"]}How to obtain or fill in: Choose the configuration based on the range of fields in the target data that need masking. |
| maskFieldCfg.type | string | Y | all=all fields, include=specified fields, exclude=excluded fields. Allows null: False Available values: ['all', 'include', 'exclude'] Example: includeHow to obtain or fill in: Choose the corresponding enumeration based on whether to process all fields, specified fields, or exclude some fields. |
| maskFieldCfg.fields | array | Required for include and exclude as a non-empty array of field names; omit for all. Maximum 256 after joining with English commas. Allows null: False Example: ['message'] How to obtain or fill in: When specifying or excluding fields, enter the actual string field names from the target data. |
|
| maskFieldCfg.fields[*] | string | Example: messageHow to obtain or fill in: Enter one string field name to include or exclude. |
|
| maskTypeCfg | json | Y | Processing method after a regular expression match. When switching processing methods, submit the complete configuration for the new branch. Allows null: False Example: {"type":"replace","replaceText":"[已脱敏]"}How to obtain or fill in: Choose the branch based on the processing goal after a regular expression match and fill in the required fields for that branch. |
| maskTypeCfg.type | string | Y | universal=universal encryption, part=partial encryption, replace=replacement encryption, md5=MD5 digest. For universal and md5, pass only type. Allows null: False Available values: ['universal', 'part', 'replace', 'md5'] Example: replaceHow to obtain or fill in: Choose universal, partial, replacement, or MD5 as needed. |
| maskTypeCfg.partMaskCfg | json | Required only for part. Contains the direction and the number of masked characters. Allows null: False Example: {"type":"front","count":3}How to obtain or fill in: When choosing partial masking, fill in the masking direction and character count. |
|
| maskTypeCfg.partMaskCfg.type | string | Conditionally required | front=mask the first few characters of the matched fragment; behind=mask the last few characters. For example, 123456789 with front/3 yields *456789. Allows null: False Available values: ['front', 'behind'] Example: frontHow to obtain or fill in: Choose front or behind based on the direction to mask. |
| maskTypeCfg.partMaskCfg.count | integer | Conditionally required | Number of masked characters, an integer from 1–10. Allows null: False $minValue: 1 $maxValue: 10 Example: 3How to obtain or fill in: Enter the number of characters to mask, from 1–10. |
| maskTypeCfg.replaceText | string | Required only for replace. Maximum 256. Leading and trailing whitespace is trimmed. An empty string can be passed explicitly. Allows null: False Allows empty string: True Maximum length: 256 Example: [已脱敏]How to obtain or fill in: When choosing replace, enter the text that the matched fragment should be replaced with. |
|
| name | string | Y | Rule name, non-empty, maximum 100. Leading and trailing whitespace is trimmed. Allows null: False Maximum length: 100 Example: payment-email How to obtain or fill in: Enter the updated display name of the rule. |
| regularExpression | string | Y | Regular expression compatible with the Go scanning engine, non-empty, maximum 1024. Pay attention to JSON backslash escaping. Allows null: False Maximum length: 1024 Example: [A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,} How to obtain or fill in: Enter the target Go regular expression. You can use Regular Expression Test to verify it before saving. |
| tags | array | Array of tag strings. Elements use key:value. Omitting it is equivalent to an empty array. Maximum 256 after joining with English commas. Allows null: False Example: ['masked:email'] How to obtain or fill in: Enter a key:value tag array according to your business classification. |
|
| tags[*] | string | Example: team:paymentHow to obtain or fill in: Enter one key:value tag. |
Supplementary Notes on Parameters¶
Fully replaces the editable configuration of an existing rule. Omitting filters or tags means clearing them. Use the enable/disable API separately to specify the status.
Request Example¶
curl 'https://openapi.guance.com/api/v1/sensitive_data_scanner/sdsr_32cc36108f2c4194a70fc12554583f20/modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"dataTypes":["logging"],"filters":[{"name":"service","operation":"in","value":["payment","checkout"],"condition":"or"},{"name":"env","operation":"not_in","value":["test"],"condition":"or"}],"maskFieldCfg":{"type":"include","fields":["message"]},"maskTypeCfg":{"type":"replace","replaceText":"[EMAIL]"},"name":"payment-email","regularExpression":"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}","tags":["masked:email"]}'
Response¶
HTTP 200, application/json.
| Field | Type | Description |
|---|---|---|
| content.data.uuid | string | Rule UUID, used to query, modify, enable/disable, or delete the rule. |
| content.data.workspaceUUID | string | UUID of the workspace that the rule belongs to. |
| content.data.name | string | Rule name. |
| content.data.dataTypes | array<string> |
Data types to which the rule applies. |
| content.data.filters | array<object> |
Configured filter conditions. |
| content.data.conditions | string | Filter expression derived by the server. |
| content.data.regularExpression | string | Rule regular expression. |
| content.data.maskFieldCfg | object | Scanned field configuration. |
| content.data.maskTypeCfg | object | Mask configuration. |
| content.data.tags | array<string> |
Rule tags. |
| content.data.status | integer | 0 enabled, 2 disabled. |
| content.data.createAt | integer | Creation time, in Unix seconds. |
| content.data.updateAt | integer | Update time, in Unix seconds; may be -1 if never updated. |
| content.data.deleteAt | integer | Deletion time; -1 for active records. |
| content.data.id | integer or null | Database row ID. Use uuid for integration. |
| content.data.creator | string | Identifier of the creator. |
| content.data.updator | string | Identifier of the last updater. |
{
"code": 200,
"content": {
"data": {
"uuid": "sdsr_32cc36108f2c4194a70fc12554583f20",
"dataTypes": [
"logging"
],
"filters": [
{
"name": "service",
"operation": "in",
"value": [
"payment",
"checkout"
],
"condition": "or"
},
{
"name": "env",
"operation": "not_in",
"value": [
"test"
],
"condition": "or"
}
],
"maskFieldCfg": {
"type": "include",
"fields": [
"message"
]
},
"maskTypeCfg": {
"type": "replace",
"replaceText": "[EMAIL]"
},
"name": "payment-email",
"regularExpression": "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}",
"tags": [
"masked:email"
],
"status": 0,
"creator": "acnt_example",
"updator": "",
"createAt": 1795140000,
"updateAt": -1
}
},
"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.ErrorRegularExpression | The Go engine rejects the regular expression in the rule | Invalid regular expression | Correct it using Go regular expression syntax. You can verify it first with Regular Expression Test. |
| 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 | Fix the JSON syntax. |
| 403 | ft.Forbidden | Insufficient API permissions, or the current workspace version is not supported | Forbidden | Confirm the workspace that the key belongs to, the permissions, and the workspace version. |
| 406 | ft.ParameterValidationFailed / ft.InvalidParameter | A field is missing or a field value violates the validation conditions | Invalid parameter | Check the JSON fields, types, and value ranges. |
| 404 | ft.ObjectNotExists | The rule does not exist, has been deleted, or does not belong to the current workspace | Rule does not exist | Obtain the UUID again from the rule list of the current workspace. |