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

# Update Preview Policy

> Explicitly opt a project into preview database branches and select the source environment/database. Production data requires allowProductionData=true from an owner.



## OpenAPI

````yaml /openapi.json put /v1/orgs/{orgId}/projects/{projectId}/database-branch-policy
openapi: 3.1.0
info:
  title: Korve API
  version: 0.1.0
  description: >-
    Typed control plane for deploying applications and explicitly provisioning
    their managed infrastructure.
servers:
  - url: https://api.korve.dev
security: []
paths:
  /v1/orgs/{orgId}/projects/{projectId}/database-branch-policy:
    put:
      tags:
        - databaseBranches
      summary: Update Preview Policy
      description: >-
        Explicitly opt a project into preview database branches and select the
        source environment/database. Production data requires
        allowProductionData=true from an owner.
      operationId: databaseBranches.updatePreviewPolicy
      parameters:
        - name: orgId
          in: path
          required: true
          schema:
            type: string
          description: The organization's id (UUID) or slug — either form is accepted.
        - name: projectId
          in: path
          required: true
          schema:
            type: string
          description: The project's id (UUID) or slug — either form is accepted.
      requestBody:
        required: true
        x-korve-max-bytes: 1048576
        content:
          application/json:
            schema:
              type: object
              properties:
                enabled:
                  type: boolean
                sourceEnvironment:
                  type: string
                  pattern: ^[a-z][a-z0-9-]{0,38}$
                sourceDatabaseId:
                  type:
                    - string
                    - 'null'
                allowProductionData:
                  type: boolean
                expiresInDays:
                  type: integer
                deleteOnPreviewClose:
                  type: boolean
              required:
                - enabled
                - sourceEnvironment
                - sourceDatabaseId
                - allowProductionData
              additionalProperties: false
      responses:
        '200':
          description: Preview database branch policy updated.
        '404':
          description: No such project, environment, or database.
        '422':
          description: >-
            Source database is outside the selected environment, or production
            data was not explicitly allowed.
      security:
        - apiKey: []
        - session: []
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: korve_api_key
    session:
      type: apiKey
      in: cookie
      name: korve.session_token

````