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

# Get Affected Policies

> Preview policies that would be archived or revised by a cascade.

Backs the AI agent / MCP server delete-confirmation modal so the user
sees what's about to change before they confirm (BCP-1686 spec
§ "Policy-service endpoint"). Exactly one of ``agent_id`` /
``mcp_server_id`` must be supplied.



## OpenAPI

````yaml /api-reference/openapi.yaml get /api/policy/v2/policies/affected-by
openapi: 3.1.0
info:
  title: Barndoor.ai Public API
  description: Unified public API specification for Barndoor.ai platform
  version: 2.18.0
servers:
  - url: https://{host}
    description: Barndoor public API
    variables:
      host:
        default: platform.barndoor.ai
        description: >-
          The host serving your Barndoor deployment. Defaults to production;
          override it for another environment or a dedicated deployment.
security:
  - ApiKey: []
  - OAuth2:
      - openid
      - profile
      - email
tags:
  - name: dlp
    x-group: Data Control Center
  - name: identity
    x-group: Identity
  - name: llm-gateway
    x-group: LLM Gateway
  - name: notification
    x-group: Notifications
  - name: policy
    x-group: Policies
  - name: registry
    x-group: MCP Gateway
  - name: system-management
    x-group: Log Exports
paths:
  /api/policy/v2/policies/affected-by:
    get:
      tags:
        - policy
      summary: Get Affected Policies
      description: |-
        Preview policies that would be archived or revised by a cascade.

        Backs the AI agent / MCP server delete-confirmation modal so the user
        sees what's about to change before they confirm (BCP-1686 spec
        § "Policy-service endpoint"). Exactly one of ``agent_id`` /
        ``mcp_server_id`` must be supplied.
      operationId: list_policies_affected_by
      parameters:
        - name: agent_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Agent (application) UUID. Mutually exclusive with mcp_server_id.
            title: Agent Id
          description: Agent (application) UUID. Mutually exclusive with mcp_server_id.
        - name: mcp_server_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: MCP server UUID. Mutually exclusive with agent_id.
            title: Mcp Server Id
          description: MCP server UUID. Mutually exclusive with agent_id.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AffectedPoliciesResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AffectedPoliciesResponse:
      properties:
        archive_count:
          type: integer
          title: Archive Count
        revise_count:
          type: integer
          title: Revise Count
        archive_preview:
          items:
            $ref: '#/components/schemas/AffectedPolicyPreview'
          type: array
          title: Archive Preview
        revise_preview:
          items:
            $ref: '#/components/schemas/AffectedPolicyPreview'
          type: array
          title: Revise Preview
      type: object
      required:
        - archive_count
        - revise_count
      title: AffectedPoliciesResponse
      description: |-
        Response shape for GET /admin/v2/policies/affected-by.

        Mirrors the cascade-handler buckets exactly: ``archive_*`` are policies
        that would transition to ARCHIVED, ``revise_*`` are policies that would
        have only their application_ids set-minus'd (only possible on agent_id
        queries — always 0/[] for mcp_server_id queries).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AffectedPolicyPreview:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        status:
          type: string
          title: Status
        mcp_server_id:
          type: string
          title: Mcp Server Id
        application_ids:
          items:
            type: string
          type: array
          title: Application Ids
      type: object
      required:
        - id
        - name
        - status
        - mcp_server_id
      title: AffectedPolicyPreview
      description: |-
        Compact row for the affected-by preview (BCP-1686 § API Contract).

        Just enough to render in the delete-confirmation modal — id for keying,
        name for display, status so the UI can disambiguate active vs draft.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      description: >-
        A Barndoor API key, sent as `Authorization: Bearer <key>`. Keys are
        prefixed `bdai_` and are opaque — do not attempt to decode one.
        Interchangeable with an OAuth 2.0 access token.
    OAuth2:
      type: oauth2
      x-issuer: https://auth.barndoor.ai/realms/barndoor
      description: >-
        An OAuth 2.0 access token from Barndoor's identity provider, sent as
        `Authorization: Bearer <token>`. Public clients must use PKCE.
        Interchangeable with an API key.
      flows:
        authorizationCode:
          authorizationUrl: >-
            https://auth.barndoor.ai/realms/barndoor/protocol/openid-connect/auth
          tokenUrl: >-
            https://auth.barndoor.ai/realms/barndoor/protocol/openid-connect/token
          scopes:
            openid: Issue an OIDC ID token identifying the caller.
            profile: Read the caller's basic profile claims.
            email: Read the caller's email address.
            offline_access: Issue a refresh token. Optional — no operation requires it.
        clientCredentials:
          tokenUrl: >-
            https://auth.barndoor.ai/realms/barndoor/protocol/openid-connect/token
          scopes:
            openid: Issue an OIDC ID token identifying the caller.
            profile: Read the caller's basic profile claims.
            email: Read the caller's email address.
            offline_access: Issue a refresh token. Optional — no operation requires it.

````

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