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

# List Policy Versions

> Create a new policy version or list all versions of a specific policy

Retrieve a paginated list of all versions for a specific policy, ordered by most recently updated first.

## Path Parameters

| Parameter   | Type | Required | Description                             |
| ----------- | ---- | -------- | --------------------------------------- |
| `policy_id` | uuid | Yes      | UUID of the policy to list versions for |

## Query Parameters

| Parameter         | Type    | Required | Description                                 |
| ----------------- | ------- | -------- | ------------------------------------------- |
| `organization_id` | uuid    | Yes      | UUID of the organization for access control |
| `page`            | integer | No       | Page number for pagination (default: 1)     |
| `page_size`       | integer | No       | Number of results per page (default: 10)    |

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url "https://api.roe-ai.com/v1/policies/POLICY_ID/versions/?organization_id=YOUR_ORG_ID" \
    --header "Authorization: Bearer YOUR_API_KEY"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "count": 3,
    "next": null,
    "previous": null,
    "results": [
      {
        "id": "456e7890-e89b-12d3-a456-426614174003",
        "version_name": "version 3",
        "content": {
          "guidelines": {
            "categories": [
              {
                "title": "Enhanced Verification",
                "rules": [
                  {
                    "title": "Verify all signatures",
                    "flag": "RED_FLAG"
                  }
                ]
              }
            ]
          },
          "instructions": "Apply enhanced review procedures."
        },
        "updated_at": "2024-01-20T15:45:00Z",
        "policy": {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "name": "Compliance Review Policy",
          "description": "Policy for reviewing documents",
          "organization_id": "org-12345678-1234-1234-1234-123456789012",
          "current_version_id": "456e7890-e89b-12d3-a456-426614174003",
          "created_at": "2024-01-15T10:30:00Z",
          "updated_at": "2024-01-20T15:45:00Z"
        }
      },
      {
        "id": "456e7890-e89b-12d3-a456-426614174002",
        "version_name": "version 2",
        "content": {
          "guidelines": {
            "categories": []
          },
          "instructions": "Review documents."
        },
        "updated_at": "2024-01-18T12:00:00Z",
        "policy": {
          "id": "123e4567-e89b-12d3-a456-426614174000",
          "name": "Compliance Review Policy",
          "description": "Policy for reviewing documents",
          "organization_id": "org-12345678-1234-1234-1234-123456789012",
          "current_version_id": "456e7890-e89b-12d3-a456-426614174003",
          "created_at": "2024-01-15T10:30:00Z",
          "updated_at": "2024-01-20T15:45:00Z"
        }
      }
    ]
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /policies/{policy_id}/versions/
openapi: 3.1.0
info:
  title: Roe AI API
  version: 1.0.0
  description: Complete API documentation for Roe AI platform
servers:
  - url: https://api.roe-ai.com
    description: Production API
security: []
paths:
  /policies/{policy_id}/versions/:
    get:
      tags:
        - policies
      description: Create a new policy version or list all versions of a specific policy
      operationId: policies_versions_list
      parameters:
        - name: page
          required: false
          in: query
          description: A page number within the paginated result set.
          schema:
            type: integer
        - name: page_size
          required: false
          in: query
          description: Number of results to return per page.
          schema:
            type: integer
        - in: path
          name: policy_id
          schema:
            type: string
            format: uuid
          required: true
        - name: organization_id
          in: query
          required: false
          schema:
            type: string
            format: uuid
          description: >-
            Organization ID. This is required for access control. It can be
            provided via query or request body depending on the endpoint.
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedPolicyVersionList'
          description: ''
      security:
        - jwtAuth: []
components:
  schemas:
    PaginatedPolicyVersionList:
      type: object
      required:
        - count
        - results
      properties:
        count:
          type: integer
          example: 123
        next:
          type: string
          nullable: true
          format: uri
          example: http://api.example.org/accounts/?page=4
        previous:
          type: string
          nullable: true
          format: uri
          example: http://api.example.org/accounts/?page=2
        results:
          type: array
          items:
            $ref: '#/components/schemas/PolicyVersion'
    PolicyVersion:
      type: object
      description: >-
        Policy version serializer for public API.


        Exposes auto-generated structure IDs (category/rule/sub-rule IDs) in
        responses

        so users can reference specific rules. IDs are immutable - any IDs
        provided in

        create/update requests are ignored and regenerated by the backend.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        version_name:
          type: string
          maxLength: 255
        content: {}
        created_at:
          type: string
          format: date-time
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
        policy:
          $ref: '#/components/schemas/Policy'
        created_by:
          allOf:
            - $ref: '#/components/schemas/PolicyVersionCreatedBy'
          readOnly: true
        base_version_id:
          type: string
          format: uuid
          readOnly: true
      required:
        - base_version_id
        - content
        - created_at
        - created_by
        - id
        - policy
        - updated_at
        - version_name
    Policy:
      type: object
      description: Policy serializer
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
          maxLength: 255
        description:
          type: string
        organization_id:
          type: string
          format: uuid
          readOnly: true
        current_version_id:
          type:
            - string
            - 'null'
          format: uuid
          readOnly: true
        created_at:
          type: string
          format: date-time
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
      required:
        - created_at
        - current_version_id
        - id
        - name
        - organization_id
        - updated_at
    PolicyVersionCreatedBy:
      type: object
      description: Minimal user serializer for audit metadata on policy versions.
      properties:
        id:
          type: integer
          readOnly: true
        email:
          type: string
          format: email
          readOnly: true
          title: Email address
        display_name:
          type: string
          readOnly: true
      required:
        - display_name
        - email
        - id
  securitySchemes:
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````