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

> Add companies to a static company list, or remove them with ?action=remove.

# Add or Remove Companies in a List

Adds existing CRM companies to a **static** company list, or removes them when you set `?action=remove`. The list must be a static company list (`clt_xxx`); dynamic lists (auto-populated by filter rules) and contact lists are rejected.

<Warning>
  **Removal uses `POST ?action=remove`, not `DELETE`.** A `DELETE` request body is dropped by our stack, so `DELETE` on this path is not supported and returns `405 Method Not Allowed`.
</Warning>

<Note>
  Removing a company from a list only affects list **membership** — it does not delete the company from your CRM.
</Note>

## Add vs remove

| Action     | Request                                              | Result                                                                                                                     |
| ---------- | ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **Add**    | `POST` with `{ "companyIds": [...] }`                | Companies are added. Those already in the list are silently skipped (counted in `alreadyInList`).                          |
| **Remove** | `POST ?action=remove` with `{ "companyIds": [...] }` | Companies are removed. Those not in the list are silently skipped (`removedCount` reflects associations actually removed). |

## Typical workflow

1. **Find or create a list** — use `GET /companies/lists` to find an existing static list, or `POST /companies/lists` to create one (`clt_xxx`).
2. **Find companies** — use `GET /companies` with `search` or `listId` to get company IDs (`cpn_xxx`).
3. **Add or remove** — call this endpoint with the company IDs and list ID. Up to 1,000 companies per request.


## OpenAPI

