> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xenovia.io/llms.txt
> Use this file to discover all available pages before exploring further.

# List policy versions

> **Auth:** organization API key (`read` scope or higher) or a signed-in user.

Every saved version of the policy.



## OpenAPI

````yaml https://cp.xenovia.io/openapi.json get /api/v1/policies/{policy_id}/versions
openapi: 3.1.0
info:
  title: Xenovia Control Plane API
  version: 1.0.0
  description: >-
    Management API for agents, providers, policies, telemetry, alerts and
    organization settings.
servers:
  - url: https://cp.xenovia.io
    description: Production
security:
  - BearerAuth: []
paths:
  /api/v1/policies/{policy_id}/versions:
    get:
      tags:
        - policies
      summary: List policy versions
      description: >-
        **Auth:** organization API key (`read` scope or higher) or a signed-in
        user.


        Every saved version of the policy.
      operationId: list_policy_versions_route_api_v1_policies__policy_id__versions_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:
                type: array
                items:
                  $ref: '#/components/schemas/PolicyVersionRead'
                title: >-
                  Response List Policy Versions Route Api V1 Policies  Policy
                  Id  Versions Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    PolicyVersionRead:
      properties:
        policy_id:
          type: string
          format: uuid
          title: Policy Id
        version:
          type: integer
          title: Version
        reason:
          type: string
          title: Reason
        name:
          type: string
          title: Name
        rego:
          type: string
          title: Rego
        rego_sha256:
          type: string
          title: Rego Sha256
        stage:
          type: string
          title: Stage
        enforcement_mode:
          type: string
          title: Enforcement Mode
        template_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Template Id
        template_version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Template Version
        framework_tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Framework Tags
        control_mappings:
          anyOf:
            - items:
                $ref: '#/components/schemas/ControlMapping'
              type: array
            - type: 'null'
          title: Control Mappings
        parameter_values:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Parameter Values
        conformance:
          anyOf:
            - $ref: '#/components/schemas/ConformanceResult'
            - type: 'null'
        created_at:
          type: string
          format: date-time
          title: Created At
      type: object
      required:
        - policy_id
        - version
        - reason
        - name
        - rego
        - rego_sha256
        - stage
        - enforcement_mode
        - created_at
      title: PolicyVersionRead
      description: 'One version of a policy: what it did, from when.'
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ControlMapping:
      properties:
        framework:
          type: string
          minLength: 1
          title: Framework
        controls:
          items:
            type: string
          type: array
          minItems: 1
          title: Controls
        rationale:
          type: string
          maxLength: 280
          title: Rationale
          default: ''
      type: object
      required:
        - framework
        - controls
      title: ControlMapping
      description: |-
        A template's claim, carried by the policies made from it, that the
        rule contributes evidence for these controls of one framework. IDs are
        the catalog's (app/compliance/control_catalog.yaml).
    ConformanceResult:
      properties:
        ran_at:
          type: string
          format: date-time
          title: Ran At
        opa_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Opa Version
        source:
          type: string
          enum:
            - template
            - policy
          title: Source
        passed:
          type: integer
          title: Passed
        failed:
          type: integer
          title: Failed
        cases:
          items:
            $ref: '#/components/schemas/ConformanceCaseResult'
          type: array
          title: Cases
      type: object
      required:
        - ran_at
        - opa_version
        - source
        - passed
        - failed
        - cases
      title: ConformanceResult
      description: |-
        The last run of a policy's cases: what an auditor reads next to the
        control the policy is evidence for.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ConformanceCaseResult:
      properties:
        name:
          type: string
          title: Name
        stage:
          type: string
          enum:
            - request
            - response
          title: Stage
        expected_action:
          type: string
          title: Expected Action
        expected_rule:
          anyOf:
            - type: string
            - type: 'null'
          title: Expected Rule
        got_action:
          type: string
          title: Got Action
        got_rule:
          anyOf:
            - type: string
            - type: 'null'
          title: Got Rule
        ok:
          type: boolean
          title: Ok
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
      type: object
      required:
        - name
        - stage
        - expected_action
        - got_action
        - ok
      title: ConformanceCaseResult
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token: an organization API key (`ak_…`) created under Settings →
        API Keys, or a dashboard user session token. Agent keys (`xe_…`) are not
        accepted here. Endpoints marked as user-only in their description reject
        organization keys with `403`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.