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

# Merge Patterns

> POST /patterns/{pattern_id}/merge  {source_pattern_id}  -> 201 {pin_id}

V2 Wave 4B (API-IMPLEMENTATION-SPEC.md §2, §6.4): merge is now
pin-creating, NOT an eager hard merge of pattern rows. It creates a
`merge_into` pin under `source_pattern_id` targeting `{pattern_id}`, which
the anchor stage honors as a hard constraint on the NEXT engine run — the
old immediate DB merge silently fought the engine (a later run's
majority vote could re-split the same issues); pins survive reruns.



## OpenAPI

````yaml /openapi.json post /v1/patterns/{pattern_id}/merge
openapi: 3.1.0
info:
  description: Causeloop Platform Backend
  title: Causeloop API
  version: 1.0.0
servers: []
security: []
paths:
  /v1/patterns/{pattern_id}/merge:
    post:
      tags:
        - patterns
      summary: Merge Patterns
      description: >-
        POST /patterns/{pattern_id}/merge  {source_pattern_id}  -> 201 {pin_id}


        V2 Wave 4B (API-IMPLEMENTATION-SPEC.md §2, §6.4): merge is now

        pin-creating, NOT an eager hard merge of pattern rows. It creates a

        `merge_into` pin under `source_pattern_id` targeting `{pattern_id}`,
        which

        the anchor stage honors as a hard constraint on the NEXT engine run —
        the

        old immediate DB merge silently fought the engine (a later run's

        majority vote could re-split the same issues); pins survive reruns.
      operationId: merge_patterns_v1_patterns__pattern_id__merge_post
      parameters:
        - in: path
          name: pattern_id
          required: true
          schema:
            title: Pattern Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MergePatternRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema: {}
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    MergePatternRequest:
      properties:
        source_pattern_id:
          title: Source Pattern Id
          type: string
      required:
        - source_pattern_id
      title: MergePatternRequest
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    HTTPBearer:
      scheme: bearer
      type: http

````