AxonFlow Policies API
Dynamic policy CRUD operations (Orchestrator)
Dynamic policy CRUD operations (Orchestrator)
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/axonflow:axonflow-policies-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: AxonFlow Policy Management Policies API
description: REST API for managing dynamic policies in AxonFlow.
version: 11.1.0
contact:
name: AxonFlow Support
url: https://getaxonflow.com/support
license:
name: Business Source License 1.1
url: https://github.com/getaxonflow/axonflow/blob/main/LICENSE
servers:
- url: https://agent.getaxonflow.com
description: Production (Agent single entry point, ADR-024)
- url: http://localhost:8080
description: Local development (Agent single entry point)
- url: http://localhost:8081
description: Orchestrator direct (internal only)
tags:
- name: Policies
description: Dynamic policy CRUD operations (Orchestrator)
paths:
/api/v1/policies:
get:
deprecated: true
tags:
- Policies
summary: List policies
description: Retrieve a paginated list of policies with optional filtering
operationId: listPolicies
parameters:
- $ref: '#/components/parameters/TenantID'
- name: type
in: query
description: Filter by policy type
schema:
$ref: '#/components/schemas/PolicyType'
- name: enabled
in: query
description: Filter by enabled status
schema:
type: boolean
- name: search
in: query
description: Search in policy name and description
schema:
type: string
maxLength: 100
- name: page
in: query
description: Page number (1-indexed)
schema:
type: integer
minimum: 1
default: 1
- name: page_size
in: query
description: Items per page
schema:
type: integer
minimum: 1
maximum: 100
default: 20
- name: sort_by
in: query
description: Sort field
schema:
type: string
enum:
- name
- created_at
- updated_at
- priority
default: created_at
- name: sort_dir
in: query
description: Sort direction
schema:
type: string
enum:
- asc
- desc
default: desc
responses:
'200':
description: List of policies
content:
application/json:
schema:
$ref: '#/components/schemas/PoliciesListResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalError'
post:
deprecated: true
tags:
- Policies
summary: Create a policy
description: Create a new policy with conditions and actions
operationId: createPolicy
parameters:
- $ref: '#/components/parameters/TenantID'
- $ref: '#/components/parameters/UserID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreatePolicyRequest'
examples:
contentFilter:
summary: Content filtering policy
value:
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
riskScoring:
summary: Risk-based blocking
value:
name: High Risk Block
description: Block requests with risk score above threshold
type: risk
conditions:
- field: risk_score
operator: greater_than
value: 0.8
actions:
- type: block
config:
message: Request blocked due to high risk score
- type: alert
config:
channel: security-alerts
priority: 200
enabled: true
responses:
'201':
description: Policy created
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyResponse'
'400':
$ref: '#/components/responses/ValidationError'
'401':
$ref: '#/components/responses/Unauthorized'
'409':
$ref: '#/components/responses/LegacyPolicyWriteFrozen'
'500':
$ref: '#/components/responses/InternalError'
/api/v1/policies/{id}:
parameters:
- $ref: '#/components/parameters/PolicyID'
- $ref: '#/components/parameters/TenantID'
get:
deprecated: true
tags:
- Policies
summary: Get a policy
description: Retrieve a single policy by ID
operationId: getPolicy
responses:
'200':
description: Policy details
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
put:
deprecated: true
tags:
- Policies
summary: Update a policy
description: Update an existing policy. Only provided fields are updated.
operationId: updatePolicy
parameters:
- $ref: '#/components/parameters/UserID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdatePolicyRequest'
responses:
'200':
description: Policy updated
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyResponse'
'400':
$ref: '#/components/responses/ValidationError'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/LegacyPolicyWriteFrozen'
'500':
$ref: '#/components/responses/InternalError'
delete:
deprecated: true
tags:
- Policies
summary: Delete a policy
description: Soft-delete a policy. The policy is marked as deleted but retained for audit purposes.
operationId: deletePolicy
parameters:
- $ref: '#/components/parameters/UserID'
responses:
'204':
description: Policy deleted
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/LegacyPolicyWriteFrozen'
'500':
$ref: '#/components/responses/InternalError'
/api/v1/policies/{id}/versions:
parameters:
- $ref: '#/components/parameters/PolicyID'
- $ref: '#/components/parameters/TenantID'
get:
deprecated: true
tags:
- Policies
summary: Get policy version history
description: Retrieve the complete version history of a policy for audit purposes
operationId: getPolicyVersions
responses:
'200':
description: Version history
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyVersionResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'
/api/v1/policies/dynamic:
get:
tags:
- Policies
summary: List active dynamic policies (legacy)
deprecated: true
description: '**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`.'
operationId: listActiveDynamicPoliciesLegacy
responses:
'200':
description: Array of active dynamic policies visible to the calling tenant
content:
application/json:
schema:
type: array
items:
type: object
additionalProperties: true
description: Engine-internal dynamic policy representation
'401':
description: Tenant scope could not be resolved (missing gateway-stamped X-Tenant-ID); fails closed with no policy data
components:
schemas:
PolicyResource:
type: object
properties:
id:
type: string
description: Unique policy identifier
example: pol_abc123def456
name:
type: string
description: Human-readable policy name
minLength: 3
maxLength: 100
example: Block PII Access
description:
type: string
description: Detailed policy description
maxLength: 500
example: Prevent unauthorized access to personally identifiable information
type:
$ref: '#/components/schemas/PolicyType'
category:
type: string
description: Policy category (dynamic-risk, dynamic-compliance, media-safety, etc.)
example: dynamic-risk
tier:
type: string
enum:
- system
- organization
- tenant
description: Policy tier in the hierarchy (system policies are immutable)
conditions:
type: array
items:
$ref: '#/components/schemas/PolicyCondition'
minItems: 1
description: Conditions that must all match (AND logic)
actions:
type: array
items:
$ref: '#/components/schemas/PolicyAction'
minItems: 1
description: Actions to execute when policy matches
priority:
type: integer
minimum: 0
maximum: 1000
default: 0
description: Higher priority policies are evaluated first
enabled:
type: boolean
default: true
description: Whether the policy is active
version:
type: integer
minimum: 1
description: Policy version number, incremented on each update
tenant_id:
type: string
description: Owning tenant ID
organization_id:
type: string
description: 'The organisation that owns this policy. Since #3490 the
organisation is what SELECTS a policy row, at every tier -- this
is not an organization-tier-only field, and the previous wording
described the retired organization_id COLUMN rather than this
resource field.
'
tags:
type: array
items:
type: string
description: Tags for categorization
created_at:
type: string
format: date-time
description: Creation timestamp
updated_at:
type: string
format: date-time
description: Last update timestamp
created_by:
type: string
description: User who created the policy
updated_by:
type: string
description: User who last updated the policy
deleted_at:
type: string
format: date-time
description: Soft-delete timestamp (present only on deleted policies)
UpdatePolicyRequest:
type: object
properties:
name:
type: string
minLength: 3
maxLength: 100
description:
type: string
maxLength: 500
type:
$ref: '#/components/schemas/PolicyType'
category:
type: string
description: Policy category. Only changeable on non-system policies.
conditions:
type: array
items:
$ref: '#/components/schemas/PolicyCondition'
actions:
type: array
items:
$ref: '#/components/schemas/PolicyAction'
priority:
type: integer
minimum: 0
maximum: 1000
enabled:
type: boolean
tags:
type: array
items:
type: string
description: Tags for categorization
PolicyResponse:
type: object
properties:
policy:
$ref: '#/components/schemas/PolicyResource'
PolicyCondition:
type: object
required:
- field
- operator
- value
properties:
field:
type: string
description: 'Field to evaluate. `media.*` fields apply to media governance
policies (multimodal image governance); `step.*` fields are
retry-aware workflow step fields for WCP policies.
'
enum:
- query
- response
- user.email
- user.role
- user.department
- user.tenant_id
- risk_score
- request_type
- connector
- cost_estimate
- media.has_faces
- media.face_count
- media.has_biometric_data
- media.nsfw_score
- media.violence_score
- media.content_safe
- media.document_type
- media.is_sensitive_document
- media.has_pii
- media.pii_types
- media.has_extracted_text
- media.extracted_text_length
- step.gate_count
- step.completion_count
- step.prior_completion_status
- step.prior_output_available
- step.last_decision
- step.first_attempt_age_seconds
- step.idempotency_key
operator:
$ref: '#/components/schemas/ConditionOperator'
value:
oneOf:
- type: string
- type: number
- type: boolean
- type: array
items:
type: string
description: Value to compare against
PaginationMeta:
type: object
description: Pagination metadata
properties:
page:
type: integer
description: Current page number
example: 1
page_size:
type: integer
description: Items per page
example: 20
total_items:
type: integer
description: Total number of items
example: 45
total_pages:
type: integer
description: Total number of pages
example: 3
PoliciesListResponse:
type: object
properties:
policies:
type: array
items:
$ref: '#/components/schemas/PolicyResource'
pagination:
$ref: '#/components/schemas/PaginationMeta'
PolicyAction:
type: object
required:
- type
properties:
type:
$ref: '#/components/schemas/ActionType'
config:
type: object
additionalProperties: true
description: Action-specific configuration
example:
message: Request blocked by policy
channel: security-alerts
CreatePolicyRequest:
type: object
required:
- name
- type
- conditions
- actions
properties:
name:
type: string
minLength: 3
maxLength: 100
description:
type: string
maxLength: 500
type:
$ref: '#/components/schemas/PolicyType'
category:
type: string
description: 'Policy category (dynamic-risk, dynamic-compliance, media-safety, etc.).
Required on the /api/v1/dynamic-policies surface, where it must
start with `dynamic-` or `media-`.
'
tier:
type: string
enum:
- organization
- tenant
description: Policy tier. Only organization or tenant is allowed via the API.
conditions:
type: array
items:
$ref: '#/components/schemas/PolicyCondition'
minItems: 1
actions:
type: array
items:
$ref: '#/components/schemas/PolicyAction'
minItems: 1
priority:
type: integer
minimum: 0
maximum: 1000
default: 0
enabled:
type: boolean
default: true
tags:
type: array
items:
type: string
description: Tags for categorization
ActionType:
type: string
enum:
- block
- require_approval
- redact
- warn
- alert
- log
- route
- modify_risk
description: 'Action to take when policy matches:
- `block`: Block the request with message
- `require_approval`: Hold the request for human approval (HITL)
- `redact`: Redact sensitive content from response
- `warn`: Allow the request but attach a warning
- `alert`: Send alert to configured channel
- `log`: Log to audit trail
- `route`: Route to specific provider
- `modify_risk`: Adjust risk score
'
PolicyType:
type: string
enum:
- content
- user
- risk
- cost
- context_aware
- media
- rate-limit
- budget
- time-access
- role-access
- mcp
- connector
description: 'Policy type determines evaluation context:
- `content`: Evaluates request/response content
- `user`: Evaluates user attributes
- `risk`: Evaluates risk scores
- `cost`: Evaluates cost estimates
- `context_aware`: Context-aware controls (tenant isolation, debug restriction, sensitive-data control)
- `media`: Media governance policies (multimodal image governance)
- `rate-limit`, `budget`, `time-access`: MCP rate/budget controls
- `role-access`, `mcp`, `connector`: MCP access controls
'
APIError:
type: object
properties:
error:
type: object
properties:
code:
type: string
description: Error code
message:
type: string
description: Human-readable error message
details:
type: array
items:
type: object
properties:
field:
type: string
message:
type: string
description: Field-level validation errors
PolicyVersionResponse:
type: object
properties:
versions:
type: array
items:
type: object
properties:
version:
type: integer
snapshot:
$ref: '#/components/schemas/PolicyResource'
changed_by:
type: string
changed_at:
type: string
format: date-time
change_type:
type: string
enum:
- create
- update
- enable
- disable
- delete
change_summary:
type: string
ConditionOperator:
type: string
enum:
- equals
- not_equals
- contains
- not_contains
- contains_any
- regex
- greater_than
- less_than
- in
- not_in
description: Comparison operator for conditions
responses:
Unauthorized:
description: Missing or invalid tenant ID
content:
application/json:
schema:
$ref: '#/components/schemas/APIError'
example:
error:
code: UNAUTHORIZED
message: Missing tenant ID
NotFound:
description: Policy not found
content:
application/json:
schema:
$ref: '#/components/schemas/APIError'
example:
error:
code: NOT_FOUND
message: Policy not found
InternalError:
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/APIError'
example:
error:
code: INTERNAL_ERROR
message: An unexpected error occurred
ValidationError:
description: Request validation failed
content:
application/json:
schema:
$ref: '#/components/schemas/APIError'
example:
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'
LegacyPolicyWriteFrozen:
description: 'The legacy policy tables are read-only. `migrations/core/172` revoked
INSERT, UPDATE, DELETE and TRUNCATE on `static_policies` and
`dynamic_policies` from the application roles, and this endpoint
writes them, so the write is refused permanently rather than
transiently. It is not an entitlement fact: no licence, edition or
upgrade changes it. Author policies through the typed authoring route
(`/api/v1/typed-policies`, in `orchestrator-api.yaml`) instead. Reads on
this endpoint are unaffected. A deployment whose connection may still
write the tables (the database owner; a property of the connection,
not of `AXONFLOW_DB_USE_APP_ROLE` alone) is not bound by the revoke
and does not receive this response. Where the connection cannot write
them, the create, update and bulk-import routes answer this before
reading the request body, whatever it contains.
'
content:
application/json:
schema:
$ref: '#/components/schemas/APIError'
example:
error:
code: LEGACY_POLICY_WRITE_FROZEN
message: 'The legacy policy tables are read-only in v11: migrations/core/172 revoked write access from the application role, and this endpoint writes them. Author policies through the typed authoring route at /api/v1/typed-policies instead. Reads on this endpoint are unaffected.'
parameters:
UserID:
name: X-User-ID
in: header
required: false
description: User identifier for audit logging
schema:
type: string
example: user@company.com
TenantID:
name: X-Tenant-ID
in: header
required: true
description: '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).
'
schema:
type: string
example: tenant_abc123
PolicyID:
name: id
in: path
required: true
description: Policy unique identifier
schema:
type: string
example: pol_abc123def456