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

# Set PR Preview Settings

> PUT /agents/{agentName}/previews turns a project's PR previews on with the secret set they mount, or off with null.



## OpenAPI

````yaml PUT /agents/{agentName}/previews
openapi: 3.0.0
info:
  title: Pipecat Cloud
  version: 1.0.0
  description: >-
    REST API for Pipecat Cloud. The public API (`/v1/public`, authenticated with
    a public API key) starts agent sessions and proxies requests to them. The
    private API (`/v1`, authenticated with a private API key) manages agents,
    secrets, builds, regions, and organization settings.
servers:
  - url: https://api.pipecat.daily.co/v1
    description: Private API server
security: []
paths:
  /agents/{agentName}/previews:
    put:
      summary: Set PR preview settings
      description: >-
        Turns PR previews on for a project with the secret set they mount, or
        off with `null`.


        Choosing the set is what turns previews on: every same-repo pull request
        into the branch the project deploys from then becomes an environment
        named `pr-<number>`, built from the pull request's head and scaled to at
        most one instance. A preview mounts only this set, never the project's
        own, and a pull request touching none of the project's watch paths gets
        no preview.


        `null` turns previews off and the previews that exist are deleted within
        minutes. Turning them off always succeeds, whatever state the project is
        in.


        Turning them on needs a GitHub repository connected to the project, a
        secret set that exists in the project's region and is ready to mount,
        and an organization that is not suspended. An agent that is itself an
        environment cannot have previews.
      operationId: updatePreviewSettings
      parameters:
        - name: agentName
          in: path
          required: true
          description: Name of the project
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - secretSet
              properties:
                secretSet:
                  type: string
                  nullable: true
                  maxLength: 255
                  description: >-
                    Secret set every preview mounts, or null to turn previews
                    off
                botPullRequests:
                  type: boolean
                  description: >-
                    Whether pull requests opened by bots (Dependabot, Renovate,
                    GitHub Apps) get previews too. Left out, the stored setting
                    is kept.
            example:
              secretSet: preview-secrets
              botPullRequests: false
      responses:
        '200':
          description: The stored settings
          content:
            application/json:
              schema:
                type: object
                properties:
                  secretSet:
                    type: string
                    nullable: true
                    description: >-
                      The secret set previews mount, or null when previews are
                      off
                  botPullRequests:
                    type: boolean
                    description: Whether bot pull requests get previews
              example:
                secretSet: preview-secrets
                botPullRequests: false
        '400':
          description: >-
            No GitHub repository is connected, or the secret set is in another
            region
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: PR previews need a GitHub repository connected to this agent
                code: '400'
        '403':
          description: The organization is suspended
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Organization is suspended
                code: '403'
        '404':
          description: The agent or the secret set was not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Secret set not found
                code: '404'
        '409':
          description: >-
            The agent is an environment of another agent, or the secret set is
            not ready to mount
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: An environment of another agent cannot have PR previews
                code: '409'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Internal server error
                code: '500'
      security:
        - PrivateKeyAuth: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message describing what went wrong
        code:
          type: string
          description: >-
            Error code for programmatic handling. For general errors it is the
            HTTP status as a string, such as `"404"`. Deployment-related codes
            (PCC-*) are documented at
            https://docs.pipecat.ai/pipecat-cloud/fundamentals/error-codes
      required:
        - error
        - code
  securitySchemes:
    PrivateKeyAuth:
      type: http
      scheme: bearer
      description: >-
        Authentication requires a Pipecat Cloud Private API token.


        Generate a Private API key from your Dashboard (Settings > API Keys >
        Private > Create key) and include it as a Bearer token in the
        Authorization header.

````

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