# Merge a lead and a user

`POST /contacts/merge`

> This is a subset of the full specification, limited to the `POST /contacts/merge` operation.
>
> You can find the full specification here: /_bundle/docs/references/@2.15/rest-api/api.intercom.io.yaml

```yaml
openapi: 3.0.1
info:
  title: Intercom API
  version: '2.15'
  description: This is a subset of the full specification, limited to the `POST /contacts/merge` operation.
  contact:
    name: Intercom Developer Hub
    url: https://developers.intercom.com
  license:
    name: MIT
    url: https://spdx.org/licenses/MIT
servers:
  - url: https://api.intercom.io
    description: The production API server
  - url: https://api.eu.intercom.io
    description: The european API server
  - url: https://api.au.intercom.io
    description: The australian API server
security:
  - bearerAuth: []
tags:
  - name: Contacts
    description: Everything about your contacts
paths:
  /contacts/merge:
    post:
      summary: Merge a lead and a user
      parameters:
        - name: Intercom-Version
          in: header
          schema:
            $ref: '#/components/schemas/intercom_version'
      tags:
        - Contacts
      operationId: MergeContact
      description: |-
        You can merge a contact with a `role` of `lead` into a contact with a `role` of `user`.

        **Merged contacts are not retrievable via the API**

        Once a merge is completed, the source contact (`from`) is permanently removed from the active contact list. This means:

        - **GET /contacts/{id}** — Requesting the source contact by its original ID will return a `404 Not Found` error.
        - **POST /contacts/search** — The source contact will not appear in search results, including queries filtered by `updated_at`.
        - **GET /contacts** — The source contact will not appear in list results.

        Only the target contact (`into`) remains accessible. If your application stores contact IDs, update them to use the target contact's ID after a merge.
      responses:
        '200':
          description: successful
          content:
            application/json:
              examples:
                successful:
                  value:
                    type: contact
                    id: 6762f0d51bb69f9f2193bb80
                    workspace_id: this_is_an_id291_that_should_be_at_least_
                    external_id: '70'
                    role: user
                    email: joe@bloggs.com
                    phone: null
                    name: Joe Bloggs
                    avatar: null
                    owner_id: null
                    social_profiles:
                      type: list
                      data: []
                    has_hard_bounced: false
                    marked_email_as_spam: false
                    unsubscribed_from_emails: false
                    created_at: 1734537429
                    updated_at: 1734537430
                    signed_up_at: 1734537429
                    last_seen_at: null
                    last_replied_at: null
                    last_contacted_at: null
                    last_email_opened_at: null
                    last_email_clicked_at: null
                    language_override: null
                    browser: null
                    browser_version: null
                    browser_language: null
                    os: null
                    location:
                      type: location
                      country: null
                      region: null
                      city: null
                      country_code: null
                      continent_code: null
                    android_app_name: null
                    android_app_version: null
                    android_device: null
                    android_os_version: null
                    android_sdk_version: null
                    android_last_seen_at: null
                    ios_app_name: null
                    ios_app_version: null
                    ios_device: null
                    ios_os_version: null
                    ios_sdk_version: null
                    ios_last_seen_at: null
                    custom_attributes: {}
                    tags:
                      type: list
                      data: []
                      url: /contacts/6762f0d51bb69f9f2193bb80/tags
                      total_count: 0
                      has_more: false
                    notes:
                      type: list
                      data: []
                      url: /contacts/6762f0d51bb69f9f2193bb80/notes
                      total_count: 0
                      has_more: false
                    companies:
                      type: list
                      data: []
                      url: /contacts/6762f0d51bb69f9f2193bb80/companies
                      total_count: 0
                      has_more: false
                    opted_out_subscription_types:
                      type: list
                      data: []
                      url: /contacts/6762f0d51bb69f9f2193bb80/subscriptions
                      total_count: 0
                      has_more: false
                    opted_in_subscription_types:
                      type: list
                      data: []
                      url: /contacts/6762f0d51bb69f9f2193bb80/subscriptions
                      total_count: 0
                      has_more: false
                    utm_campaign: null
                    utm_content: null
                    utm_medium: null
                    utm_source: null
                    utm_term: null
                    referrer: null
                    enabled_push_messaging: null
              schema:
                allOf:
                  - $ref: '#/components/schemas/contact'
                properties:
                  enabled_push_messaging:
                    type: boolean
                    nullable: true
                    description: If the user has enabled push messaging.
                    example: true
        '401':
          description: Unauthorized
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    type: error.list
                    request_id: ff328c7c-6140-48eb-84dd-bb8960b66cd0
                    errors:
                      - code: unauthorized
                        message: Access Token Invalid
              schema:
                $ref: '#/components/schemas/error'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/merge_contacts_request'
            examples:
              successful:
                summary: successful
                value:
                  from: 6762f0d51bb69f9f2193bb7f
                  into: 6762f0d51bb69f9f2193bb80
components:
  schemas:
    addressable_list:
      title: Addressable List
      type: object
      nullable: false
      description: A list used to access other resources from a parent model.
      properties:
        type:
          type: string
          format: uri
          description: The addressable object type
          example: note
        id:
          type: string
          description: The id of the addressable object
          example: '123'
        url:
          type: string
          format: uri
          description: Url to get more company resources for this contact
          example: /contacts/5ba682d23d7cf92bef87bfd4/notes
    contact:
      title: Contact
      type: object
      x-tags:
        - Contacts
      x-fern-sdk-group-name: contacts
      description: Contacts represent your leads and users in Intercom.
      properties:
        type:
          type: string
          description: The type of object.
          example: contact
        id:
          type: string
          description: The unique identifier for the contact which is given by Intercom.
          example: 5ba682d23d7cf92bef87bfd4
        external_id:
          type: string
          nullable: true
          description: The unique identifier for the contact which is provided by the Client.
          example: f3b87a2e09d514c6c2e79b9a
        workspace_id:
          type: string
          description: The id of the workspace which the contact belongs to.
          example: ecahpwf5
        role:
          type: string
          description: The role of the contact.
          example: user
        email:
          type: string
          description: The contact's email.
          example: joe@example.com
        email_domain:
          type: string
          description: The contact's email domain.
          example: example.com
        phone:
          type: string
          nullable: true
          description: The contacts phone.
          example: '+1123456789'
        name:
          type: string
          nullable: true
          description: The contacts name.
          example: John Doe
        owner_id:
          type: integer
          nullable: true
          description: The id of an admin that has been assigned account ownership of the contact.
          example: 123
        has_hard_bounced:
          type: boolean
          description: Whether the contact has had an email sent to them hard bounce.
          example: true
        marked_email_as_spam:
          type: boolean
          description: Whether the contact has marked an email sent to them as spam.
          example: true
        unsubscribed_from_emails:
          type: boolean
          description: Whether the contact is unsubscribed from emails.
          example: true
        created_at:
          type: integer
          format: date-time
          description: (Unix timestamp in seconds) The time when the contact was created.
          example: 1571672154
        updated_at:
          type: integer
          format: date-time
          description: (Unix timestamp in seconds) The time when the contact was last updated.
          example: 1571672154
        signed_up_at:
          type: integer
          format: date-time
          nullable: true
          description: (Unix timestamp in seconds) The time specified for when a contact signed up.
          example: 1571672154
        last_seen_at:
          type: integer
          format: date-time
          nullable: true
          description: (Unix timestamp in seconds) The time when the contact was last seen (either where the Intercom Messenger was installed or when specified manually).
          example: 1571672154
        last_replied_at:
          type: integer
          format: date-time
          nullable: true
          description: (Unix timestamp in seconds) The time when the contact last messaged in.
          example: 1571672154
        last_contacted_at:
          type: integer
          format: date-time
          nullable: true
          description: (Unix timestamp in seconds) The time when the contact was last messaged.
          example: 1571672154
        last_email_opened_at:
          type: integer
          format: date-time
          nullable: true
          description: (Unix timestamp in seconds) The time when the contact last opened an email.
          example: 1571672154
        last_email_clicked_at:
          type: integer
          format: date-time
          nullable: true
          description: (Unix timestamp in seconds) The time when the contact last clicked a link in an email.
          example: 1571672154
        language_override:
          type: string
          nullable: true
          description: A preferred language setting for the contact, used by the Intercom Messenger even if their browser settings change.
          example: en
        browser:
          type: string
          nullable: true
          description: The name of the browser which the contact is using.
          example: Chrome
        browser_version:
          type: string
          nullable: true
          description: The version of the browser which the contact is using.
          example: 80.0.3987.132
        browser_language:
          type: string
          nullable: true
          description: The language set by the browser which the contact is using.
          example: en-US
        os:
          type: string
          nullable: true
          description: The operating system which the contact is using.
          example: Mac OS X
        android_app_name:
          type: string
          nullable: true
          description: The name of the Android app which the contact is using.
          example: Intercom
        android_app_version:
          type: string
          nullable: true
          description: The version of the Android app which the contact is using.
          example: 5.0.0
        android_device:
          type: string
          nullable: true
          description: The Android device which the contact is using.
          example: Pixel 3
        android_os_version:
          type: string
          nullable: true
          description: The version of the Android OS which the contact is using.
          example: '10'
        android_sdk_version:
          type: string
          nullable: true
          description: The version of the Android SDK which the contact is using.
          example: '28'
        android_last_seen_at:
          type: integer
          nullable: true
          format: date-time
          description: (Unix timestamp in seconds) The time when the contact was last seen on an Android device.
          example: 1571672154
        ios_app_name:
          type: string
          nullable: true
          description: The name of the iOS app which the contact is using.
          example: Intercom
        ios_app_version:
          type: string
          nullable: true
          description: The version of the iOS app which the contact is using.
          example: 5.0.0
        ios_device:
          type: string
          nullable: true
          description: The iOS device which the contact is using.
          example: iPhone 11
        ios_os_version:
          type: string
          nullable: true
          description: The version of iOS which the contact is using.
          example: 13.3.1
        ios_sdk_version:
          type: string
          nullable: true
          description: The version of the iOS SDK which the contact is using.
          example: 13.3.1
        ios_last_seen_at:
          type: integer
          nullable: true
          format: date-time
          description: (Unix timestamp in seconds) The last time the contact used the iOS app.
          example: 1571672154
        custom_attributes:
          type: object
          description: The custom attributes which are set for the contact.
        avatar:
          type: object
          nullable: true
          properties:
            type:
              type: string
              description: The type of object
              example: avatar
            image_url:
              type: string
              format: uri
              nullable: true
              description: An image URL containing the avatar of a contact.
              example: https://example.org/128Wash.jpg
        tags:
          $ref: '#/components/schemas/contact_tags'
        notes:
          $ref: '#/components/schemas/contact_notes'
        companies:
          $ref: '#/components/schemas/contact_companies'
        location:
          $ref: '#/components/schemas/contact_location'
        social_profiles:
          $ref: '#/components/schemas/contact_social_profiles'
    contact_companies:
      title: Contact companies
      type: object
      nullable: false
      description: An object with metadata about companies attached to a contact . Up to 10 will be displayed here. Use the url to get more.
      properties:
        data:
          type: array
          description: An array of company data objects attached to the contact.
          items:
            $ref: '#/components/schemas/company_data'
        url:
          type: string
          format: uri
          description: Url to get more company resources for this contact
          example: /contacts/5ba682d23d7cf92bef87bfd4/companies
        total_count:
          type: integer
          description: Integer representing the total number of companies attached to this contact
          example: 100
        has_more:
          type: boolean
          description: Whether there's more Addressable Objects to be viewed. If true, use the url to view all
          example: true
    company_data:
      title: Company Data
      type: object
      description: An object containing data about the companies that a contact is associated with.
      properties:
        id:
          type: string
          description: The unique identifier for the company which is given by Intercom.
          example: 5ba682d23d7cf92bef87bfd4
        type:
          type: string
          description: The type of the object. Always company.
          enum:
            - company
          example: company
        url:
          type: string
          format: uri
          description: The relative URL of the company.
          example: /companies/5ba682d23d7cf92bef87bfd4
    contact_location:
      title: Contact Location
      type: object
      nullable: false
      description: An object containing location meta data about a Intercom contact.
      properties:
        type:
          type: string
          nullable: true
          description: Always location
          example: location
        country:
          type: string
          nullable: true
          description: The country that the contact is located in
          example: Ireland
        region:
          type: string
          nullable: true
          description: The overal region that the contact is located in
          example: Dublin
        city:
          type: string
          nullable: true
          description: The city that the contact is located in
          example: Dublin
    contact_notes:
      title: Contact notes
      type: object
      nullable: false
      description: An object containing notes meta data about the notes that a contact has. Up to 10 will be displayed here. Use the url to get more.
      properties:
        data:
          type: array
          description: This object represents the notes attached to a contact.
          items:
            $ref: '#/components/schemas/addressable_list'
        url:
          type: string
          format: uri
          description: Url to get more company resources for this contact
          example: /contacts/5ba682d23d7cf92bef87bfd4/notes
        total_count:
          type: integer
          description: Int representing the total number of companyies attached to this contact
          example: 100
        has_more:
          type: boolean
          description: Whether there's more Addressable Objects to be viewed. If true, use the url to view all
          example: true
    contact_social_profiles:
      title: Social Profile
      type: object
      nullable: false
      description: An object containing social profiles that a contact has.
      properties:
        data:
          type: array
          description: A list of social profiles objects associated with the contact.
          items:
            $ref: '#/components/schemas/social_profile'
    contact_tags:
      title: Contact Tags
      type: object
      nullable: true
      description: An object containing tags meta data about the tags that a contact has. Up to 10 will be displayed here. Use the url to get more.
      properties:
        data:
          type: array
          description: This object represents the tags attached to a contact.
          items:
            $ref: '#/components/schemas/addressable_list'
        url:
          type: string
          format: uri
          description: url to get more tag resources for this contact
          example: /contacts/5ba682d23d7cf92bef87bfd4/tags
        total_count:
          type: integer
          description: Int representing the total number of tags attached to this contact
          example: 100
        has_more:
          type: boolean
          description: Whether there's more Addressable Objects to be viewed. If true, use the url to view all
          example: true
    error:
      type: object
      title: Error
      description: The API will return an Error List for a failed request, which will contain one or more Error objects.
      properties:
        type:
          type: string
          description: The type is error.list
          example: error.list
        request_id:
          type: string
          nullable: true
          format: uuid
          description: ''
          example: f93ecfa8-d08a-4325-8694-89aeb89c8f85
        errors:
          type: array
          description: An array of one or more error objects
          items:
            properties:
              code:
                type: string
                description: A string indicating the kind of error, used to further qualify the HTTP response code
                example: unauthorized
              message:
                type: string
                nullable: true
                description: Optional. Human readable description of the error.
                example: Access Token Invalid
              field:
                type: string
                nullable: true
                description: Optional. Used to identify a particular field or query parameter that was in error.
                example: email
            required:
              - code
      required:
        - type
        - errors
    intercom_version:
      description: Intercom API version.</br>By default, it's equal to the version set in the app package.
      type: string
      example: '2.15'
      default: '2.15'
      enum:
        - '1.0'
        - '1.1'
        - '1.2'
        - '1.3'
        - '1.4'
        - '2.0'
        - '2.1'
        - '2.2'
        - '2.3'
        - '2.4'
        - '2.5'
        - '2.6'
        - '2.7'
        - '2.8'
        - '2.9'
        - '2.10'
        - '2.11'
        - '2.12'
        - '2.13'
        - '2.14'
        - '2.15'
    merge_contacts_request:
      description: Merge contact data.
      type: object
      title: Merge contact data
      required:
        - from
        - into
      properties:
        from:
          type: string
          description: The unique identifier for the contact to merge away from. Must be a lead.
          example: 5d70dd30de4efd54f42fd526
        into:
          type: string
          description: The unique identifier for the contact to merge into. Must be a user.
          example: 5ba682d23d7cf92bef87bfd4
    social_profile:
      title: Social Profile
      type: object
      description: A Social Profile allows you to label your contacts, companies, and conversations and list them using that Social Profile.
      properties:
        type:
          type: string
          description: value is "social_profile"
          example: social_profile
        name:
          type: string
          description: The name of the Social media profile
          example: Facebook
        url:
          type: string
          format: uri
          description: The name of the Social media profile
          example: http://twitter.com/th1sland
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
```
