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

# Diff two policy versions

> Compute the diff between two policy versions (source and target)



## OpenAPI

````yaml /api-specs/cloud/governance-api.json get /policy-versions/{id}/diff/{targetId}
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:
  /policy-versions/{id}/diff/{targetId}:
    get:
      tags:
        - policy-versions
      summary: Diff two policy versions
      description: Compute the diff between two policy versions (source and target)
      parameters:
        - description: ID of the source policy version
          name: id
          in: path
          required: true
          schema:
            type: string
        - description: ID of the target policy version
          name: targetId
          in: path
          required: true
          schema:
            type: string
        - description: Include unchanged artifacts/approvals in the diff
          name: includeUnchanged
          in: query
          schema:
            type: boolean
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/guardrails.PolicyDiffResult'
        '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'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/server.HTTPError'
components:
  schemas:
    guardrails.PolicyDiffResult:
      type: object
      properties:
        approvals:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.ApprovalDiff'
        artifacts:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.ArtifactDiff'
        policy_id:
          type: string
        source:
          $ref: '#/components/schemas/guardrails.PolicyDiffVersionInfo'
        stages:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.StageDiff'
        target:
          $ref: '#/components/schemas/guardrails.PolicyDiffVersionInfo'
    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.ApprovalDiff:
      type: object
      properties:
        changes:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.ApprovalChangeKind'
        policyEntityId:
          type: string
        source:
          $ref: '#/components/schemas/guardrails.ApprovalProperties'
        target:
          $ref: '#/components/schemas/guardrails.ApprovalProperties'
        type:
          $ref: '#/components/schemas/guardrails.DiffType'
    guardrails.ArtifactDiff:
      type: object
      properties:
        changes:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.ArtifactChangeKind'
        policyEntityId:
          type: string
        source:
          $ref: '#/components/schemas/guardrails.ArtifactProperties'
        target:
          $ref: '#/components/schemas/guardrails.ArtifactProperties'
        type:
          $ref: '#/components/schemas/guardrails.DiffType'
    guardrails.PolicyDiffVersionInfo:
      type: object
      properties:
        policy_version_id:
          type: string
        version:
          type: string
    guardrails.StageDiff:
      type: object
      properties:
        changes:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.StageChangeKind'
        policyEntityId:
          type: string
        source:
          $ref: '#/components/schemas/guardrails.StageProperties'
        target:
          $ref: '#/components/schemas/guardrails.StageProperties'
        type:
          $ref: '#/components/schemas/guardrails.DiffType'
    guardrails.ErrorCode:
      type: string
      enum:
        - BUNDLE_REQUIRES_POLICY
      x-enum-varnames:
        - CodeBundleRequiresPolicy
    guardrails.ApprovalChangeKind:
      type: string
      enum:
        - moved
        - name_changed
        - approvers_changed
        - evidence_added
        - evidence_removed
        - evidence_changed
      x-enum-varnames:
        - ApprovalChangeKindMoved
        - ApprovalChangeKindNameChanged
        - ApprovalChangeKindApproversChanged
        - ApprovalChangeKindEvidenceAdded
        - ApprovalChangeKindEvidenceRemoved
        - ApprovalChangeKindEvidenceChanged
    guardrails.ApprovalProperties:
      type: object
      properties:
        approvers:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.Approver'
        artifacts:
          type: array
          items:
            $ref: '#/components/schemas/guardrails.ApprovalArtifactProperties'
        evidenceId:
          type: string
        location:
          $ref: '#/components/schemas/guardrails.DiffApprovalLocation'
        name:
          type: string
        policyEntityId:
          type: string
        stageApprovalId:
          type: string
    guardrails.DiffType:
      type: string
      enum:
        - added
        - removed
        - changed
        - unchanged
      x-enum-varnames:
        - DiffTypeAdded
        - DiffTypeRemoved
        - DiffTypeChanged
        - DiffTypeUnchanged
    guardrails.ArtifactChangeKind:
      type: string
      enum:
        - moved
        - type_changed
        - required_changed
        - details_changed
      x-enum-varnames:
        - ChangeKindMoved
        - ChangeKindTypeChanged
        - ChangeKindRequiredChanged
        - ChangeKindDetailsChanged
    guardrails.ArtifactProperties:
      type: object
      properties:
        alias:
          type: string
        artifactId:
          type: string
        artifactType:
          $ref: '#/components/schemas/guardrails.ArtifactType'
        detailedType:
          type: string
        details:
          type: object
          additionalProperties: {}
        location:
          $ref: '#/components/schemas/guardrails.DiffArtifactLocation'
        policyEntityId:
          type: string
        required:
          type: boolean
    guardrails.StageChangeKind:
      type: string
      enum:
        - renamed
        - reordered
      x-enum-varnames:
        - StageChangeKindRenamed
        - StageChangeKindReordered
    guardrails.StageProperties:
      type: object
      properties:
        name:
          type: string
        policyEntityId:
          type: string
        policyVersionId:
          type: string
        stageId:
          type: string
        stageOrder:
          type: integer
    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.ApprovalArtifactProperties:
      type: object
      properties:
        id:
          type: string
        label:
          type: string
        policyEntityId:
          type: string
        required:
          type: boolean
    guardrails.DiffApprovalLocation:
      type: object
      properties:
        policyVersion:
          type: string
        policyVersionId:
          type: string
        stageId:
          type: string
        stageName:
          type: string
        stagePolicyEntityId:
          type: string
    guardrails.ArtifactType:
      type: string
      enum:
        - input
        - guidance
        - policyScriptedCheck
        - metadata
      x-enum-varnames:
        - Input
        - Guidance
        - AutomatedJob
        - Metadata
    guardrails.DiffArtifactLocation:
      type: object
      properties:
        evidenceExternalId:
          type: string
        evidenceId:
          type: string
        evidenceName:
          type: string
        policyVersion:
          type: string
        policyVersionId:
          type: string
        stageApprovalId:
          type: string
        stageApprovalName:
          type: string
        stageApprovalPolicyEntityId:
          type: string
        stageId:
          type: string
        stageName:
          type: string
        stagePolicyEntityId:
          type: string

````

## Related topics

- [Diff policies between two bundles](/api-reference/rpc/diff-policies-between-two-bundles.md)
- [Define policies](/cloud/platform-capabilities/features/governance/define-governance-policies/index.md)
- [Replace a bundle's primary policy with a different policy](/api-reference/bundles/replace-a-bundles-primary-policy-with-a-different-policy.md)
- [Replace a policy version in a bundle](/api-reference/bundles/replace-a-policy-version-in-a-bundle.md)
