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

# 중복 고객 병합

> 인증된 조직의 중복 고객을 기준 고객으로 병합합니다. 중복 고객의 식별자, 통화, 채팅을 기준 고객으로 옮긴 뒤 중복 고객을 영구 삭제합니다. 기준 고객의 프로필은 유지합니다. 두 고객 ID는 달라야 하며, 같으면 400 `INVALID_MERGE`를 반환합니다. 두 고객 모두 조직에 있어야 합니다. 하나라도 없으면 404 `CUSTOMER_NOT_FOUND`를 반환합니다. 작업 중 오류가 발생하면 전체 변경을 되돌립니다.



## OpenAPI

````yaml /api-reference/v3/openapi.json post /customers/merge
openapi: 3.1.0
info:
  title: vox.ai API
  description: >
    vox.ai API v3


    ### v3 공개 계약 규칙


    - 인증은 `Authorization: Bearer <token>` 헤더를 사용합니다. 조직 API 키를 Bearer 토큰으로
    전달합니다.

    - 요청과 응답 필드는 기본적으로 `snake_case`를 사용합니다.

    - `agent.data`는 에이전트 레지스트리와 호환되어야 하므로 `callSettings`, `toolIds`,
    `builtInTools`, `presetDynamicVariables` 같은 camelCase 필드를 유지합니다.

    - `_at`으로 끝나는 타임스탬프는 unix milliseconds입니다. 일부 입력값은 호환성을 위해 10~11자리 unix
    seconds도 허용하고 milliseconds로 정규화합니다.

    - 캠페인 통화 가능 시간은 분 단위 정수(`start_min` / `end_min`)를 사용합니다. 알림 스케줄은 `HH:MM`
    문자열(`start_time` / `end_time`)을 사용합니다.

    - 응답 객체 자신의 식별자는 `id`입니다. 다른 리소스를 참조하는 필드와 path parameter는 `agent_id`,
    `call_id`, `telephone_line_id`처럼 명시적인 이름을 사용합니다.

    - 실패 응답은 `{ "error": { "code", "message", "details" } }` 형태입니다. 가능한 경우
    `details.field`, `details.reason`, `details.allowed_values`를 함께 제공합니다.
  version: 3.0.0
servers:
  - url: https://client-api.tryvox.co/v3
    description: 운영
security: []
paths:
  /customers/merge:
    post:
      tags:
        - Customers
      summary: 중복 고객 병합
      description: >-
        인증된 조직의 중복 고객을 기준 고객으로 병합합니다. 중복 고객의 식별자, 통화, 채팅을 기준 고객으로 옮긴 뒤 중복 고객을 영구
        삭제합니다. 기준 고객의 프로필은 유지합니다. 두 고객 ID는 달라야 하며, 같으면 400 `INVALID_MERGE`를
        반환합니다. 두 고객 모두 조직에 있어야 합니다. 하나라도 없으면 404 `CUSTOMER_NOT_FOUND`를 반환합니다. 작업
        중 오류가 발생하면 전체 변경을 되돌립니다.
      operationId: mergeCustomers
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MergeCustomersRequest'
        required: true
        description: 병합할 기준 고객과 중복 고객의 UUID입니다.
      responses:
        '200':
          description: 성공 응답
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponse'
        '400':
          description: 요청 검증 오류
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validationError:
                  summary: 요청 검증 오류
                  value:
                    error:
                      code: VALIDATION_ERROR
                      message: Request validation failed.
                      details:
                        field: name
                        reason: must not be blank
        '401':
          description: 인증이 필요합니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Bearer 토큰 누락 또는 오류
                  value:
                    error:
                      code: UNAUTHORIZED
                      message: Authentication is required.
                      details: {}
        '403':
          description: 권한이 없습니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                forbidden:
                  summary: 권한이 없습니다.
                  value:
                    error:
                      code: FORBIDDEN
                      message: Permission denied.
                      details: {}
        '404':
          description: 리소스를 찾을 수 없습니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                notFound:
                  summary: 리소스를 찾을 수 없습니다.
                  value:
                    error:
                      code: RESOURCE_NOT_FOUND
                      message: Resource not found.
                      details:
                        resource: agent
        '409':
          description: 충돌이 발생했습니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                conflict:
                  summary: 상태 충돌이 발생했습니다.
                  value:
                    error:
                      code: CONFLICT
                      message: The requested operation conflicts with current state.
                      details:
                        current_status: draft
        '429':
          description: 요청 한도를 초과했습니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                rateLimited:
                  summary: 요청 한도를 초과했습니다.
                  value:
                    error:
                      code: RATE_LIMIT_EXCEEDED
                      message: Too many requests.
                      details:
                        limit: 5
                        window_seconds: 1
        '500':
          description: 서버 내부 오류가 발생했습니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internalError:
                  summary: 서버 내부 오류가 발생했습니다.
                  value:
                    error:
                      code: INTERNAL_ERROR
                      message: Internal server error.
                      details: {}
        '503':
          description: 서비스를 일시적으로 사용할 수 없습니다.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                serviceUnavailable:
                  summary: 서비스를 일시적으로 사용할 수 없습니다.
                  value:
                    error:
                      code: SERVICE_UNAVAILABLE
                      message: Service temporarily unavailable.
                      details: {}
      security:
        - BearerAuth: []
