Create AI Prompt-Guard Preset
Endpoint
POST /apiops/settings/ai-prompt-guard-presets/{presetName}/
Authentication
Requires a Personal API Access Token with admin privileges.
Header
Authorization: Bearer YOUR_TOKEN
Request
Headers
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer {token} | Yes |
| Content-Type | application/json | Yes |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| presetName | string | Yes | Name of the prompt-guard preset. Must match the name in the body (case-insensitive); if name is omitted from the body it defaults to this value. |
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| projectId | string | No | admin | Scope project id. Omit for the admin/global scope. |
Request Body
Full JSON Body Example
{
"name": "block-internal-hostnames",
"ruleValue": "(?i)internal\\.corp\\.local",
"action": "FLAG",
"category": "system-leak",
"description": "Flags mentions of internal hostnames",
"enabled": true
}
Request Body Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | No | path value | Preset name. Must equal presetName (case-insensitive); defaults to the path value when omitted. |
| ruleValue | string | Yes | - | Java regex pattern matched against prompt content |
| action | string | Yes | - | Action applied on match: BLOCK, FLAG, MASK |
| category | string | No | - | Optional category label (e.g. jailbreak, injection, system-leak) |
| description | string | No | - | Optional description for display |
| enabled | boolean | No | - | Whether the preset is active |
| owaspLlmId | string | No | - | Optional OWASP GenAI LLM Top 10 category id (e.g. LLM01, LLM08) for your own classification |
| mitreAtlasTechnique | string | No | - | Optional MITRE ATLAS technique id (e.g. AML.T0054) for your own classification |
Notes
- The request body must not be empty
namein the body must matchpresetNamein the path (case-insensitive)- When a preset with this name already exists in the scope — including a built-in (
builtIn: true) row — it is updated rather than duplicated; the call is safe to repeat from a CI/CD pipeline builtInis server-controlled and ignored on write — it is always derived from the persisted record, so you cannot forge a new row as built-in via the APIidandpackageVersionare server-controlled and ignored on write
Response
Success Response (200 OK)
{
"status": "SUCCESS",
"deploymentResult": {
"success": true
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
| status | string | Response status: SUCCESS or FAILURE |
| deploymentResult | object | Deployment result summary |
| deploymentResult.success | boolean | true when the preset was saved successfully |
Error Response (400 Bad Request)
Returned on validation failure, name mismatch, or when the caller lacks the ADMIN role.
{
"status": "FAILURE",
"resultMessage": "AI prompt-guard preset name in path (block-internal-hostnames) does not match name in body (other-name)!"
}
Other possible messages:
{
"status": "FAILURE",
"resultMessage": "AI prompt-guard preset body can not be empty!"
}
Error Response (401 Unauthorized)
{
"status": "FAILURE",
"resultMessage": "Token is not valid!"
}
cURL Example
curl -X POST \
"https://demo.apinizer.com/apiops/settings/ai-prompt-guard-presets/block-internal-hostnames/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "block-internal-hostnames",
"ruleValue": "(?i)internal\\.corp\\.local",
"action": "FLAG",
"category": "system-leak",
"description": "Flags mentions of internal hostnames",
"enabled": true
}'
Notes and Warnings
- Admin Only:
- Only sysAdmin users (or users with the
ADMINrole) can create AI prompt-guard presets - A project-scoped
AI_DEVELOPMENTtoken is not sufficient
- Only sysAdmin users (or users with the
- Upsert by Name:
- If a preset with the same name already exists in the scope — this includes a built-in (
builtIn: true) row, which is not read-only on this endpoint — this call updates it - Otherwise a new custom preset is created
- If a preset with the same name already exists in the scope — this includes a built-in (
- Regex Pattern:
ruleValueis a Java regex; remember to escape backslashes in JSON (e.g.\\.for a literal dot)
- No Secret Fields:
- Prompt-guard presets carry no secret (
@SecretData) fields, so no values are masked
- Prompt-guard presets carry no secret (
Related Documentation
- Update AI Prompt-Guard Preset - Update an existing preset
- Delete AI Prompt-Guard Preset - Delete a preset
- AI Prompt-Guard Presets API - Resource overview