Skip to main content
POST
Create Policy

Authorizations

X-API-Key
string
header
required

PromptGuard API key for developer endpoints. Keys start with pg_live_ and are created in the dashboard.

Headers

x-api-key
string | null
PromptGuard-Approval
string | null

The approval_id of an approval_required refusal, once your user has approved it. Send the same method, path, query and body.

Maximum string length: 64

Path Parameters

project_id
string
required

Body

application/json

A new policy on the project the route names.

name
string
required
Required string length: 1 - 255
description
string | null
policy_type
string
default:input_filter
status
string
default:active
priority
integer
default:100
Required range: 1 <= x <= 1000
rules
PolicyRule · object[]
threat_types
string[]
system_prompt_details
string | null

Response

Successful Response

Policy response schema

id
string
required
user_id
string
required
name
string
required
description
string | null
required
policy_type
string
required
status
string
required
priority
integer
required
rules
Rules · object[]
required
threat_types
string[]
required
is_default
boolean
required
triggered_count
integer
required
created_at
string<date-time>
required
updated_at
string<date-time>
required
enforced
boolean
required

False for a policy of a type the engine does not enforce: a rate_limit policy saved before such policies were refused. Rate limits are set per API key (rate_limit_per_minute) and by the Plan.

project_id
string | null
system_prompt_details
string | null
warnings
PolicyWarning · object[]