components:
  schemas:
    MergeCustomersRequest:
      properties:
        main_customer_id:
          type: string
          format: uuid
          title: Main Customer Id
          description: 유지할 고객 UUID입니다.
        duplicate_customer_id:
          type: string
          format: uuid
          title: Duplicate Customer Id
          description: 병합 후 삭제할 고객 UUID입니다.
      type: object
      required:
        - main_customer_id
        - duplicate_customer_id
      title: MergeCustomersRequest
      description: |-
        중복 고객의 식별자와 인터랙션을 기준 고객으로 병합하는 요청입니다.

        중복 고객은 삭제하고 기준 고객의 프로필은 유지합니다.
    CustomerResponse:
      properties:
        id:
          type: string
          title: Id
          description: 고객 UUID입니다.
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: 고객 이름입니다.
        note:
          anyOf:
            - type: string
            - type: 'null'
          title: Note
          description: 고객 메모입니다.
        attributes:
          additionalProperties: true
          type: object
          title: Attributes
          description: 자동 추출한 고객 속성 값입니다. 이름에 해당하는 정의가 없어도 저장된 값을 유지합니다.
        created_at:
          type: integer
          title: Created At
          description: 리소스 생성 시각입니다. 밀리초 단위 unix timestamp입니다.
        updated_at:
          type: integer
          title: Updated At
          description: 리소스 수정 시각입니다. 밀리초 단위 unix timestamp입니다.
        identifiers:
          items:
            $ref: '#/components/schemas/CustomerIdentifierResponse'
          type: array
          title: Identifiers
          description: 고객 신원 식별자 목록입니다.
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
          description: 고객 메타데이터입니다.
        interaction_summary:
          $ref: '#/components/schemas/CustomerInteractionSummary'
          description: 통화와 채팅 인터랙션의 집계 요약입니다.
      type: object
      required:
        - id
        - attributes
        - created_at
        - updated_at
        - identifiers
        - metadata
        - interaction_summary
      title: CustomerResponse
      description: >-
        목록 항목 형상에 메타데이터와 인터랙션 요약을 추가한 고객 응답입니다.


        식별자 검색, 생성, 수정, 병합에서 반환합니다. `CustomerListItemResponse`에는 인터랙션 요약이 없으므로
        목록 조회의 집계 비용을 줄입니다. 인터랙션 요약은 이 응답을 사용하는 경로에서만 제공합니다.


        메모리는 이 응답에 없으며 `CustomerDetailResponse`에만 있습니다. 식별자 검색, 생성, 수정, 병합에서는
        메모리를 불러오지 않습니다. 메모리 필드를 포함하면 실제 메모리가 없는 것처럼 보이는 빈 그룹을 반환하므로 고객 단건 조회에서만
        제공합니다.
    ErrorResponse:
      type: object
      required:
        - error
      title: ErrorResponse
      description: 모든 실패 응답에서 사용하는 v3 error envelope입니다.
      examples:
        - error:
            code: VALIDATION_ERROR
            message: Request validation failed.
            details:
              field: name
              reason: must not be blank
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
          description: 오류 payload입니다.
    CustomerIdentifierResponse:
      properties:
        id:
          type: string
          title: Id
          description: 식별자 UUID입니다.
        identifier_type:
          type: string
          title: Identifier Type
          description: 식별자 유형입니다. 값은 `phone` 또는 `external_id`입니다.
        identifier_value:
          type: string
          title: Identifier Value
          description: 정규화된 표준 식별자 값입니다.
        created_at:
          type: integer
          title: Created At
          description: 리소스 생성 시각입니다. 밀리초 단위 unix timestamp입니다.
      type: object
      required:
        - id
        - identifier_type
        - identifier_value
        - created_at
      title: CustomerIdentifierResponse
      description: 고객 신원 식별자 응답입니다. `is_primary`는 제공하지 않습니다.
    CustomerInteractionSummary:
      properties:
        interaction_count:
          type: integer
          title: Interaction Count
          description: 통화와 채팅의 전체 개수입니다.
        first_interaction_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: First Interaction At
          description: 가장 이른 인터랙션 시각입니다. 밀리초 단위 unix timestamp입니다. 인터랙션이 없으면 null입니다.
        last_interaction_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Last Interaction At
          description: 가장 최근 인터랙션 시각입니다. 밀리초 단위 unix timestamp입니다. 인터랙션이 없으면 null입니다.
        last_interaction_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Interaction Id
          description: 가장 최근 인터랙션의 ID입니다. 인터랙션이 없으면 null입니다.
        last_interaction_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Interaction Type
          description: 가장 최근 인터랙션의 유형입니다. 값은 `call` 또는 `chat`입니다. 인터랙션이 없으면 null입니다.
      type: object
      required:
        - interaction_count
      title: CustomerInteractionSummary
      description: >-
        고객의 통화와 채팅 인터랙션을 집계한 요약입니다.


        인터랙션 시각은 활동 시각을 나타냅니다. 채팅의 `last_interaction_at`은 유휴 정리 작업으로도 갱신될 수 있으므로
        사람이 마지막으로 메시지를 보낸 시각과 다를 수 있습니다. 인터랙션이 없으면 개수는 0이고 시각은 null입니다.
    ErrorDetail:
      type: object
      required:
        - code
        - message
        - details
      title: ErrorDetail
      description: 기계가 읽을 수 있는 v3 오류 상세 정보입니다.
      examples:
        - code: VALIDATION_ERROR
          message: Request validation failed.
          details:
            field: name
            reason: must not be blank
      properties:
        code:
          type: string
          title: Code
          description: 기계가 읽을 수 있는 오류 code입니다. message parsing 대신 이 값을 사용합니다.
          examples:
            - VALIDATION_ERROR
        message:
          type: string
          title: Message
          description: 사용자에게 표시할 수 있는 오류 메시지입니다. 프로그램 처리는 `code`를 사용합니다.
          examples:
            - Request validation failed.
        details:
          type: object
          title: Details
          additionalProperties: true
          description: 구조화된 context입니다. 주로 `field`, `reason`, `allowed_values`를 포함합니다.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Organization API key
      description: '조직 API 키를 `Authorization: Bearer <token>` 형식으로 보냅니다.'

````