Search & Connect Companies in the CRM
curl --request POST \
--url https://api.lemlist.com/api/companies/crm/search-and-connect \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"idsOrDomains": [
"cpn_xW8Ou6C03Csv8vatp",
"acme.com"
],
"listId": "clt_Ab12Cd34Ef56Gh78I"
}
'import requests
url = "https://api.lemlist.com/api/companies/crm/search-and-connect"
payload = {
"idsOrDomains": ["cpn_xW8Ou6C03Csv8vatp", "acme.com"],
"listId": "clt_Ab12Cd34Ef56Gh78I"
}
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({
idsOrDomains: ['cpn_xW8Ou6C03Csv8vatp', 'acme.com'],
listId: 'clt_Ab12Cd34Ef56Gh78I'
})
};
fetch('https://api.lemlist.com/api/companies/crm/search-and-connect', 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/crm/search-and-connect")
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 \"idsOrDomains\": [\n \"cpn_xW8Ou6C03Csv8vatp\",\n \"acme.com\"\n ],\n \"listId\": \"clt_Ab12Cd34Ef56Gh78I\"\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/crm/search-and-connect",
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([
'idsOrDomains' => [
'cpn_xW8Ou6C03Csv8vatp',
'acme.com'
],
'listId' => 'clt_Ab12Cd34Ef56Gh78I'
]),
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;
}{
"success": true,
"data": {
"alreadyLinked": 2,
"toSearch": 6,
"notSearchable": 1,
"alreadyInProgress": 0,
"notFound": [
"unknown-domain.io"
]
}
}{
"success": false,
"error": {
"code": "NO_CRM_CONNECTED",
"message": "No CRM connected for this team"
}
}The authentication you supplied is incorrect{
"success": false,
"error": {
"code": "LIST_NOT_FOUND",
"message": "List not found"
}
}Companies
Search & Connect Companies in the CRM
Searches your connected CRM for companies and links each one to the CRM record found, without creating any CRM record.
POST
/
companies
/
crm
/
search-and-connect
Search & Connect Companies in the CRM
curl --request POST \
--url https://api.lemlist.com/api/companies/crm/search-and-connect \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"idsOrDomains": [
"cpn_xW8Ou6C03Csv8vatp",
"acme.com"
],
"listId": "clt_Ab12Cd34Ef56Gh78I"
}
'import requests
url = "https://api.lemlist.com/api/companies/crm/search-and-connect"
payload = {
"idsOrDomains": ["cpn_xW8Ou6C03Csv8vatp", "acme.com"],
"listId": "clt_Ab12Cd34Ef56Gh78I"
}
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({
idsOrDomains: ['cpn_xW8Ou6C03Csv8vatp', 'acme.com'],
listId: 'clt_Ab12Cd34Ef56Gh78I'
})
};
fetch('https://api.lemlist.com/api/companies/crm/search-and-connect', 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/crm/search-and-connect")
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 \"idsOrDomains\": [\n \"cpn_xW8Ou6C03Csv8vatp\",\n \"acme.com\"\n ],\n \"listId\": \"clt_Ab12Cd34Ef56Gh78I\"\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/crm/search-and-connect",
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([
'idsOrDomains' => [
'cpn_xW8Ou6C03Csv8vatp',
'acme.com'
],
'listId' => 'clt_Ab12Cd34Ef56Gh78I'
]),
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;
}{
"success": true,
"data": {
"alreadyLinked": 2,
"toSearch": 6,
"notSearchable": 1,
"alreadyInProgress": 0,
"notFound": [
"unknown-domain.io"
]
}
}{
"success": false,
"error": {
"code": "NO_CRM_CONNECTED",
"message": "No CRM connected for this team"
}
}The authentication you supplied is incorrect{
"success": false,
"error": {
"code": "LIST_NOT_FOUND",
"message": "List not found"
}
}Searches your connected CRM for each company and links it to the CRM record found — the Search & connect action of the Companies page. No CRM record is ever created: use
POST /companies/crm/create for that. Each company it links then syncs its mapped fields with that CRM record, which can update it.
Target the companies with idsOrDomains (lemlist ids or domains) or with listId for a whole company list, static or dynamic: 10,000 companies at most either way, a domain counting every company that carries it.
Asynchronous: read the outcome later
The call queues the work and answers at once with what was queued, not with what the CRM returned. Each company’s outcome lands on itscrmSync block shortly after:
GET /companies?idsOrDomains=...returns each company with itscrmSyncblock (searching,crmRecordId,notFoundAt,errors), 100 companies per call.GET /companies?listId=...&crmSyncStatus=lists the companies of a list by state:searchingwhile the search runs, thensynced(linked), ornot_found(no CRM record matched). WithoutlistId, the filter reads every company of the team: do not poll it.
What the counts mean
alreadyLinked: already linked to a CRM record, synced with it again instead of searched.toSearch: searched in the CRM, then linked or flaggednot_found.notSearchable: nothing the CRM can be searched with (no domain or LinkedIn URL), left untouched.alreadyInProgress: a CRM search was already queued for them, not queued twice.notFound: the references sent that match no company of your team.
Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
application/json
lemlist company ids (cpn_xxx) or domains, 10,000 at most. A domain designates every company carrying it: 10,000 companies at most in total. Send either idsOrDomains or listId.
Required array length:
1 - 10000 elementsExample:
["cpn_xW8Ou6C03Csv8vatp", "acme.com"]
A company list id (clt_xxx): acts on every company of the list, static or dynamic, 10,000 at most. Use it instead of idsOrDomains.
Example:
"clt_Ab12Cd34Ef56Gh78I"
Was this page helpful?