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

# Merge Lists

> Merges contacts from one or more source lists into the target list. Optionally deletes the source lists after merging.

Merges contacts from one or more source lists into a target list. Optionally deletes the source lists after merging.

This is useful when payload limits require creating multiple sub-lists that should logically be one list. Instead of leaving SDRs with fragmented lists in the dialer, merge them server-side into a single clean list.

### Path Parameters

* **id** (*required*, string): Target contact list ID to merge into.

### Request Body

| Field             | Type      | Required | Description                                                        |
| ----------------- | --------- | -------- | ------------------------------------------------------------------ |
| `source_list_ids` | string\[] | Yes      | IDs of the source lists to merge into the target (1–20 lists)      |
| `delete_sources`  | boolean   | No       | Whether to delete the source lists after merging. Default: `false` |

### Limits

* Max **20** source lists per merge request
* The target list cannot appear in `source_list_ids` (it will be ignored)

### Example Request

```json theme={null}
{
  "source_list_ids": [
    "507f1f77bcf86cd799439011",
    "507f1f77bcf86cd799439012",
    "507f1f77bcf86cd799439013"
  ],
  "delete_sources": true
}
```

### Response (201)

Returns the updated target contact list.

### Errors

| Status | Description                   |
| ------ | ----------------------------- |
| 404    | Target contact list not found |


## OpenAPI

````yaml POST /v1/contact-lists/{id}/merge
openapi: 3.0.1
info:
  title: Salesfinity API
  description: API documentation for Salesfinity platform
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://client-api.salesfinity.co
security:
  - ApiKeyAuth: []
paths:
  /v1/contact-lists/{id}/merge:
    post:
      tags:
        - Contact Lists
      summary: Merge contact lists
      description: >-
        Merges contacts from one or more source lists into the target list.
        Optionally deletes the source lists after merging.
      operationId: merge-lists
      parameters:
        - name: id
          in: path
          required: true
          description: Target contact list ID to merge into
          schema:
            type: string
            example: 507f1f77bcf86cd799439011
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MergeContactListsDTO'
      responses:
        '201':
          description: Lists merged successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactListDTO'
        '404':
          description: Target contact list not found
components:
  schemas:
    MergeContactListsDTO:
      type: object
      required:
        - source_list_ids
      properties:
        source_list_ids:
          type: array
          description: IDs of the source lists to merge into the target list
          items:
            type: string
          minItems: 1
          maxItems: 20
          example:
            - 507f1f77bcf86cd799439011
            - 507f1f77bcf86cd799439012
        delete_sources:
          type: boolean
          description: Whether to delete the source lists after merging
          default: false
    ContactListDTO:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
        name:
          type: string
          description: Contact list name
        source:
          type: string
          enum:
            - csv
            - hubspot
            - salesforce
            - manual
          description: List source
        user:
          $ref: '#/components/schemas/UserDTO'
        total_contacts:
          type: integer
          description: Number of contacts
      required:
        - _id
        - name
        - source
    UserDTO:
      type: object
      properties:
        _id:
          type: string
        email:
          type: string
        first_name:
          type: string
        last_name:
          type: string
      required:
        - _id
        - email
        - first_name
        - last_name
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````