````yaml post /companies/lists/{listId}/entities
openapi: 3.0.0
info:
  title: lemlist API
  version: 1.0.0
  description: >-
    Welcome to the lemlist Developer Documentation.


    lemlist is very customizable and open. You'll find on this page all the API
    and integration you can do with lemlist.


    # Rate Limit


    lemlist's API rate limits requests in order to prevent abuse and overload of
    our services.  

    Rate limits are applied on all routes and per API key performing the
    request.  

    The rate limits are **20** requests per **2** seconds.  

    The response provides any information you may need about it:


    | Header | Description |

    | --- | --- |

    | Retry-After | The number of seconds in which you can retry |

    | X-RateLimit-Limit | The maximum requests in that time |

    | X-RateLimit-Remaining | The number of remaining requests you can make |

    | X-RateLimit-Reset | The date when the rate limit will reset |


    _Example of values for the rate limit headers_


    ``` json

    {
        "Retry-After": 2,
        "X-RateLimit-Limit": 20,
        "X-RateLimit-Remaining": 7,
        "X-RateLimit-Reset" : "Tue Feb 16 2021 09:02:42 GMT+0100 (Central European Standard Time)"
    }

     ```

    # Definitions


    ## Team


    A team is the entity of lemlist that can handle users and billing.


    ## Credits


    Credits are the coins a team uses to enrich emails, LinkedIn URLs, etc. via
    the enrich route. Each enrichment feature needs a certain amount of credits
    to run.


    ## User


    You use a user account to connect to lemlist and send messages via the
    connected emails or LinkedIn account.


    ## Campaign


    A campaign is the entity to automate outreach. A campaign has multiple
    sequences composed of steps.


    ## Lead


    A lead is a person that you try to contact via a campaign.


    ## Activity


    An activity is the history of all the steps.


    ## Unsubscribe


    An unsubscribe occurs when a person decides they don't want to receive
    emails from you anymore.


    # Authentication


    All API routes use the dedicated subdomain `api.lemlist.com`.


    lemlist uses API keys to allow access to the API. You can get your lemlist
    API key at our [integration
    page](https://app.lemlist.com/settings/integrations).


    You need to add the `Authorization` header using the `Basic` authentication
    type. `login:password` **where the login is always empty and the password is
    the API key**.


    ⚠️ **Don't forget to add the semicolon (**`:`**) before your API key in curl
    command.**


    > To authorize, use this code: 
      

    ``` shell

    curl https://api.lemlist.com/api/team \
      --user ":YourApiKey"

     ```

    **Make sure to replace** **`YourApiKey`** **with your API key.**


    # Give feedback


    If you want to report a bug, ask for data, or share with us a use case,
    please fill this [form](https://lemlist.typeform.com/to/mfVlkyGf). It will
    help us centralize your needs!
servers:
  - url: https://api.lemlist.com/api
security:
  - basicAuth: []
tags:
  - name: Enrichment Providers
    description: >-
      The data providers lemlist can call to find an email or a phone.


      Internal providers are paid with lemlist credits and always available.
      External providers run on your own account: connect one by saving its API
      key, and it becomes available to your waterfalls. `GET
      /enrichments/providers` is the catalog of provider ids accepted by the
      waterfall endpoints.
  - name: Enrichment Waterfalls
    description: >-
      Control which data providers lemlist calls when enriching a contact, and
      in which order.


      A waterfall is an ordered list of providers for one enrichment `type`
      (`email` or `phone`). Providers are tried one after the other until one
      returns a result.


      Every team has exactly one default waterfall per type (`isDefault: true`).
      While its `editor` is `lemlist` it follows the lemlist behaviour:
      providers you connected with your own API key are tried first, then
      internal providers in a random order. Once a team member edits its
      provider list, `editor` becomes that user's id and the list is followed as
      is; resetting it hands it back to `lemlist`.


      Custom waterfalls (`isDefault: false`) carry `conditions` on the contact
      being enriched, keyed by contact property; every key present must match.
      When a contact is enriched, lemlist runs a single waterfall: the custom
      waterfall of the requested type whose conditions match the contact, or the
      default waterfall when none does. If several match, the one with the most
      condition keys wins, then the most recently updated. Only that waterfall
      runs; when it finds nothing, the enrichment ends without falling back to
      another one.
paths:
  /companies/lists/{listId}/entities:
    parameters:
      - name: listId
        in: path
        required: true
        description: >-
          The unique identifier of the company list (`clt_xxx` format). Must be
          a **static** company list.
        example: clt_xxxxxxxxxxxxxxxxx
        schema:
          type: string
          pattern: ^clt_[a-zA-Z0-9]+$
    post:
      tags:
        - Companies
      summary: Add or Remove Companies in a List
      description: >-
        Adds existing CRM companies to a static company list, or removes them
        when `?action=remove` is set.


        - **Add** (default): send a `POST` with a `companyIds` body. Companies
        already in the list are silently skipped (no duplicates) and reported in
        `alreadyInList`.

        - **Remove**: send a `POST` with `?action=remove` and a `companyIds`
        body. Companies that are not in the list are silently skipped;
        `removedCount` reflects the associations actually removed. This only
        affects list membership, the companies are not deleted from your CRM.


        The list must be a **static** company list (`clt_xxx`). Dynamic lists
        (auto-populated by filter rules) and contact lists are rejected.


        **Removal uses `POST ?action=remove` on purpose:** a `DELETE` request
        body is dropped by our stack, so `DELETE` on this path is **not
        supported** and returns `405 Method Not Allowed`.
      parameters:
        - name: action
          in: query
          required: false
          description: >-
            Omit to **add** the companies to the list. Set to `remove` to
            **remove** them from the list.
          example: remove
          schema:
            type: string
            enum:
              - remove
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - companyIds
              properties:
                companyIds:
                  type: array
                  items:
                    type: string
                    pattern: ^cpn_[a-zA-Z0-9]+$
                  minItems: 1
                  maxItems: 1000
                  description: >-
                    Array of company IDs (`cpn_xxx` format) to add to or remove
                    from the list. Required, non-empty, maximum 1,000 per
                    request.
            example:
              companyIds:
                - cpn_xxxxxxxxxxxxxxxxx
                - cpn_yyyyyyyyyyyyyyyyy
      responses:
        '200':
          description: >-
            Companies added to or removed from the list successfully. The
            response body depends on `action`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  addedCount:
                    type: integer
                    description: Number of companies added to the list (add only).
                  alreadyInList:
                    type: integer
                    description: >-
                      Number of companies that were already in the list and
                      therefore skipped (add only).
                  removedCount:
                    type: integer
                    description: >-
                      Number of list associations actually removed (remove
                      only). Companies that were not in the list are not
                      counted.
              examples:
                add:
                  summary: Add companies (no action)
                  value:
                    message: Companies added to list successfully
                    addedCount: 2
                    alreadyInList: 0
                remove:
                  summary: Remove companies (action=remove)
                  value:
                    message: Companies removed from list successfully
                    removedCount: 2
        '400':
          description: >-
            Possible errors: Bad team / Invalid listId format (expected clt_xxx)
            / companyIds is required and must be a non-empty array / Maximum
            1,000 companies per request / All companyIds must be in cpn_xxx
            format / List is not a company list / Cannot manually add companies
            to a dynamic list / Cannot manually remove companies from a dynamic
            list.
          content:
            text/plain:
              example: companyIds is required and must be a non-empty array
        '401':
          description: The authentication you supplied is incorrect
          content:
            text/plain:
              example: The authentication you supplied is incorrect
        '404':
          description: Company list not found
          content:
            text/plain:
              example: Company list not found
        '405':
          description: >-
            Method not allowed. `DELETE` on this path is not supported because
            the request body is dropped by our stack. Use `POST ?action=remove`
            to remove companies.
          content:
            text/plain:
              example: Method not allowed
        '500':
          description: Internal error while updating the list
          content:
            text/plain:
              example: Failed to add companies to list
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````