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

# Merge Duplicate Group

> Merge a group into one surviving record. IRREVERSIBLE.

Returns 200 with the result when the merge finishes quickly, otherwise 202 with
a job to poll. 409 if a merge for this group is already in flight, if the group
is no longer pending, or if it changed since the reviewer loaded it.



## OpenAPI

````yaml /openapi-generated.json post /duplicates/{group_id}/merge
openapi: 3.1.0
info:
  title: anycrm-api
  version: 0.0.1
servers: []
security: []
tags:
  - name: Customer Intelligence
    description: >-
      Company research and ICP-fit scoring — create a research run, track its
      progress, and read back scored companies as leads.
  - name: Outreach
    description: >-
      The cold-email management console — domains, mailboxes, and campaigns — as
      a thin control plane over the SalesForge stack.
  - name: AnyCard
    description: >-
      Authenticated CRUD for AnyCard, the org's digital business-card /
      lead-capture product.
  - name: AnyCard Events
    description: >-
      Event-attribution analytics for AnyCard — which captured leads converted,
      broken down by source, owner, and deal.
  - name: AnyCard Share Links
    description: >-
      Unauthenticated endpoints reached by anyone who scans a QR code or opens a
      shared AnyCard link.
  - name: AI
    description: >-
      A streaming (SSE) AI chat endpoint with account-commit actions it can take
      on the caller's behalf.
  - name: Analytics Assistant
    description: >-
      The natural-language analytics assistant — a guarded text-to-SQL loop
      (SSE) that answers ad-hoc questions over the org's CRM data as a
      least-privilege, read-only database role.
  - name: Account Readiness
    description: >-
      Account Readiness Profiles — AI-scored signals on whether an account is
      ready for outreach or expansion, computed via a Temporal workflow.
  - name: Integrations
    description: >-
      Pipedream Connect — issuing connect tokens and managing the org's
      connected third-party accounts.
  - name: Feedback
    description: >-
      User-submitted platform feedback (bug reports, feature requests) — global,
      not scoped to one organization.
  - name: Public Media
    description: >-
      Unauthenticated image reads for publicly-embeddable assets (card photos,
      inline email images) — allowlisted by key shape; everything else in the
      storage bucket stays private.
  - name: Service Health
    description: Service liveness.
paths:
  /duplicates/{group_id}/merge:
    post:
      tags:
        - Duplicates
      summary: Merge Duplicate Group
      description: >-
        Merge a group into one surviving record. IRREVERSIBLE.


        Returns 200 with the result when the merge finishes quickly, otherwise
        202 with

        a job to poll. 409 if a merge for this group is already in flight, if
        the group

        is no longer pending, or if it changed since the reviewer loaded it.
      operationId: merge_duplicate_group_route_duplicates__group_id__merge_post
      parameters:
        - name: group_id
          in: path
          required: true
          schema:
            type: string
            description: Duplicate group to merge.
            title: Group Id
          description: Duplicate group to merge.
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Idempotency-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DuplicateMergeBody'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    DuplicateMergeBody:
      properties:
        winner_id:
          type: string
          title: Winner Id
          description: Id of the record that survives the merge.
        loser_ids:
          items:
            type: string
          type: array
          minItems: 1
          title: Loser Ids
          description: >-
            Ids of the records to merge into the winner and then permanently
            delete. Must be members of the group.
        field_choices:
          items:
            $ref: '#/components/schemas/MergeFieldChoice'
          type: array
          title: Field Choices
          description: >-
            Per-field overrides. Any field omitted keeps the winner's own value,
            or the loser's when the winner's is empty.
        expected_member_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Expected Member Key
          description: >-
            The group's member_key as shown to the reviewer. If the set of
            records in the group changed since, the merge is rejected with 409
            rather than applied to something the reviewer did not see.
            Deliberately not a timestamp: every scheduled rescan touches the
            group's last_seen_at, so a timestamp would reject a perfectly valid
            review just because a nightly scan ran.
      type: object
      required:
        - winner_id
        - loser_ids
      title: DuplicateMergeBody
      description: >-
        Merge a duplicate group into one surviving record.


        Irreversible: every record in loser_ids is merged into winner_id and
        then

        permanently deleted. Their activities, deals, tasks and enrollments are

        reparented onto the winner first.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MergeFieldChoice:
      properties:
        field:
          type: string
          title: Field
          description: >-
            Column on the surviving record whose value is being overridden, e.g.
            'title'.
        source_record_id:
          type: string
          title: Source Record Id
          description: >-
            Id of the group member whose value wins for this field. Must be the
            winner or one of the losers.
      type: object
      required:
        - field
        - source_record_id
      title: MergeFieldChoice
      description: One per-field override chosen by the reviewer in the compare view.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````