Ana içeriğe geç

Create AI DLP Preset

Endpoint

POST /apiops/settings/ai-dlp-presets/{presetName}/

Authentication

Requires a Personal API Access Token with admin privileges.

Authorization: Bearer YOUR_TOKEN

Request

Headers

HeaderValueRequired
AuthorizationBearer {token}Yes
Content-Typeapplication/jsonYes

Path Parameters

ParameterTypeRequiredDescription
presetNamestringYesName of the DLP preset. Must match the name in the body (case-insensitive); if name is omitted from the body it defaults to this value.

Query Parameters

ParameterTypeRequiredDefaultDescription
projectIdstringNoadminScope project id. Omit for the admin/global scope.

Request Body

Full JSON Body Example

{
"name": "internal-api-token",
"ruleValue": "ITK-[0-9]{10}",
"action": "MASK",
"category": "internal",
"description": "Internal service API token",
"enabled": true
}

Request Body Fields

FieldTypeRequiredDefaultDescription
namestringNopath valuePreset name. Must equal presetName (case-insensitive); defaults to the path value when omitted.
ruleValuestringYes-Java regex pattern used to detect the secret/credential. Must compile — an invalid regex is rejected.
actionstringYes-Action applied on match: BLOCK, FLAG, or MASK. DLP is the only preset family where all three are valid.
categorystringNo-Optional category label (e.g. aws, openai, github, pem, slack, google, jwt, generic)
descriptionstringNo-Optional description for UI display
enabledbooleanNo-Whether the preset is active

Notes

  • The request body must not be empty
  • name in the body must match presetName in the path (case-insensitive)
  • ruleValue must be a valid Java regular expression; an uncompilable pattern is rejected before the preset is saved
  • The preset name must be unique within the caller's visible scope (built-in ∪ admin-shared ∪ this scope) — a collision is rejected
  • builtIn is server-controlled and ignored on write — you cannot create a built-in preset via the API
  • id is server-controlled and ignored on write

Response

Success Response (200 OK)

{
"status": "SUCCESS",
"deploymentResult": {
"success": true
}
}

Response Fields

FieldTypeDescription
statusstringResponse status: SUCCESS or FAILURE
deploymentResultobjectDeployment result summary
deploymentResult.successbooleantrue when the preset was saved successfully

Error Response (400 Bad Request)

Returned on validation failure, name mismatch, an attempt to overwrite a built-in preset, or when the caller lacks the ADMIN role.

{
"status": "FAILURE",
"resultMessage": "AI DLP preset name in path (internal-api-token) does not match name in body (other-name)!"
}

Other possible messages:

{
"status": "FAILURE",
"resultMessage": "AI DLP preset body can not be empty!"
}
{
"status": "FAILURE",
"resultMessage": "Built-in presets are read-only"
}
{
"status": "FAILURE",
"resultMessage": "ruleValue is required"
}
{
"status": "FAILURE",
"resultMessage": "ruleValue is not a valid regular expression: Unclosed character class near index 5\n[0-9"
}
{
"status": "FAILURE",
"resultMessage": "A preset with this name already exists in the visible scope (built-in, admin-shared, or this project)"
}

Error Response (401 Unauthorized)

{
"status": "FAILURE",
"resultMessage": "Token is not valid!"
}

cURL Example

curl -X POST \
"https://demo.apinizer.com/apiops/settings/ai-dlp-presets/internal-api-token/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "internal-api-token",
"ruleValue": "ITK-[0-9]{10}",
"action": "MASK",
"category": "internal",
"description": "Internal service API token",
"enabled": true
}'

Notes and Warnings

  • Admin Only:
    • Only sysAdmin users (or users with the ADMIN role) can create AI DLP presets
    • A project-scoped AI_DEVELOPMENT token is not sufficient
  • Upsert by Name:
    • If a preset with the same name already exists in the scope, this call updates it
    • Otherwise a new custom preset is created
  • Built-in Presets Are Read-only:
    • You cannot create or overwrite a built-in (seeded) preset; such attempts are rejected
  • Regex Pattern:
    • ruleValue is a Java regex; remember to escape backslashes in JSON (e.g. \\b for a word boundary)
    • An uncompilable pattern is rejected at save time, before it can be copied into a PolicyAiDlpGuard definition list
  • All Three Actions Valid:
    • Unlike prompt-guard/privacy presets, DLP presets accept BLOCK, FLAG and MASKMASK is DLP's own domain (secret/credential redaction)
  • Name Consistency:
    • The name in the body must match presetName in the path (case-insensitive)
  • No Secret Fields:
    • ruleValue is a detection regex pattern, not a credential itself — DLP presets carry no secret (@SecretData) fields, so no values are masked