Skip to navigation

Create DLP Rule

Create a custom DLP rule. It needs a pattern, keywords, or both, and starts enabled. Its entity_type is the name projects and customers use to override it.

Authentication

AuthorizationBearer

A management key (mgmt_...), sent as Authorization: Bearer <key>. Reading /v1/routing-policies also accepts the organization’s gateway API keys; writing there needs a management key.

Request

This endpoint expects an object.
entity_typestringRequired1-80 characters
The rule's name. Unique among the organization's custom rules.
actionenumOptionalDefaults to log

log records a match and sends the prompt unchanged, redact replaces each match with a placeholder such as <US_SSN> before the prompt is sent, and block refuses the request with 422. Defaults to log.

Allowed values:
descriptionstringOptionalDefaults to
What the rule detects.
enabledbooleanOptionalDefaults to true
false creates the rule switched off.
keywordslist of strings or nullOptional
Words the rule matches. At most 50, each up to 100 characters.
patternstring or nullOptional<=500 characters
A Python regular expression the rule matches, checked on save.

Response

The created DLP rule
actionenum

log records a match and sends the prompt unchanged, redact replaces each match with a placeholder such as <US_SSN> before the prompt is sent, and block refuses the request with 422.

Allowed values:
categoryenumRead-only

custom for rules the organization creates; global and usa are seeded.

Allowed values:
created_atdatetimeRead-only
For a seeded rule never changed, the time of the request.
descriptionstring
What the rule detects.
detection_methodstringRead-only

How the rule finds matches, like Pattern match and checksum.

display_namestringRead-only
The name the dashboard shows.
enabledboolean
Whether the rule scans requests.
entity_typestring
The rule's name. Unique among the organization's custom rules.
idstringRead-onlyformat: "uuid"
Stable for seeded rules, even before they are first changed.
is_seededbooleanRead-only
Seeded rules can't be created or deleted, only enabled and given an action.
keywordslist of strings or null
Words the rule matches, if it has any.
patternstring or null
The rule's regular expression, if it has one.
updated_atdatetimeRead-only
When the rule last changed.

Errors

401
Unauthorized Error
403
Forbidden Error
409
Conflict Error
422
Unprocessable Entity Error
502
Bad Gateway Error