Templates

Apply a template

Create a new policy from a template by providing variable values. Templates may have required and optional variables that customize the generated policy.

v11: the generated policy is written to dynamic_policies, which migrations/core/172 makes read-only to the application roles, so on a deployment whose database connection cannot write it this route answers 409 LEGACY_POLICY_WRITE_FROZEN before the request body is read, whatever it contains, as the policy write routes do. An owner-role deployment still applies.

post/api/v1/templates/{id}/apply

Request

Headers

X-User-IDstring
Example:user@company.com

User identifier for audit logging

Request body

policy_namestring required

Name for the new policy

descriptionstring

Optional policy description

variablesobject required

Variable values for the template

enabledboolean

Whether to enable the policy immediately

priorityinteger

Policy priority (overrides template default)

Response

Policy created from template

successboolean
usage_idstring

Unique ID for this template usage (for analytics)

messagestring

Success message

Example response

{
  "policy": {
    "id": "pol_abc123def456",
    "name": "Block PII Access",
    "description": "Prevent unauthorized access to personally identifiable information",
    "category": "dynamic-risk",
    "actions": [
      {
        "config": {
          "message": "Request blocked by policy",
          "channel": "security-alerts"
        }
      }
    ]
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.