> ## 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.

# Get the source of a file in 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/{file_path}
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/{file_path}:
    get:
      tags:
        - Rego Policies
      summary: Get the source of a file in 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: get_rego_policy_file
      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: file_path
          in: path
          required: true
          schema:
            type: string
            title: File Path
        - name: org
          in: path
          required: true
          schema:
            type: string
            title: Org
      responses:
        '200':
          description: The file's source, with its SHA-256 as the `ETag`
          content:
            text/plain:
              schema:
                type: string
        '400':
          description: Input payload validation failed
          content:
            application/json:
              example:
                message: Input payload validation failed
            text/plain:
              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
            text/plain:
              schema:
                $ref: '#/components/schemas/ForbiddenResponseModel'
        '404':
          description: Rego policy, version or file not found
          content:
            application/json:
              example:
                message: Rego policy, version or file not found
            text/plain:
              schema:
                $ref: '#/components/schemas/NotFoundResponseModel'
      security:
        - HTTPBearer: []
        - HTTPBasic: []
components:
  schemas:
    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
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

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