# Manage custom sensitivity rules

{% hint style="info" %}
Custom sensitivity rules are part of the Advanced API, which requires an Enterprise license.
{% endhint %}

A [custom sensitivity rule](/app/generation/identify-sensitive-data/custom-sensitivity-rules.md) allows you to define a sensitivity type that is not included in the Structural built-in types. For example, your data might include values that are specific to your organization.

## Get the list of custom sensitivity rules

To retrieve the list of custom sensitivity rules and their current configuration, use:

[<mark style="background-color:blue;">**GET**</mark>**&#x20;api/sensitivityrule**](https://app.tonic.ai/apidocs/index.html#/SensitivityRule/GetAllRules)

For each rule, the response provides a [`SensitivityRuleSummary`](https://app.tonic.ai/apidocs/index.html#/models/SensitivityRuleSummary) object that includes:

* Rule name.
* Rule description.
* The data type for matching columns.
* The regular expression used to identify matching column names. Even if the sensitivity rule was configured in the Structural application to use text matching rules, the matching rules are converted to a regular expression.
* The identifier of the generator preset to recommend for matching columns.
* The user who most recently updated the rule.
* The timestamp when the rule was most recently updated.
* The sequence number for the rule. The sequence numbers control the order in which Structural applies the sensitivity rules.

## Create a sensitivity rule

To create a sensitivity rule, use:

[<mark style="background-color:green;">**POST**</mark>**&#x20;api/sensitivityrule**](https://app.tonic.ai/apidocs/index.html#/SensitivityRule/CreateCustomRule)

In the request, you provide a [`SensitivityRuleRequestModel`](https://app.tonic.ai/apidocs/index.html#/models/SensitivityRuleRequestModel) object that includes:

* Rule name.
* An optional rule description.
* The data type for matching columns.
* The regular expression to use to identify matching column names. When you use the API to create a sensitivity rule, you must provide a regular expression. You cannot use text matching rules.
* The identifier of the generator preset to recommend for matching columns

Structural automatically adds the sensitivity rule to the end of the list. To assign a sequence number, you must edit the sensitivity rule.

## Update a sensitivity rule

To update an existing sensitivity rule, use:

[<mark style="background-color:green;">**PATCH**</mark>**&#x20;api/sensitivityrule**](https://app.tonic.ai/apidocs/index.html#/SensitivityRule/EditCustomRule)

In the request, you provide an [`EditSensitivityRuleRequestModel`](https://app.tonic.ai/apidocs/index.html#/models/EditSensitivityRuleRequestModel) object.

In addition to the fields from the sensitivity rule creation, the object includes the `order` property, which sets the sequence number of the sensitivity rule. The sequence number determines the order in which Structural checks and applies the sensitivity rules.

Any changes to the sensitivity rule configuration are not applied until the next sensitivity scan.

When you change the sequence number, Structural automatically adjusts the sequence numbers of the other existing sensitivity rules.

## Delete a sensitivity rule

To delete an existing sensitivity rule, use:

[<mark style="background-color:red;">**DELETE**</mark>**&#x20;api/sensitivityrule/{sensitivityRuleId}**](https://app.tonic.ai/apidocs/index.html#/SensitivityRule/DeleteCustomRule)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tonic.ai/app/api/quick-start-guide/api-custom-sensitivity-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
