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

# Replace a bundle's primary policy with a different policy

> Replaces the bundle's primary policy with a completely different policy. Set disableOldPolicy=true to deactivate the old primary (default: false).



## OpenAPI

````yaml /api-specs/cloud/governance-api.json post /rpc/replace-bundle-primary-policy
openapi: 3.0.3
info:
  description: Service responsible for managing Domino Governance feature
  title: Domino Governance API
  contact:
    name: Domino Data Lab
    url: https://tickets.dominodatalab.com/hc/en-us
    email: support@dominodatalab.com
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: '1.0'
servers:
  - url: https://mycluster.domino.tech/api/governance/v1
    description: >-
      Replace 'mycluster.domino.tech' with your Domino cluster hostname. For
      Domino Cloud customers, that is `your-subdomain`.domino.tech (e.g.,
      acme.domino.tech). For self-hosted deployments, it is the hostname you
      reach the Domino UI at.
security: []
paths:
  /rpc/replace-bundle-primary-policy:
    post:
      tags:
        - bundles
      summary: Replace a bundle's primary policy with a different policy
      description: >-
        Replaces the bundle's primary policy with a completely different policy.
        Set disableOldPolicy=true to deactivate the old primary (default:
        false).
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/server.ReplaceBundlePrimaryPolicyRequest'
        description: Request to replace bundle primary policy
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/guardrails.Bundle'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/server.HTTPError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/server.HTTPError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/server.HTTPError'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/server.HTTPError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/server.HTTPError'
components:
  schemas:
    server.ReplaceBundlePrimaryPolicyRequest:
      type: object
      required:
        - bundleId
        - newPolicyId
      properties:
        bundleId:
          type: string
        disableOldPolicy:
          type: boolean
        newPolicyId:
          type: string
    guardrails.Bundle:
      type: object
      required:
        - id
        - state
      properties:
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.Attachment'
        classificationValue:
          description: The classification value of the primary policy
          type: string
        commentsCount:
          type: integer
        createdAt:
          type: string
        createdBy:
          type: object
        currentStageInfo:
          $ref: '#/components/schemas/guardrails.CurrentStageInfo'
        enforcedPolicyIds:
          description: Policy IDs mandated by a PolicyEnforcer; these cannot be deactivated
          type: array
          items:
            type: string
        evidenceRestricted:
          type: boolean
        gates:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.Gate'
        hasRevalidationSchedule:
          description: Whether the bundle has an active revalidation schedule
          type: boolean
        id:
          type: string
        name:
          type: string
        policies:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.BundlePolicy'
        policyId:
          description: The ID of the primary policy
          type: string
        policyName:
          type: string
        policyVersion:
          description: The version of the primary policy
          type: string
        policyVersionId:
          description: The version ID of the primary policy
          type: string
        projectId:
          type: string
        projectName:
          type: string
        projectOwner:
          type: string
        stage:
          description: The stage of the primary policy
          type: string
        stageApprovals:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.StageApproval'
        stageAssignee:
          description: The assignee to the stage of the primary policy
          allOf:
            - $ref: '#/components/schemas/guardrails.BundleStageAssignee'
        stages:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.BundleStage'
        state:
          $ref: '#/components/schemas/guardrails.BundleState'
    server.HTTPError:
      type: object
      properties:
        code:
          description: >-
            Code is a stable machine-readable error identifier; absent on most
            errors.
          allOf:
            - $ref: '#/components/schemas/guardrails.ErrorCode'
        message:
          type: string
    guardrails.Attachment:
      type: object
      properties:
        approvalTimelineMap:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/guardrails.ApprovalTimelineInfo'
        createdAt:
          type: string
        createdBy:
          type: object
        id:
          type: string
        identifier:
          type: object
        source:
          $ref: '#/components/schemas/guardrails.AttachmentSource'
        type:
          $ref: '#/components/schemas/guardrails.AttachmentType'
    guardrails.CurrentStageInfo:
      type: object
      properties:
        openFindingsCount:
          type: integer
        pendingApprovalsCount:
          type: integer
        status:
          $ref: '#/components/schemas/guardrails.StageStatus'
    guardrails.Gate:
      type: object
      properties:
        approvals:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.GateApprovalSummary'
        bundleId:
          type: string
        id:
          type: string
        isOpen:
          type: boolean
        name:
          type: string
        policyGateId:
          type: string
        policyId:
          type: string
        policyVersionId:
          type: string
        reason:
          type: string
        resources:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.RuleDefinition'
    guardrails.BundlePolicy:
      type: object
      properties:
        allowProjectApprovers:
          type: boolean
        bundleId:
          type: string
        classificationValue:
          type: string
        compliantToCurrentStage:
          type: boolean
        createdAt:
          type: string
        deactivatedAt:
          type: string
        enforceSequentialOrder:
          type: boolean
        hasRevalidationSchedule:
          type: boolean
        isLatestVersion:
          type: boolean
        isPolicyArchived:
          type: boolean
        policyId:
          type: string
        policyName:
          type: string
        policyVersion:
          type: string
        policyVersionId:
          type: string
        stage:
          type: string
        stageAssignee:
          description: The assignee to the stage of this bundle policy
          allOf:
            - $ref: '#/components/schemas/guardrails.BundleStageAssignee'
        upgradeRequired:
          type: boolean
    guardrails.StageApproval:
      type: object
      properties:
        approvers:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.Approver'
        evidence:
          $ref: '#/components/schemas/guardrails.Evidence'
        id:
          type: string
        name:
          type: string
        policyEntityId:
          type: string
        revalidationConfig:
          $ref: '#/components/schemas/guardrails.RevalidationConfig'
    guardrails.BundleStageAssignee:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: string
        name:
          type: string
    guardrails.BundleStage:
      type: object
      properties:
        assignedAt:
          type: string
        assignee:
          $ref: '#/components/schemas/guardrails.BundleStageAssignee'
        bundleId:
          type: string
        stage:
          $ref: '#/components/schemas/guardrails.Stage'
        stageId:
          type: string
    guardrails.BundleState:
      type: string
      enum:
        - Active
        - Archived
        - Complete
      x-enum-varnames:
        - ActiveState
        - ArchivedState
        - CompleteState
    guardrails.ErrorCode:
      type: string
      enum:
        - BUNDLE_REQUIRES_POLICY
      x-enum-varnames:
        - CodeBundleRequiresPolicy
    guardrails.ApprovalTimelineInfo:
      type: object
      properties:
        approvalStatus:
          $ref: '#/components/schemas/guardrails.ApprovalStatus'
        timelineStatus:
          $ref: '#/components/schemas/guardrails.ApprovalTimelineStatus'
        updatedAt:
          type: string
    guardrails.AttachmentSource:
      type: string
      enum:
        - AUTO
        - MANUAL
      x-enum-varnames:
        - AttachmentSourceAuto
        - AttachmentSourceManual
    guardrails.AttachmentType:
      type: string
      enum:
        - ModelVersion
        - Report
        - DatasetSnapshotFile
        - Endpoint
        - NetAppVolumeSnapshotFile
        - FlowArtifact
        - FlowArtifactFile
      x-enum-varnames:
        - ModelVersion
        - Report
        - DatasetSnapshotFile
        - Endpoint
        - NetAppVolumeSnapshotFile
        - FlowArtifact
        - FlowArtifactFile
    guardrails.StageStatus:
      type: string
      enum:
        - NotStarted
        - InProgress
        - Done
      x-enum-varnames:
        - NotStartedStageStatus
        - InProgressStageStatus
        - DoneStageStatus
    guardrails.GateApprovalSummary:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        stageApprovalId:
          type: string
        status:
          $ref: '#/components/schemas/guardrails.ApprovalStatus'
    guardrails.RuleDefinition:
      type: object
      required:
        - action
      properties:
        action:
          $ref: '#/components/schemas/guardrails.RuleAction'
        failOpen:
          type: boolean
        parameters:
          type: object
    guardrails.Approver:
      type: object
      required:
        - editable
        - id
        - name
        - showByDefault
      properties:
        editable:
          type: boolean
        fromOrganizationUserId:
          type: string
        id:
          type: string
        isOrganizationUser:
          type: boolean
        name:
          type: string
        showByDefault:
          type: boolean
    guardrails.Evidence:
      type: object
      properties:
        artifacts:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.EvidenceArtifact'
        createdAt:
          type: string
        description:
          type: string
        externalId:
          type: string
        id:
          type: string
        name:
          type: string
        policyId:
          type: string
        policyVersionId:
          type: string
        scope:
          $ref: '#/components/schemas/guardrails.EvidenceScope'
        visible:
          description: >-
            allows true, false or nil values (if nil, FE can decide to show
            everything)
          type: boolean
    guardrails.RevalidationConfig:
      type: object
      required:
        - openWindowDaysBefore
        - recurring
        - type
      properties:
        openWindowDaysBefore:
          type: integer
          minimum: 1
        recurring:
          $ref: '#/components/schemas/guardrails.Recurring'
        type:
          enum:
            - absolute
            - relative
          allOf:
            - $ref: '#/components/schemas/guardrails.RevalidationType'
    guardrails.Stage:
      type: object
      properties:
        approvals:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.StageApproval'
        evidenceSet:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.Evidence'
        id:
          type: string
        name:
          type: string
        notifyOnTransition:
          type: boolean
        policyEntityId:
          type: string
        policyVersionId:
          type: string
    guardrails.ApprovalStatus:
      type: string
      enum:
        - PendingSubmission
        - PendingReview
        - Approved
        - ConditionallyApproved
        - PendingExpiration
        - Expired
      x-enum-varnames:
        - PendingSubmission
        - PendingReview
        - Approved
        - ConditionallyApproved
        - PendingExpiration
        - Expired
    guardrails.ApprovalTimelineStatus:
      type: string
      enum:
        - Valid
        - Invalid
      x-enum-varnames:
        - Valid
        - Invalid
    guardrails.RuleAction:
      type: string
      enum:
        - Deploy
        - CreateApp
        - CreateEndpoint
      x-enum-varnames:
        - Deploy
        - CreateApp
        - CreateEndpoint
    guardrails.EvidenceArtifact:
      type: object
      properties:
        artifactType:
          $ref: '#/components/schemas/guardrails.ArtifactType'
        details:
          type: object
        id:
          type: string
        policyEntityId:
          type: string
        required:
          type: boolean
        visibilityRule:
          type: string
        visible:
          type: boolean
    guardrails.EvidenceScope:
      type: string
      enum:
        - Global
        - Local
      x-enum-varnames:
        - Global
        - Local
    guardrails.Recurring:
      type: object
      required:
        - every
        - unit
      properties:
        every:
          type: integer
          minimum: 1
        startDate:
          type: string
        unit:
          enum:
            - month
            - year
          allOf:
            - $ref: '#/components/schemas/guardrails.RevalidationUnit'
    guardrails.RevalidationType:
      type: string
      enum:
        - absolute
        - relative
      x-enum-varnames:
        - RevalidationTypeAbsolute
        - RevalidationTypeRelative
    guardrails.ArtifactType:
      type: string
      enum:
        - input
        - guidance
        - policyScriptedCheck
        - metadata
      x-enum-varnames:
        - Input
        - Guidance
        - AutomatedJob
        - Metadata
    guardrails.RevalidationUnit:
      type: string
      enum:
        - month
        - year
      x-enum-varnames:
        - RevalidationUnitMonth
        - RevalidationUnitYear

````

## Related topics

- [Replace a policy version in a bundle](/api-reference/bundles/replace-a-policy-version-in-a-bundle.md)
- [Update the policy of a bundle](/api-reference/bundles/update-the-policy-of-a-bundle.md)
- [Create new bundle](/api-reference/bundles/create-new-bundle.md)
- [Add a policy to govern a bundle](/api-reference/bundles/add-a-policy-to-govern-a-bundle.md)
