Download OpenAPI specification:Download
REST API for managing dynamic policies in AxonFlow.
Policies define conditions and actions for request processing, enabling:
migrations/core/172 revokes INSERT, UPDATE, DELETE and TRUNCATE on the
legacy policy tables (static_policies, dynamic_policies) from the
application roles. Create, update, delete and bulk import on
/api/v1/policies, /api/v1/tenant-policies and the deprecated
/api/v1/dynamic-policies therefore answer
409 LEGACY_POLICY_WRITE_FROZEN naming the replacement. It is not an
entitlement fact: no licence, edition or upgrade changes it.
POST /api/v1/templates/{id}/apply creates a policy in the same table and
answers the same 409.
/api/v1/typed-policies, specified in orchestrator-api.yaml (validate,
publish, activate). That is the only customer write path in v11, on
every edition.AXONFLOW_DB_USE_APP_ROLE alone.409 LEGACY_POLICY_WRITE_FROZEN before the request body is
read, so a malformed body gets the same answer as a valid one.The Agent (port 8080) is the single entry point for all client traffic
(ADR-024). Clients authenticate at the Agent with HTTP Basic auth
(clientId:clientSecret); the Agent proxies policy requests to the
Orchestrator and stamps the X-Tenant-ID header from the authenticated
client's tenant. When calling the Orchestrator directly (internal
deployments only), supply X-Tenant-ID yourself. X-User-ID is optional
and used for audit attribution.
Note: /api/v1/templates* is NOT proxied by the Agent — the template
endpoints are reachable only on the Orchestrator directly (or via the
customer portal catch-all).
Policies are isolated per tenant. Each API call operates only on policies belonging to the authenticated tenant.
agent-api.yaml. Its current path spelling is
/api/v1/system-policies*; /api/v1/static-policies* is the deprecated
spelling and is still served.The terminology migration renaming static to system and dynamic to tenant policy endpoints has shipped. The alias routes exist and are served on both APIs.
On this API /api/v1/tenant-policies is the current spelling and
/api/v1/dynamic-policies is the deprecated one. The deprecated paths
remain served by the same handlers and return the same status codes and
bodies; they additionally carry Deprecation and Link response headers
naming the replacement.
No removal date is published for the deprecated spelling and no Sunset
header is emitted, so clients should not infer one. Migrate when
convenient and watch the release notes.
Tenant policy CRUD via the ADR-024 /api/v1/tenant-policies surface
(Orchestrator, proxied by the Agent). Accepts only policies whose
category starts with dynamic- or media-.
Note the category prefixes keep their original spelling. The terminology migration renamed the PATHS only; the category vocabulary is a separate, stored value on every existing policy row and renaming it would be a data migration, not an alias.
Retrieve a paginated list of dynamic policies. Only policies whose
category starts with dynamic- or media- are returned. When
type=media is passed without a category, results are filtered to
media-* categories.
limit is the preferred pagination parameter; page_size is
deprecated but still accepted.
| type | string (PolicyType) Enum: "content" "user" "risk" "cost" "context_aware" "media" "rate-limit" "budget" "time-access" "role-access" "mcp" "connector" Filter by policy type |
| category | string Filter by category. Must start with |
| enabled | boolean Filter by enabled status |
| search | string <= 100 characters Search in policy name and description |
| page | integer >= 1 Default: 1 Page number (1-indexed) |
| limit | integer [ 1 .. 100 ] Default: 20 Items per page (preferred over the deprecated page_size) |
| page_size | integer [ 1 .. 100 ] Deprecated Items per page (deprecated - use limit instead) |
| sort_by | string Default: "created_at" Enum: "name" "created_at" "updated_at" "priority" Sort field |
| sort_dir | string Default: "desc" Enum: "asc" "desc" Sort direction |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "policies": [
- {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "pagination": {
- "page": 1,
- "page_size": 20,
- "total_items": 45,
- "total_pages": 3
}
}Create a new dynamic policy. category is required and must start
with dynamic- or media- (e.g., dynamic-risk, media-safety).
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| X-User-ID |
| name required | string [ 3 .. 100 ] characters |
| description | string <= 500 characters |
| type required | string (PolicyType) Enum: "content" "user" "risk" "cost" "context_aware" "media" "rate-limit" "budget" "time-access" "role-access" "mcp" "connector" Policy type determines evaluation context:
|
| category | string Policy category (dynamic-risk, dynamic-compliance, media-safety, etc.).
Required on the /api/v1/dynamic-policies surface, where it must
start with |
| tier | string Enum: "organization" "tenant" Policy tier. Only organization or tenant is allowed via the API. |
required | Array of objects (PolicyCondition) non-empty |
required | Array of objects (PolicyAction) non-empty |
| priority | integer [ 0 .. 1000 ] Default: 0 |
| enabled | boolean Default: true |
| tags | Array of strings Tags for categorization |
{- "name": "string",
- "description": "string",
- "type": "content",
- "category": "string",
- "tier": "organization",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "tags": [
- "string"
]
}{- "policy": {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Bulk import dynamic policies from JSON. Supports up to 100 policies
per request. Every policy must have a category starting with
dynamic- or media-.
On a deployment whose database connection cannot write the legacy
policy tables (migrations/core/172), the request is refused 409 LEGACY_POLICY_WRITE_FROZEN before its body is read, whatever it
contains, and the refusal names the typed authoring route. An
owner-role deployment still imports.
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| X-User-ID |
required | Array of objects (CreatePolicyRequest) [ 1 .. 100 ] items |
| overwrite_mode | string Default: "skip" Enum: "skip" "overwrite" "error" How to handle existing policies |
{- "policies": [
- {
- "name": "string",
- "description": "string",
- "type": "content",
- "category": "string",
- "tier": "organization",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "tags": [
- "string"
]
}
], - "overwrite_mode": "skip"
}{- "created": 0,
- "updated": 0,
- "skipped": 0,
- "errors": [
- "string"
]
}Export the tenant's dynamic policies as JSON. Only policies with a
dynamic-* or media-* category are included.
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "policies": [
- {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "exported_at": "2019-08-24T14:15:22Z",
- "tenant_id": "string"
}Returns the enabled dynamic policies for the tenant (both dynamic-*
and media-* categories), sorted by priority ascending. Returns up to
100 policies.
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "policies": [
- {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "pagination": {
- "page": 1,
- "page_size": 20,
- "total_items": 45,
- "total_pages": 3
}
}Retrieve a single dynamic policy by ID. Returns 404 if the policy
exists but is not a dynamic policy (category not dynamic-*/media-*).
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "policy": {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Update an existing dynamic policy. Only provided fields are updated.
If category is changed, the new value must still start with
dynamic- or media-.
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| X-User-ID |
| name | string [ 3 .. 100 ] characters |
| description | string <= 500 characters |
| type | string (PolicyType) Enum: "content" "user" "risk" "cost" "context_aware" "media" "rate-limit" "budget" "time-access" "role-access" "mcp" "connector" Policy type determines evaluation context:
|
| category | string Policy category. Only changeable on non-system policies. |
Array of objects (PolicyCondition) | |
Array of objects (PolicyAction) | |
| priority | integer [ 0 .. 1000 ] |
| enabled | boolean |
| tags | Array of strings Tags for categorization |
{- "name": "string",
- "description": "string",
- "type": "content",
- "category": "string",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 1000,
- "enabled": true,
- "tags": [
- "string"
]
}{- "policy": {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Soft-delete a dynamic policy. The policy is marked as deleted but retained for audit purposes.
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| X-User-ID |
{- "error": {
- "code": "VALIDATION_ERROR",
- "message": "Request validation failed",
- "details": [
- {
- "field": "name",
- "message": "Name must be between 3 and 100 characters"
}, - {
- "field": "conditions[0].operator",
- "message": "Invalid operator: like. Must be one of: equals, contains, regex"
}
]
}
}Retrieve the complete version history of a dynamic policy for audit purposes
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "versions": [
- {
- "version": 0,
- "snapshot": {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "changed_by": "string",
- "changed_at": "2019-08-24T14:15:22Z",
- "change_type": "create",
- "change_summary": "string"
}
]
}DEPRECATED spelling of Tenant Policies, served at
/api/v1/dynamic-policies. Every operation is the same handler as its
/api/v1/tenant-policies counterpart and returns the same status code
and body.
In v11 BOTH spellings are the deprecated export surface (PRD §1.11):
reads are served, and every response carries
Link: </api/v1/typed-policies>; rel="successor-version" and
X-AxonFlow-Removed-In: v11.1, plus an RFC 9745
Deprecation: @<epoch> from the v11.0.0 tag. v11.1 removes both
spellings; there is no Sunset header until that release has a date.
Retrieve a paginated list of dynamic policies. Only policies whose
category starts with dynamic- or media- are returned. When
type=media is passed without a category, results are filtered to
media-* categories.
limit is the preferred pagination parameter; page_size is
deprecated but still accepted.
| type | string (PolicyType) Enum: "content" "user" "risk" "cost" "context_aware" "media" "rate-limit" "budget" "time-access" "role-access" "mcp" "connector" Filter by policy type |
| category | string Filter by category. Must start with |
| enabled | boolean Filter by enabled status |
| search | string <= 100 characters Search in policy name and description |
| page | integer >= 1 Default: 1 Page number (1-indexed) |
| limit | integer [ 1 .. 100 ] Default: 20 Items per page (preferred over the deprecated page_size) |
| page_size | integer [ 1 .. 100 ] Deprecated Items per page (deprecated - use limit instead) |
| sort_by | string Default: "created_at" Enum: "name" "created_at" "updated_at" "priority" Sort field |
| sort_dir | string Default: "desc" Enum: "asc" "desc" Sort direction |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "policies": [
- {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "pagination": {
- "page": 1,
- "page_size": 20,
- "total_items": 45,
- "total_pages": 3
}
}Create a new dynamic policy. category is required and must start
with dynamic- or media- (e.g., dynamic-risk, media-safety).
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| X-User-ID |
| name required | string [ 3 .. 100 ] characters |
| description | string <= 500 characters |
| type required | string (PolicyType) Enum: "content" "user" "risk" "cost" "context_aware" "media" "rate-limit" "budget" "time-access" "role-access" "mcp" "connector" Policy type determines evaluation context:
|
| category | string Policy category (dynamic-risk, dynamic-compliance, media-safety, etc.).
Required on the /api/v1/dynamic-policies surface, where it must
start with |
| tier | string Enum: "organization" "tenant" Policy tier. Only organization or tenant is allowed via the API. |
required | Array of objects (PolicyCondition) non-empty |
required | Array of objects (PolicyAction) non-empty |
| priority | integer [ 0 .. 1000 ] Default: 0 |
| enabled | boolean Default: true |
| tags | Array of strings Tags for categorization |
{- "name": "string",
- "description": "string",
- "type": "content",
- "category": "string",
- "tier": "organization",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "tags": [
- "string"
]
}{- "policy": {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Bulk import dynamic policies from JSON. Supports up to 100 policies
per request. Every policy must have a category starting with
dynamic- or media-.
On a deployment whose database connection cannot write the legacy
policy tables (migrations/core/172), the request is refused 409 LEGACY_POLICY_WRITE_FROZEN before its body is read, whatever it
contains, and the refusal names the typed authoring route. An
owner-role deployment still imports.
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| X-User-ID |
required | Array of objects (CreatePolicyRequest) [ 1 .. 100 ] items |
| overwrite_mode | string Default: "skip" Enum: "skip" "overwrite" "error" How to handle existing policies |
{- "policies": [
- {
- "name": "string",
- "description": "string",
- "type": "content",
- "category": "string",
- "tier": "organization",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "tags": [
- "string"
]
}
], - "overwrite_mode": "skip"
}{- "created": 0,
- "updated": 0,
- "skipped": 0,
- "errors": [
- "string"
]
}Export the tenant's dynamic policies as JSON. Only policies with a
dynamic-* or media-* category are included.
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "policies": [
- {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "exported_at": "2019-08-24T14:15:22Z",
- "tenant_id": "string"
}Returns the enabled dynamic policies for the tenant (both dynamic-*
and media-* categories), sorted by priority ascending. Returns up to
100 policies.
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "policies": [
- {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "pagination": {
- "page": 1,
- "page_size": 20,
- "total_items": 45,
- "total_pages": 3
}
}Retrieve a single dynamic policy by ID. Returns 404 if the policy
exists but is not a dynamic policy (category not dynamic-*/media-*).
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "policy": {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Update an existing dynamic policy. Only provided fields are updated.
If category is changed, the new value must still start with
dynamic- or media-.
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| X-User-ID |
| name | string [ 3 .. 100 ] characters |
| description | string <= 500 characters |
| type | string (PolicyType) Enum: "content" "user" "risk" "cost" "context_aware" "media" "rate-limit" "budget" "time-access" "role-access" "mcp" "connector" Policy type determines evaluation context:
|
| category | string Policy category. Only changeable on non-system policies. |
Array of objects (PolicyCondition) | |
Array of objects (PolicyAction) | |
| priority | integer [ 0 .. 1000 ] |
| enabled | boolean |
| tags | Array of strings Tags for categorization |
{- "name": "string",
- "description": "string",
- "type": "content",
- "category": "string",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 1000,
- "enabled": true,
- "tags": [
- "string"
]
}{- "policy": {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Soft-delete a dynamic policy. The policy is marked as deleted but retained for audit purposes.
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| X-User-ID |
{- "error": {
- "code": "VALIDATION_ERROR",
- "message": "Request validation failed",
- "details": [
- {
- "field": "name",
- "message": "Name must be between 3 and 100 characters"
}, - {
- "field": "conditions[0].operator",
- "message": "Invalid operator: like. Must be one of: equals, contains, regex"
}
]
}
}Retrieve the complete version history of a dynamic policy for audit purposes
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "versions": [
- {
- "version": 0,
- "snapshot": {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "changed_by": "string",
- "changed_at": "2019-08-24T14:15:22Z",
- "change_type": "create",
- "change_summary": "string"
}
]
}Retrieve a paginated list of policies with optional filtering
| type | string (PolicyType) Enum: "content" "user" "risk" "cost" "context_aware" "media" "rate-limit" "budget" "time-access" "role-access" "mcp" "connector" Filter by policy type |
| enabled | boolean Filter by enabled status |
| search | string <= 100 characters Search in policy name and description |
| page | integer >= 1 Default: 1 Page number (1-indexed) |
| page_size | integer [ 1 .. 100 ] Default: 20 Items per page |
| sort_by | string Default: "created_at" Enum: "name" "created_at" "updated_at" "priority" Sort field |
| sort_dir | string Default: "desc" Enum: "asc" "desc" Sort direction |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "policies": [
- {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "pagination": {
- "page": 1,
- "page_size": 20,
- "total_items": 45,
- "total_pages": 3
}
}Create a new policy with conditions and actions
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| X-User-ID |
| name required | string [ 3 .. 100 ] characters |
| description | string <= 500 characters |
| type required | string (PolicyType) Enum: "content" "user" "risk" "cost" "context_aware" "media" "rate-limit" "budget" "time-access" "role-access" "mcp" "connector" Policy type determines evaluation context:
|
| category | string Policy category (dynamic-risk, dynamic-compliance, media-safety, etc.).
Required on the /api/v1/dynamic-policies surface, where it must
start with |
| tier | string Enum: "organization" "tenant" Policy tier. Only organization or tenant is allowed via the API. |
required | Array of objects (PolicyCondition) non-empty |
required | Array of objects (PolicyAction) non-empty |
| priority | integer [ 0 .. 1000 ] Default: 0 |
| enabled | boolean Default: true |
| tags | Array of strings Tags for categorization |
{- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "conditions": [
- {
- "field": "query",
- "operator": "contains_any",
- "value": [
- "ssn",
- "social security",
- "credit card"
]
}, - {
- "field": "user.role",
- "operator": "not_in",
- "value": [
- "admin",
- "compliance"
]
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Access to PII requires admin or compliance role"
}
}
], - "priority": 100,
- "enabled": true
}{- "policy": {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Retrieve a single policy by ID
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "policy": {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Update an existing policy. Only provided fields are updated.
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| X-User-ID |
| name | string [ 3 .. 100 ] characters |
| description | string <= 500 characters |
| type | string (PolicyType) Enum: "content" "user" "risk" "cost" "context_aware" "media" "rate-limit" "budget" "time-access" "role-access" "mcp" "connector" Policy type determines evaluation context:
|
| category | string Policy category. Only changeable on non-system policies. |
Array of objects (PolicyCondition) | |
Array of objects (PolicyAction) | |
| priority | integer [ 0 .. 1000 ] |
| enabled | boolean |
| tags | Array of strings Tags for categorization |
{- "name": "string",
- "description": "string",
- "type": "content",
- "category": "string",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 1000,
- "enabled": true,
- "tags": [
- "string"
]
}{- "policy": {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
}Soft-delete a policy. The policy is marked as deleted but retained for audit purposes.
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| X-User-ID |
{- "error": {
- "code": "UNAUTHORIZED",
- "message": "Missing tenant ID"
}
}Retrieve the complete version history of a policy for audit purposes
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "versions": [
- {
- "version": 0,
- "snapshot": {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "changed_by": "string",
- "changed_at": "2019-08-24T14:15:22Z",
- "change_type": "create",
- "change_summary": "string"
}
]
}Legacy endpoint. Returns the array of active dynamic policies visible to the CALLING tenant — its own plus the shared global/default baseline (no pagination). Policies owned by other tenants are never returned in the same response, and requests without a resolvable tenant are rejected with 401 (fail closed).
The tenant scope is read from the X-Tenant-ID header. When the
request arrives through the AxonFlow Agent, that header is set from
the validated credential and overwrites any client-supplied value,
so the caller cannot choose the scope. The orchestrator itself does
not authenticate this route, so a caller with direct network access
to the orchestrator can name a tenant — deploy the orchestrator on a
private network behind the Agent.
Prefer GET /api/v1/dynamic-policies.
[- { }
]Evaluate a dynamic policy against sample input without executing
actions. query is required.
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| query required | string Sample query to test against |
object User context for testing | |
| request_type | string Type of request being simulated |
object Additional context for testing |
{- "query": "string",
- "request_type": "string",
- "context": { }
}{- "matched": true,
- "blocked": true,
- "actions": [
- {
- "type": "string",
- "config": { },
- "message": "string"
}
], - "explanation": "string",
- "eval_time_ms": 0.1
}Evaluate a dynamic policy against sample input without executing
actions. query is required.
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| query required | string Sample query to test against |
object User context for testing | |
| request_type | string Type of request being simulated |
object Additional context for testing |
{- "query": "string",
- "request_type": "string",
- "context": { }
}{- "matched": true,
- "blocked": true,
- "actions": [
- {
- "type": "string",
- "config": { },
- "message": "string"
}
], - "explanation": "string",
- "eval_time_ms": 0.1
}Evaluate a policy against sample input without executing actions. Useful for validating policy behavior before enabling.
| id required | string Example: pol_abc123def456 Policy unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| query required | string Sample query to test against |
object User context for testing | |
| request_type | string Type of request being simulated |
object Additional context for testing |
{- "query": "Show me the customer's SSN and credit card",
- "request_type": "query",
- "context": {
- "connector": "salesforce"
}
}{- "matched": true,
- "blocked": true,
- "actions": [
- {
- "type": "block",
- "config": {
- "message": "Access to PII requires admin or compliance role"
}, - "message": "Access to PII requires admin or compliance role"
}
], - "explanation": "Policy 'Block PII Access' matched: all 2 conditions evaluated to true",
- "eval_time_ms": 0.45
}Legacy endpoint. Evaluates the supplied input against all active
dynamic policies and returns the raw policy evaluation result. Prefer
POST /api/v1/policies/simulate (dry-run semantics, tier-aware) or
POST /api/v1/dynamic-policies/{id}/test (single-policy testing).
| query | string Sample query to test against |
object (SimulationUserContext) User context for policy simulation and testing | |
| request_type | string Type of request being simulated |
{- "query": "string",
- "user": {
- "id": 0,
- "role": "analyst",
- "region": "string",
- "permissions": [
- "string"
], - "tenant_id": "string",
- "org_id": "string"
}, - "request_type": "string"
}{- "allowed": true,
- "applied_policies": [
- "string"
], - "risk_score": 0.1,
- "severity": "string",
- "required_actions": [
- "string"
], - "processing_time_ms": 0
}Run all active policies against the provided input as a dry run — no audit writes and no policy actions are applied.
Evaluation tier and above — requires an Evaluation or Enterprise license. Daily simulation quotas apply per tier (unlimited on Enterprise); exceeding the quota returns 429.
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| query required | string Input to evaluate against all active policies |
| request_type | string Type of request being simulated (defaults to "simulation") |
object (SimulationUserContext) User context for policy simulation and testing | |
object (SimulationClientContext) Client context for policy simulation | |
object Additional context for evaluation |
{- "query": "string",
- "request_type": "string",
- "user": {
- "id": 0,
- "role": "analyst",
- "region": "string",
- "permissions": [
- "string"
], - "tenant_id": "string",
- "org_id": "string"
}, - "client": {
- "id": "string",
- "name": "string",
- "org_id": "string",
- "tenant_id": "string"
}, - "context": { }
}{- "allowed": true,
- "applied_policies": [
- "string"
], - "risk_score": 0.1,
- "required_actions": [
- "string"
], - "processing_time_ms": 0,
- "total_policies": 0,
- "dry_run": true,
- "simulated_at": "2019-08-24T14:15:22Z",
- "tier": "string",
- "daily_usage": {
- "used": 0,
- "limit": 0
}
}Test a single policy against multiple inputs and return aggregate match/block statistics plus per-input results.
Evaluation tier and above — requires an Evaluation or Enterprise license. The number of inputs per request is capped per tier.
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| policy_id required | string Policy to test against the inputs |
required | Array of objects (ImpactReportInput) non-empty Test inputs (per-tier maximum applies) |
{- "policy_id": "string",
- "inputs": [
- {
- "query": "string",
- "request_type": "string",
- "user": { },
- "context": { }
}
]
}{- "policy_id": "string",
- "policy_name": "string",
- "total_inputs": 0,
- "matched": 0,
- "blocked": 0,
- "match_rate": 0.1,
- "block_rate": 0.1,
- "results": [
- {
- "input_index": 0,
- "matched": true,
- "blocked": true,
- "actions": [
- "string"
]
}
], - "processing_time_ms": 0,
- "generated_at": "2019-08-24T14:15:22Z",
- "tier": "string"
}Analyze the tenant's active policies for contradictions, shadows, and
redundancies. Optionally scope the analysis to a single policy by
passing policy_id in the request body (the body may be omitted
entirely to check all policies).
Evaluation tier and above — requires an Evaluation or Enterprise license. Counts against the daily simulation quota.
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| policy_id | string Optional: check a specific policy against all others |
{- "policy_id": "string"
}{- "conflicts": [
- {
- "policy_a": {
- "id": "string",
- "name": "string",
- "type": "string"
}, - "policy_b": {
- "id": "string",
- "name": "string",
- "type": "string"
}, - "conflict_type": "contradictory_action",
- "description": "string",
- "severity": "high",
- "overlapping_field": "string"
}
], - "total_policies": 0,
- "conflict_count": 0,
- "checked_at": "2019-08-24T14:15:22Z",
- "tier": "string"
}Bulk import policies from JSON. Supports up to 100 policies per request.
Overwrite modes:
skip: Skip policies that already exist (by name)overwrite: Update existing policieserror: Fail if any policy already existsOn a deployment whose database connection cannot write the legacy
policy tables (migrations/core/172), the request is refused 409 LEGACY_POLICY_WRITE_FROZEN before its body is read, whatever it
contains, and the refusal names the typed authoring route. An
owner-role deployment still imports.
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| X-User-ID |
required | Array of objects (CreatePolicyRequest) [ 1 .. 100 ] items |
| overwrite_mode | string Default: "skip" Enum: "skip" "overwrite" "error" How to handle existing policies |
{- "policies": [
- {
- "name": "string",
- "description": "string",
- "type": "content",
- "category": "string",
- "tier": "organization",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "tags": [
- "string"
]
}
], - "overwrite_mode": "skip"
}{- "created": 0,
- "updated": 0,
- "skipped": 0,
- "errors": [
- "string"
]
}Export all policies for the tenant as JSON
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "policies": [
- {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}
], - "exported_at": "2019-08-24T14:15:22Z",
- "tenant_id": "string"
}Retrieve available policy templates for quick policy creation. Templates provide pre-configured policies for common use cases like HIPAA compliance, GDPR data protection, and rate limiting.
| category | string Enum: "general" "security" "compliance" "content_safety" "rate_limiting" "access_control" "data_protection" "custom" Filter by template category |
| search | string Search in name and description |
| tags | string Comma-separated tags to filter by |
| active | boolean Filter by active status |
| builtin | boolean Filter by builtin status |
| page | integer >= 1 Default: 1 Page number (1-indexed) |
| page_size | integer [ 1 .. 100 ] Default: 20 Number of items per page |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "templates": [
- {
- "id": "hipaa_phi_protection",
- "name": "hipaa_phi_protection",
- "display_name": "HIPAA PHI Protection",
- "description": "Protects PHI data in accordance with HIPAA requirements",
- "category": "compliance",
- "subcategory": "healthcare",
- "template": {
- "type": "content",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
]
}, - "variables": [
- {
- "name": "threshold",
- "type": "string",
- "required": false,
- "default": "string",
- "description": "Maximum requests allowed per window",
- "validation": "string"
}
], - "is_builtin": true,
- "is_active": true,
- "version": "1.0",
- "tags": [
- "hipaa",
- "healthcare",
- "phi"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
], - "pagination": {
- "page": 1,
- "page_size": 20,
- "total_items": 45,
- "total_pages": 3
}
}Retrieve a single policy template by ID
| id required | string Example: hipaa_phi_protection Template unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "template": {
- "id": "hipaa_phi_protection",
- "name": "hipaa_phi_protection",
- "display_name": "HIPAA PHI Protection",
- "description": "Protects PHI data in accordance with HIPAA requirements",
- "category": "compliance",
- "subcategory": "healthcare",
- "template": {
- "type": "content",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
]
}, - "variables": [
- {
- "name": "threshold",
- "type": "string",
- "required": false,
- "default": "string",
- "description": "Maximum requests allowed per window",
- "validation": "string"
}
], - "is_builtin": true,
- "is_active": true,
- "version": "1.0",
- "tags": [
- "hipaa",
- "healthcare",
- "phi"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}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.
| id required | string Example: hipaa_phi_protection Template unique identifier |
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
| X-User-ID |
| policy_name required | string [ 3 .. 100 ] characters Name for the new policy |
| description | string <= 500 characters Optional policy description |
required | object Variable values for the template |
| enabled | boolean Default: false Whether to enable the policy immediately |
| priority | integer [ 0 .. 1000 ] Policy priority (overrides template default) |
{- "policy_name": "Production Rate Limit",
- "description": "Rate limiting for production API",
- "variables": {
- "threshold": 1000,
- "window_seconds": 60
}, - "enabled": true,
- "priority": 75
}{- "success": true,
- "policy": {
- "id": "pol_abc123def456",
- "name": "Block PII Access",
- "description": "Prevent unauthorized access to personally identifiable information",
- "type": "content",
- "category": "dynamic-risk",
- "tier": "system",
- "conditions": [
- {
- "field": "query",
- "operator": "equals",
- "value": "string"
}
], - "actions": [
- {
- "type": "block",
- "config": {
- "message": "Request blocked by policy",
- "channel": "security-alerts"
}
}
], - "priority": 0,
- "enabled": true,
- "version": 1,
- "tenant_id": "string",
- "organization_id": "string",
- "tags": [
- "string"
], - "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "created_by": "string",
- "updated_by": "string",
- "deleted_at": "2019-08-24T14:15:22Z"
}, - "usage_id": "string",
- "message": "string"
}Retrieve all available template categories
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "categories": [
- "general",
- "security",
- "compliance",
- "content_safety",
- "rate_limiting",
- "access_control",
- "data_protection",
- "custom"
]
}Retrieve usage statistics for templates in your tenant
| X-Tenant-ID required | string Example: tenant_abc123 Tenant identifier for multi-tenancy isolation. When calling through the Agent (recommended), this header is stamped automatically from the authenticated client — you do not set it yourself. Required only on direct Orchestrator calls (internal deployments). |
{- "stats": [
- {
- "template_id": "hipaa_phi_protection",
- "template_name": "HIPAA PHI Protection",
- "usage_count": 15,
- "last_used_at": "2025-01-15T14:30:00Z"
}, - {
- "template_id": "gdpr_data_protection",
- "template_name": "GDPR Data Protection",
- "usage_count": 8,
- "last_used_at": "2025-01-14T09:15:00Z"
}
]
}