Add or Remove Companies in a List
curl --request POST \
--url https://api.lemlist.com/api/companies/lists/{listId}/entities \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"companyIds": [
"cpn_xxxxxxxxxxxxxxxxx",
"cpn_yyyyyyyyyyyyyyyyy"
]
}
'import requests
url = "https://api.lemlist.com/api/companies/lists/{listId}/entities"
payload = { "companyIds": ["cpn_xxxxxxxxxxxxxxxxx", "cpn_yyyyyyyyyyyyyyyyy"] }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({companyIds: ['cpn_xxxxxxxxxxxxxxxxx', 'cpn_yyyyyyyyyyyyyyyyy']})
};
fetch('https://api.lemlist.com/api/companies/lists/{listId}/entities', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api.lemlist.com/api/companies/lists/{listId}/entities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"companyIds\": [\n \"cpn_xxxxxxxxxxxxxxxxx\",\n \"cpn_yyyyyyyyyyyyyyyyy\"\n ]\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/companies/lists/{listId}/entities",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'companyIds' => [
'cpn_xxxxxxxxxxxxxxxxx',
'cpn_yyyyyyyyyyyyyyyyy'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"message": "Companies added to list successfully",
"addedCount": 2,
"alreadyInList": 0
}
Companies
Add or Remove Companies in a List
Add companies to a static company list, or remove them with ?action=remove.
POST
/
companies
/
lists
/
{listId}
/
entities
Add or Remove Companies in a List
curl --request POST \
--url https://api.lemlist.com/api/companies/lists/{listId}/entities \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"companyIds": [
"cpn_xxxxxxxxxxxxxxxxx",
"cpn_yyyyyyyyyyyyyyyyy"
]
}
'import requests
url = "https://api.lemlist.com/api/companies/lists/{listId}/entities"
payload = { "companyIds": ["cpn_xxxxxxxxxxxxxxxxx", "cpn_yyyyyyyyyyyyyyyyy"] }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({companyIds: ['cpn_xxxxxxxxxxxxxxxxx', 'cpn_yyyyyyyyyyyyyyyyy']})
};
fetch('https://api.lemlist.com/api/companies/lists/{listId}/entities', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api.lemlist.com/api/companies/lists/{listId}/entities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"companyIds\": [\n \"cpn_xxxxxxxxxxxxxxxxx\",\n \"cpn_yyyyyyyyyyyyyyyyy\"\n ]\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/companies/lists/{listId}/entities",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'companyIds' => [
'cpn_xxxxxxxxxxxxxxxxx',
'cpn_yyyyyyyyyyyyyyyyy'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"message": "Companies added to list successfully",
"addedCount": 2,
"alreadyInList": 0
}
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.
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.Removing a company from a list only affects list membership — it does not delete the company from your CRM.
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
- Find or create a list — use
GET /companies/liststo find an existing static list, orPOST /companies/liststo create one (clt_xxx). - Find companies — use
GET /companieswithsearchorlistIdto get company IDs (cpn_xxx). - Add or remove — call this endpoint with the company IDs and list ID. Up to 1,000 companies per request.
Authorizations
Path Parameters
Query Parameters
Body
application/json
Response
Companies added to or removed from the list successfully. The response body depends on action.
Was this page helpful?