Vijil policies API
The policies API from Vijil — 9 operation(s) for policies.
The policies API from Vijil — 9 operation(s) for policies.
openapi: 3.1.0
info:
title: Vijil Console API (Combined) agent-configurations policies API
description: Combined OpenAPI specification for all vijil-console microservices.
version: 0.1.0
tags:
- name: policies
paths:
/v1/policies/{policy_id}:
get:
tags:
- policies
summary: Get Policy
description: Get a policy by ID.
operationId: get_policy_v1_policies__policy_id__get
parameters:
- name: policy_id
in: path
required: true
schema:
type: string
format: uuid
title: Policy Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/Policy'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
patch:
tags:
- policies
summary: Update Policy
description: Update a policy.
operationId: update_policy_v1_policies__policy_id__patch
parameters:
- name: policy_id
in: path
required: true
schema:
type: string
format: uuid
title: Policy Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyUpdate'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/Policy'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
delete:
tags:
- policies
summary: Delete Policy
description: Delete a policy.
operationId: delete_policy_v1_policies__policy_id__delete
parameters:
- name: policy_id
in: path
required: true
schema:
type: string
format: uuid
title: Policy Id
responses:
'204':
description: Successful Response
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v1/policies/:
get:
tags:
- policies
summary: List Policies
description: List policies with optional filters and paging.
operationId: list_policies_v1_policies__get
parameters:
- name: category
in: query
required: false
schema:
anyOf:
- $ref: '#/components/schemas/PolicyCategory'
- type: 'null'
title: Category
- name: status
in: query
required: false
schema:
anyOf:
- $ref: '#/components/schemas/PolicyStatus'
- type: 'null'
title: Status
- name: search
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Search
- name: limit
in: query
required: false
schema:
type: integer
maximum: 100
minimum: 1
description: Maximum number of results (default 10)
default: 10
title: Limit
description: Maximum number of results (default 10)
- name: offset
in: query
required: false
schema:
type: integer
minimum: 0
description: Number of results to skip for paging
default: 0
title: Offset
description: Number of results to skip for paging
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyListResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
post:
tags:
- policies
summary: Create Policy
description: Create a new policy.
operationId: create_policy_v1_policies__post
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyCreate'
responses:
'201':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/Policy'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v1/policies/presets/:
get:
tags:
- policies
summary: List Presets
description: List system preset policies.
operationId: list_presets_v1_policies_presets__get
parameters:
- name: category
in: query
required: false
schema:
anyOf:
- $ref: '#/components/schemas/PolicyCategory'
- type: 'null'
title: Category
- name: limit
in: query
required: false
schema:
type: integer
maximum: 1000
minimum: 1
default: 100
title: Limit
- name: offset
in: query
required: false
schema:
type: integer
minimum: 0
default: 0
title: Offset
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyListResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v1/policies/presets/{preset_id}/copy:
post:
tags:
- policies
summary: Copy Preset
description: Create a copy of a preset policy for the team.
operationId: copy_preset_v1_policies_presets__preset_id__copy_post
parameters:
- name: preset_id
in: path
required: true
schema:
type: string
format: uuid
title: Preset Id
- name: name_override
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Name Override
responses:
'201':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/Policy'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v1/policies/{policy_id}/upload:
post:
tags:
- policies
summary: Upload File
description: 'Upload a policy document file (PDF, TXT, MD) using streaming.
The file will be streamed to S3 without loading entirely into memory.
Maximum file size: 10 MB.'
operationId: upload_file_v1_policies__policy_id__upload_post
parameters:
- name: policy_id
in: path
required: true
schema:
type: string
format: uuid
title: Policy Id
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/Body_upload_file_v1_policies__policy_id__upload_post'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/Policy'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v1/policies/{policy_id}/activate:
post:
tags:
- policies
summary: Activate Policy
description: Activate a policy (requires all rules to be approved).
operationId: activate_policy_v1_policies__policy_id__activate_post
parameters:
- name: policy_id
in: path
required: true
schema:
type: string
format: uuid
title: Policy Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/Policy'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v1/policies/{policy_id}/file:
get:
tags:
- policies
summary: Download File
description: 'Download the policy''s attached file.
Returns the file content with appropriate headers for download.'
operationId: download_file_v1_policies__policy_id__file_get
parameters:
- name: policy_id
in: path
required: true
schema:
type: string
format: uuid
title: Policy Id
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
delete:
tags:
- policies
summary: Delete File
description: 'Delete the attached file from a policy.
This removes the file from storage and clears file metadata,
but preserves any extracted source text.'
operationId: delete_file_v1_policies__policy_id__file_delete
parameters:
- name: policy_id
in: path
required: true
schema:
type: string
format: uuid
title: Policy Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/Policy'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v1/policies/{policy_id}/converted:
get:
tags:
- policies
summary: Download Converted File
description: 'Download the converted markdown file for a policy.
Returns the markdown file that was generated from the uploaded PDF.
Returns 400 if no converted file exists.'
operationId: download_converted_file_v1_policies__policy_id__converted_get
parameters:
- name: policy_id
in: path
required: true
schema:
type: string
format: uuid
title: Policy Id
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v1/policies/{policy_id}/rules:
get:
tags:
- policies
summary: List Policy Rules
description: List rules for a specific policy.
operationId: list_policy_rules_v1_policies__policy_id__rules_get
parameters:
- name: policy_id
in: path
required: true
schema:
type: string
format: uuid
title: Policy Id
- name: limit
in: query
required: false
schema:
type: integer
maximum: 1000
minimum: 1
default: 100
title: Limit
- name: offset
in: query
required: false
schema:
type: integer
minimum: 0
default: 0
title: Offset
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/src__service_agent_environment__api__policies__RuleListResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
post:
tags:
- policies
summary: Create Policy Rule
description: Create a new manual rule for a policy.
operationId: create_policy_rule_v1_policies__policy_id__rules_post
parameters:
- name: policy_id
in: path
required: true
schema:
type: string
format: uuid
title: Policy Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyRuleCreate'
responses:
'201':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyRule'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
components:
schemas:
RuleConsequence:
properties:
action:
type: string
title: Action
default: warn
severity:
$ref: '#/components/schemas/Severity'
default: medium
message:
anyOf:
- type: string
- type: 'null'
title: Message
type: object
title: RuleConsequence
description: Consequence when rule is triggered.
Severity:
type: string
enum:
- info
- low
- medium
- high
- critical
title: Severity
description: Severity level for rule consequences.
RuleStatus:
type: string
enum:
- draft
- approved
- rejected
- modified
title: RuleStatus
description: Review status of a policy rule.
PolicyCreate:
properties:
id:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Id
name:
type: string
maxLength: 255
minLength: 1
title: Name
description:
anyOf:
- type: string
- type: 'null'
title: Description
category:
$ref: '#/components/schemas/PolicyCategory'
source_text:
anyOf:
- type: string
- type: 'null'
title: Source Text
tags:
anyOf:
- items:
type: string
type: array
- type: 'null'
title: Tags
type: object
required:
- name
- category
title: PolicyCreate
description: Request model for creating a policy.
RuleConstraint:
properties:
condition_type:
type: string
title: Condition Type
field:
type: string
title: Field
operator:
type: string
title: Operator
value:
anyOf:
- type: string
- type: integer
- type: number
- type: boolean
- items:
type: string
type: array
title: Value
type: object
required:
- condition_type
- field
- operator
- value
title: RuleConstraint
description: Constraint for conditional rule application.
PolicyCategory:
type: string
enum:
- privacy
- ethics
- security
- compliance
- operational
- brand
- custom
title: PolicyCategory
description: Category of policy document.
Body_upload_file_v1_policies__policy_id__upload_post:
properties:
file:
type: string
format: binary
title: File
type: object
required:
- file
title: Body_upload_file_v1_policies__policy_id__upload_post
Policy:
properties:
id:
type: string
format: uuid
title: Id
team_id:
type: string
format: uuid
title: Team Id
name:
type: string
title: Name
description:
anyOf:
- type: string
- type: 'null'
title: Description
category:
$ref: '#/components/schemas/PolicyCategory'
status:
$ref: '#/components/schemas/PolicyStatus'
default: draft
source_text:
anyOf:
- type: string
- type: 'null'
title: Source Text
file_path:
anyOf:
- type: string
- type: 'null'
title: File Path
file_name:
anyOf:
- type: string
- type: 'null'
title: File Name
file_type:
anyOf:
- type: string
- type: 'null'
title: File Type
file_size_bytes:
anyOf:
- type: integer
- type: 'null'
title: File Size Bytes
converted_file_path:
anyOf:
- type: string
- type: 'null'
title: Converted File Path
is_preset:
type: boolean
title: Is Preset
default: false
preset_source:
anyOf:
- type: string
- type: 'null'
title: Preset Source
tags:
anyOf:
- items:
type: string
type: array
- type: 'null'
title: Tags
created_at:
type: integer
title: Created At
updated_at:
type: integer
title: Updated At
created_by:
type: string
format: uuid
title: Created By
type: object
required:
- id
- team_id
- name
- category
- created_at
- updated_at
- created_by
title: Policy
description: Domain model for Policy document.
PolicyUpdate:
properties:
name:
anyOf:
- type: string
maxLength: 255
minLength: 1
- type: 'null'
title: Name
description:
anyOf:
- type: string
- type: 'null'
title: Description
category:
anyOf:
- $ref: '#/components/schemas/PolicyCategory'
- type: 'null'
status:
anyOf:
- $ref: '#/components/schemas/PolicyStatus'
- type: 'null'
source_text:
anyOf:
- type: string
- type: 'null'
title: Source Text
tags:
anyOf:
- items:
type: string
type: array
- type: 'null'
title: Tags
type: object
title: PolicyUpdate
description: Request model for updating a policy. All fields are optional.
PolicyStatus:
type: string
enum:
- draft
- active
- archived
title: PolicyStatus
description: Status of a policy document.
SourceLocation:
properties:
section:
anyOf:
- type: string
- type: 'null'
title: Section
paragraph:
anyOf:
- type: integer
- type: 'null'
title: Paragraph
char_start:
anyOf:
- type: integer
- type: 'null'
title: Char Start
char_end:
anyOf:
- type: integer
- type: 'null'
title: Char End
source_text:
anyOf:
- type: string
- type: 'null'
title: Source Text
type: object
title: SourceLocation
description: Location in source document where rule was extracted from.
PolicyRule:
properties:
id:
type: string
format: uuid
title: Id
policy_id:
type: string
format: uuid
title: Policy Id
rule_id:
type: string
title: Rule Id
rule_type:
$ref: '#/components/schemas/RuleType'
action:
type: string
title: Action
target:
anyOf:
- type: string
- type: 'null'
title: Target
assignee:
anyOf:
- type: string
- type: 'null'
title: Assignee
default: agent
constraints:
anyOf:
- items:
$ref: '#/components/schemas/RuleConstraint'
type: array
- items:
additionalProperties: true
type: object
type: array
title: Constraints
default: []
constraint_logic:
type: string
title: Constraint Logic
default: all
consequence:
anyOf:
- $ref: '#/components/schemas/RuleConsequence'
- additionalProperties: true
type: object
title: Consequence
natural_language:
type: string
title: Natural Language
provenance:
anyOf:
- $ref: '#/components/schemas/RuleProvenance'
- additionalProperties: true
type: object
- type: 'null'
title: Provenance
category:
anyOf:
- $ref: '#/components/schemas/PolicyCategory'
- type: 'null'
tags:
anyOf:
- items:
type: string
type: array
- type: 'null'
title: Tags
status:
$ref: '#/components/schemas/RuleStatus'
default: draft
reviewed_by:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Reviewed By
reviewed_at:
anyOf:
- type: integer
- type: 'null'
title: Reviewed At
review_notes:
anyOf:
- type: string
- type: 'null'
title: Review Notes
created_at:
type: integer
title: Created At
updated_at:
type: integer
title: Updated At
type: object
required:
- id
- policy_id
- rule_id
- rule_type
- action
- consequence
- natural_language
- created_at
- updated_at
title: PolicyRule
description: 'Domain model for Policy Rule.
This follows an ODRL-inspired schema:
- rule_type: permission/prohibition/obligation/recommendation
- action: what action this rule governs
- target: what asset/data is affected
- assignee: who must comply (usually "agent")
- constraints: conditions under which rule applies
- consequence: what happens when rule is violated'
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
type: object
required:
- loc
- msg
- type
title: ValidationError
PolicyListResponse:
properties:
results:
items:
$ref: '#/components/schemas/Policy'
type: array
title: Results
total:
type: integer
title: Total
type: object
required:
- results
- total
title: PolicyListResponse
description: 'Response model for list endpoints with pagination.
- results: Items in the current page (length may be less than limit on last page).
- total: Total number of items across all pages (before pagination).'
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
src__service_agent_environment__api__policies__RuleListResponse:
properties:
results:
items:
$ref: '#/components/schemas/PolicyRule'
type: array
title: Results
total:
type: integer
title: Total
type: object
required:
- results
- total
title: RuleListResponse
description: 'Response model for rules list with pagination.
- results: Items in the current page.
- total: Total number of rules (across all pages if paginated).'
PolicyRuleCreate:
properties:
id:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Id
rule_id:
anyOf:
- type: string
- type: 'null'
title: Rule Id
rule_type:
$ref: '#/components/schemas/RuleType'
action:
type: string
maxLength: 100
minLength: 1
title: Action
target:
anyOf:
- type: string
- type: 'null'
title: Target
assignee:
anyOf:
- type: string
- type: 'null'
title: Assignee
default: agent
constraints:
anyOf:
- items:
$ref: '#/components/schemas/RuleConstraint'
type: array
- items:
additionalProperties: true
type: object
type: array
title: Constraints
default: []
conditions:
anyOf:
- items:
additionalProperties: true
type: object
type: array
- type: 'null'
title: Conditions
constraint_logic:
type: string
title: Constraint Logic
default: all
consequence:
anyOf:
- $ref: '#/components/schemas/RuleConsequence'
- additionalProperties: true
type: object
title: Consequence
natural_language:
type: string
minLength: 1
title: Natural Language
category:
$ref: '#/components/schemas/PolicyCategory'
default: security
status:
$ref: '#/components/schemas/RuleStatus'
default: draft
tags:
anyOf:
- items:
type: string
type: array
- type: 'null'
title: Tags
type: object
required:
- rule_type
- action
- consequence
- natural_language
title: PolicyRuleCreate
description: Request model for creating a policy rule manually.
RuleType:
type: string
enum:
- permission
- prohibition
- obligation
- recommendation
title: RuleType
description: Type of policy rule (ODRL-inspired).
RuleProvenance:
properties:
extracted_by:
type: string
enum:
- llm
- manual
title: Extracted By
default: manual
model_used:
anyOf:
- type: string
- type: 'null'
title: Model Used
confidence_score:
anyOf:
- type: number
- type: 'null'
title: Confidence Score
source_location:
anyOf:
- $ref: '#/components/schemas/SourceLocation'
- type: 'null'
type: object
title: RuleProvenance
description: Provenance information for rule extraction.