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

# Apply Patch

> Apply a patch to a target resource.

Checks compatibility constraints, then dispatches a PATCH event to the
provider for actual application. The provider implements the patch logic
via its on_patch handler.

Returns:
    ApplyPatchResult with outcome details.



## OpenAPI

````yaml https://api.pragmatiks.io/openapi.json post /projects/{project_id}/patches/{patch_id}/apply/{target_resource_id}
openapi: 3.1.0
info:
  title: Pragma API
  version: 0.1.0
servers: []
security: []
paths:
  /projects/{project_id}/patches/{patch_id}/apply/{target_resource_id}:
    post:
      tags:
        - patches
      summary: Apply Patch
      description: |-
        Apply a patch to a target resource.

        Checks compatibility constraints, then dispatches a PATCH event to the
        provider for actual application. The provider implements the patch logic
        via its on_patch handler.

        Returns:
            ApplyPatchResult with outcome details.
      operationId: patches-apply_patch
      parameters:
        - name: patch_id
          in: path
          required: true
          schema:
            type: string
            title: Patch Id
        - name: target_resource_id
          in: path
          required: true
          schema:
            type: string
            title: Target Resource Id
        - name: project_id
          in: path
          required: true
          schema:
            type: string
            title: Project Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplyPatchResult'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ApplyPatchResult:
      properties:
        patch_id:
          type: string
          title: Patch Id
        target_resource_id:
          type: string
          title: Target Resource Id
        success:
          type: boolean
          title: Success
        message:
          type: string
          title: Message
          default: ''
      type: object
      required:
        - patch_id
        - target_resource_id
        - success
      title: ApplyPatchResult
      description: |-
        Result of applying a patch to a target resource.

        Attributes:
            patch_id: ID of the patch that was applied.
            target_resource_id: SurrealDB ID of the target resource.
            success: Whether the patch was applied successfully.
            message: Human-readable description of the outcome.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````