> ## 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 the files of a version 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/{version_number}/files
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/{version_number}/files:
    get:
      tags:
        - Rego Policies
      summary: List the files of a version 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_files
      parameters:
        - name: identifier
          in: path
          required: true
          schema:
            type: string
            title: Identifier
        - name: version_number
          in: path
          required: true
          schema:
            type: integer
            maximum: 9223372036854776000
            minimum: -9223372036854776000
            title: Version Number
        - name: org
          in: path
          required: true
          schema:
            type: string
            title: Org
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegoPolicyFilesResponse'
        '400':
          description: Input payload validation failed
          content:
            application/json:
              example:
                message: Input payload validation failed
              schema:
                $ref: '#/components/schemas/BadRequestResponseModel'
        '403':
          description: You don't have permission to access this resource
          content:
            application/json:
              example:
                message: You don't have permission to access this resource
              schema:
                $ref: '#/components/schemas/ForbiddenResponseModel'
        '404':
          description: Rego policy or version not found
          content:
            application/json:
              example:
                message: Rego policy or version not found
              schema:
                $ref: '#/components/schemas/NotFoundResponseModel'
      security:
        - HTTPBearer: []
        - HTTPBasic: []
components:
  schemas:
    RegoPolicyFilesResponse:
      properties:
        identifier:
          type: string
          title: Identifier
          description: Identifier of the policy the version belongs to
        version:
          type: integer
          title: Version
          description: Version number
        digest:
          type: string
          title: Digest
          description: Digest of the version's bundle
        entrypoint_path:
          anyOf:
            - type: string
            - type: 'null'
          title: Entrypoint Path
          description: >-
            Path of the bundle file holding the policy entrypoint, present when
            `valid`
        files:
          items:
            $ref: '#/components/schemas/RegoPolicyFileResponse'
          type: array
          title: Files
          description: Every file in the bundle, sorted by case-sensitive path
      type: object
      required:
        - identifier
        - version
        - digest
        - files
      title: RegoPolicyFilesResponse
    BadRequestResponseModel:
      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
    ForbiddenResponseModel:
      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
    NotFoundResponseModel:
      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
    RegoPolicyFileResponse:
      properties:
        path:
          type: string
          title: Path
          description: Path of the file in the bundle, as published
        bytes:
          type: integer
          title: Bytes
          description: Size of the file's source in UTF-8 bytes
        sha256:
          type: string
          title: Sha256
          description: >-
            Hex SHA-256 of the file's source, the value the version's digest is
            built from
        _links:
          additionalProperties:
            anyOf:
              - $ref: '#/components/schemas/HALLink'
              - items:
                  $ref: '#/components/schemas/HALLink'
                type: array
          type: object
          title: Links
          description: '`self` is the file''s source as text/plain'
      type: object
      required:
        - path
        - bytes
        - sha256
        - _links
      title: RegoPolicyFileResponse
    HALLink:
      properties:
        href:
          type: string
          title: Href
          description: Absolute URL of the linked resource
      type: object
      required:
        - href
      title: HALLink
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

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