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

# List versions of a rego policy

> **Beta** — the Server-side evaluation feature is in beta. Requests from organizations without it enabled receive `403 Forbidden`.



## OpenAPI

````yaml https://app.kosli.com/api/v2/openapi.json get /rego-policies/{org}/{identifier}/versions
openapi: 3.1.0
info:
  title: Kosli API
  summary: The API for communicating with Kosli
  description: >

    # Authentication 


    When making requests against Kosli API, you can authenticate your requests
    using a bearer token. 

    Set the bearer token in the request Authorization header to a valid API
    key. 

    API Keys can be personal or for service accounts. Check the [service
    accounts
    documentation](https://docs.kosli.com/getting_started/service-accounts/) for
    details. 


    ## Curl example


    ```shell

    curl -H "Authorization: Bearer <<your-api-key>>"
    https://app.kosli.com/api/v2/environments/<<your-org-name>>

    ```
  version: '2.0'
servers:
  - url: https://app.kosli.com/api/v2
    description: EU
  - url: https://app.us.kosli.com/api/v2
    description: US
security:
  - HTTPBearer: []
paths:
  /rego-policies/{org}/{identifier}/versions:
    get:
      tags:
        - Rego Policies
      summary: List versions of a rego policy
      description: >-
        **Beta** — the Server-side evaluation feature is in beta. Requests from
        organizations without it enabled receive `403 Forbidden`.
      operationId: list_rego_policy_versions
      parameters:
        - name: identifier
          in: path
          required: true
          schema:
            type: string
            title: Identifier
        - name: org
          in: path
          required: true
          schema:
            type: string
            title: Org
        - name: page
          in: query
          required: false
          schema:
            type: integer
            maximum: 1000000
            minimum: 1
            description: Page number
            default: 1
            title: Page
          description: Page number
        - name: per_page
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            description: Number of versions per page
            default: 15
            title: Per Page
          description: Number of versions per page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegoPolicyVersionListResponse'
        '400':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/fastapi_app__errors__BadRequestResponse___locals___BadRequestResponseModel__11
          description: Bad Request
        '403':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/fastapi_app__errors__ForbiddenResponse___locals___ForbiddenResponseModel__19
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/fastapi_app__errors__NotFoundResponse___locals___NotFoundResponseModel__59
          description: Not Found
      security:
        - HTTPBearer: []
        - HTTPBasic: []
components:
  schemas:
    RegoPolicyVersionListResponse:
      properties:
        _links:
          anyOf:
            - additionalProperties:
                anyOf:
                  - $ref: '#/components/schemas/HALLink'
                  - items:
                      $ref: '#/components/schemas/HALLink'
                    type: array
              type: object
            - type: 'null'
          title: Links
        page:
          type: integer
          title: Page
        per_page:
          type: integer
          title: Per Page
        total_pages:
          type: integer
          title: Total Pages
        total_count:
          type: integer
          title: Total Count
        versions:
          items:
            $ref: '#/components/schemas/RegoPolicyVersionListItemResponse'
          type: array
          title: Versions
      additionalProperties: false
      type: object
      required:
        - page
        - per_page
        - total_pages
        - total_count
        - versions
      title: RegoPolicyVersionListResponse
    fastapi_app__errors__BadRequestResponse___locals___BadRequestResponseModel__11:
      properties:
        message:
          type: string
          title: Message
          description: Error message
        errors:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Errors
          description: Validation errors by field
      type: object
      required:
        - message
      title: BadRequestResponseModel
      examples:
        - message: Input payload validation failed
    fastapi_app__errors__ForbiddenResponse___locals___ForbiddenResponseModel__19:
      properties:
        message:
          type: string
          title: Message
          description: Error message
        errors:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Errors
          description: Validation errors by field
      type: object
      required:
        - message
      title: ForbiddenResponseModel
      examples:
        - message: You don't have permission to access this resource
    fastapi_app__errors__NotFoundResponse___locals___NotFoundResponseModel__59:
      properties:
        message:
          type: string
          title: Message
          description: Error message
        errors:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Errors
          description: Validation errors by field
      type: object
      required:
        - message
      title: NotFoundResponseModel
      description: Rego policy not found
      examples:
        - message: Rego policy not found
    HALLink:
      properties:
        href:
          type: string
          title: Href
          description: Absolute URL of the linked resource
      type: object
      required:
        - href
      title: HALLink
    RegoPolicyVersionListItemResponse:
      properties:
        version:
          type: integer
          title: Version
          description: Version number, counting up from 1
        status:
          type: string
          enum:
            - pending
            - valid
            - rejected
            - failed
          title: Status
          description: >-
            `pending` until the version has been validated, then `valid`,
            `rejected` if the policy is at fault, or `failed` if we are
        comment:
          type: string
          title: Comment
          description: Why this version was published
        created_at:
          type: number
          title: Created At
          description: Unix timestamp the version was published at
        created_by:
          type: string
          title: Created By
          description: Display name of the user who published it
        _links:
          additionalProperties:
            anyOf:
              - $ref: '#/components/schemas/HALLink'
              - items:
                  $ref: '#/components/schemas/HALLink'
                type: array
          type: object
          title: Links
          description: >-
            `self` is the version, with its digest, input schema and validation
            outcome
      type: object
      required:
        - version
        - status
        - comment
        - created_at
        - created_by
        - _links
      title: RegoPolicyVersionListItemResponse
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

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