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

# Perform a Patch on a policy by name



## OpenAPI

````yaml patch /org/{org}/policy/{name}
openapi: 3.0.3
info:
  title: Control Plane Core API
  description: Copyright © 2023 Control Plane Corporation. All rights reserved.
  version: 1.0.0
servers:
  - url: https://api.cpln.io
    description: ''
security:
  - {}
  - serviceAccountKey: []
  - jwt: []
externalDocs:
  url: https://docs.controlplane.com/
  description: End-user documentation
paths:
  /org/{org}/policy/{name}:
    patch:
      tags:
        - policy
      summary: Perform a Patch on a policy by name
      parameters:
        - in: path
          name: org
          required: true
          schema:
            type: string
        - in: path
          name: name
          required: true
          schema:
            type: string
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/patch_policy'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/policy'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '403':
          description: Access denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
components:
  schemas:
    patch_policy:
      type: object
      properties:
        $drop:
          type: array
          items:
            type: string
            enum:
              - description
              - tags
              - targetKind
              - targetLinks
              - targetQuery
              - target
              - origin
              - bindings
        name:
          type: string
          maxLength: 64
        description:
          type: string
          maxLength: 250
        tags:
          type: object
          properties: {}
        $replace/tags:
          type: object
        targetKind:
          type: string
          enum:
            - org
            - cloudaccount
            - policy
            - user
            - group
            - resource
            - task
            - permissions
            - serviceaccount
            - secret
            - location
            - gvc
            - workload
            - quota
            - identity
            - deployment
            - event
            - domain
            - image
            - ipset
            - resourcepolicy
            - agent
            - accessreport
            - policymembership
            - dbcluster
            - auditctx
            - memcachecluster
            - spicedbcluster
            - tenant
            - mk8s
            - command
            - imagesummary
            - volumeset
        targetLinks:
          type: array
          items:
            type: string
        $drop/targetLinks:
          type: array
          items:
            type: string
        $append/targetLinks:
          type: array
          items:
            type: string
        $retain/targetLinks:
          type: array
          items:
            type: string
        targetQuery:
          $ref: '#/components/schemas/patch_query'
        $replace/targetQuery:
          $ref: '#/components/schemas/query'
        target:
          type: string
          enum:
            - all
        origin:
          type: string
          enum:
            - default
            - builtin
          default: default
        bindings:
          type: array
          items:
            $ref: '#/components/schemas/policy_binding'
        $drop/bindings:
          type: array
          items:
            type: string
        $append/bindings:
          type: array
          items:
            $ref: '#/components/schemas/policy_binding'
        $retain/bindings:
          type: array
          items:
            type: string
        $patch/bindings:
          type: array
          items:
            $ref: '#/components/schemas/patch_policy_binding'
    policy:
      type: object
      properties:
        id:
          type: string
          readOnly: true
        name:
          type: string
          maxLength: 64
        kind:
          type: string
          readOnly: true
        version:
          type: integer
          readOnly: true
        description:
          type: string
          maxLength: 250
        tags:
          type: object
        created:
          type: string
          format: date-time
          readOnly: true
        lastModified:
          type: string
          format: date-time
          readOnly: true
        links:
          type: array
          items:
            $ref: '#/components/schemas/link'
          readOnly: true
        targetKind:
          type: string
          enum:
            - org
            - cloudaccount
            - policy
            - user
            - group
            - resource
            - task
            - permissions
            - serviceaccount
            - secret
            - location
            - gvc
            - workload
            - quota
            - identity
            - deployment
            - event
            - domain
            - image
            - ipset
            - resourcepolicy
            - agent
            - accessreport
            - policymembership
            - dbcluster
            - auditctx
            - memcachecluster
            - spicedbcluster
            - tenant
            - mk8s
            - command
            - imagesummary
            - volumeset
        targetLinks:
          type: array
          items:
            type: string
        targetQuery:
          $ref: '#/components/schemas/query'
        target:
          type: string
          enum:
            - all
        origin:
          type: string
          enum:
            - default
            - builtin
          default: default
        bindings:
          type: array
          items:
            $ref: '#/components/schemas/policy_binding'
      additionalProperties: false
    error:
      type: object
      properties:
        status:
          type: integer
        message:
          type: string
        code:
          type: string
        details:
          type: object
        id:
          type: string
      additionalProperties: false
    patch_query:
      type: object
      properties:
        $drop:
          type: array
          items:
            type: string
            enum:
              - kind
              - spec
        kind:
          type: string
        spec:
          type: object
          properties:
            $drop:
              type: array
              items:
                type: string
                enum:
                  - match
                  - terms
                  - sort
            match:
              type: string
              enum:
                - all
                - any
                - none
              default: all
            terms:
              type: array
              items:
                type: object
                properties:
                  op:
                    type: string
                    enum:
                      - '='
                      - '>'
                      - '>='
                      - <
                      - <=
                      - '!='
                      - '~'
                      - '=~'
                      - exists
                      - '!exists'
                      - contains
                    default: '='
                  property:
                    type: string
                  rel:
                    type: string
                  tag:
                    type: string
                  value:
                    oneOf:
                      - type: string
                      - type: number
                      - type: boolean
                      - type: string
                        format: date-time
                additionalProperties: false
            $drop/terms:
              type: array
              items:
                type: string
            $append/terms:
              type: array
              items:
                type: object
                properties:
                  op:
                    type: string
                    enum:
                      - '='
                      - '>'
                      - '>='
                      - <
                      - <=
                      - '!='
                      - '~'
                      - '=~'
                      - exists
                      - '!exists'
                      - contains
                    default: '='
                  property:
                    type: string
                  rel:
                    type: string
                  tag:
                    type: string
                  value:
                    oneOf:
                      - type: string
                      - type: number
                      - type: boolean
                      - type: string
                        format: date-time
                additionalProperties: false
            $patch/terms:
              type: array
              items:
                type: object
                properties:
                  $drop:
                    type: array
                    items:
                      type: string
                      enum:
                        - op
                        - property
                        - rel
                        - tag
                        - value
                  op:
                    type: string
                    enum:
                      - '='
                      - '>'
                      - '>='
                      - <
                      - <=
                      - '!='
                      - '~'
                      - '=~'
                      - exists
                      - '!exists'
                      - contains
                    default: '='
                  property:
                    type: string
                  rel:
                    type: string
                  tag:
                    type: string
                  $replace/value:
                    oneOf:
                      - type: string
                      - type: number
                      - type: boolean
                      - type: string
                        format: date-time
                  value:
                    oneOf: []
            $retain/terms:
              type: array
              items:
                type: string
            sort:
              type: object
              properties:
                $drop:
                  type: array
                  items:
                    type: string
                    enum:
                      - by
                      - order
                by:
                  type: string
                order:
                  type: string
                  enum:
                    - asc
                    - desc
                  default: asc
            $replace/sort:
              type: object
              properties:
                by:
                  type: string
                order:
                  type: string
                  enum:
                    - asc
                    - desc
                  default: asc
              additionalProperties: false
        $replace/spec:
          type: object
          properties:
            match:
              type: string
              enum:
                - all
                - any
                - none
              default: all
            terms:
              type: array
              items:
                type: object
                properties:
                  op:
                    type: string
                    enum:
                      - '='
                      - '>'
                      - '>='
                      - <
                      - <=
                      - '!='
                      - '~'
                      - '=~'
                      - exists
                      - '!exists'
                      - contains
                    default: '='
                  property:
                    type: string
                  rel:
                    type: string
                  tag:
                    type: string
                  value:
                    oneOf:
                      - type: string
                      - type: number
                      - type: boolean
                      - type: string
                        format: date-time
                additionalProperties: false
            sort:
              type: object
              properties:
                by:
                  type: string
                order:
                  type: string
                  enum:
                    - asc
                    - desc
                  default: asc
              additionalProperties: false
          additionalProperties: false
    query:
      type: object
      properties:
        kind:
          type: string
        context:
          type: object
          readOnly: true
        spec:
          type: object
          properties:
            match:
              type: string
              enum:
                - all
                - any
                - none
              default: all
            terms:
              type: array
              items:
                type: object
                properties:
                  op:
                    type: string
                    enum:
                      - '='
                      - '>'
                      - '>='
                      - <
                      - <=
                      - '!='
                      - '~'
                      - '=~'
                      - exists
                      - '!exists'
                      - contains
                    default: '='
                  property:
                    type: string
                  rel:
                    type: string
                  tag:
                    type: string
                  value:
                    oneOf:
                      - type: string
                      - type: number
                      - type: boolean
                      - type: string
                        format: date-time
                additionalProperties: false
            sort:
              type: object
              properties:
                by:
                  type: string
                order:
                  type: string
                  enum:
                    - asc
                    - desc
                  default: asc
              additionalProperties: false
          additionalProperties: false
      additionalProperties: false
    policy_binding:
      type: object
      properties:
        permissions:
          type: array
          items:
            type: string
        principalLinks:
          type: array
          items:
            type: string
      additionalProperties: false
    patch_policy_binding:
      type: object
      properties:
        $drop:
          type: array
          items:
            type: string
            enum:
              - permissions
              - principalLinks
        permissions:
          type: array
          items:
            type: string
        $drop/permissions:
          type: array
          items:
            type: string
        $append/permissions:
          type: array
          items:
            type: string
        $retain/permissions:
          type: array
          items:
            type: string
        principalLinks:
          type: array
          items:
            type: string
        $drop/principalLinks:
          type: array
          items:
            type: string
        $append/principalLinks:
          type: array
          items:
            type: string
        $retain/principalLinks:
          type: array
          items:
            type: string
    link:
      type: object
      properties:
        rel:
          type: string
        href:
          type: string
      additionalProperties: false
  securitySchemes:
    serviceAccountKey:
      type: apiKey
      in: header
      name: Authorization
      description: Service account key can be used as API keys
    jwt:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: IDP-provided token

````