Search & Connect Contacts in the CRM
curl --request POST \
--url https://api.lemlist.com/api/contacts/crm/search-and-connect \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"idsOrEmails": [
"ctc_xW8Ou6C03Csv8vatp",
"john.doe@acme.com"
],
"listId": "clt_Ab12Cd34Ef56Gh78I"
}
'import requests
url = "https://api.lemlist.com/api/contacts/crm/search-and-connect"
payload = {
"idsOrEmails": ["ctc_xW8Ou6C03Csv8vatp", "john.doe@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({
idsOrEmails: ['ctc_xW8Ou6C03Csv8vatp', 'john.doe@acme.com'],
listId: 'clt_Ab12Cd34Ef56Gh78I'
})
};
fetch('https://api.lemlist.com/api/contacts/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/contacts/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 \"idsOrEmails\": [\n \"ctc_xW8Ou6C03Csv8vatp\",\n \"john.doe@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/contacts/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([
'idsOrEmails' => [
'ctc_xW8Ou6C03Csv8vatp',
'john.doe@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": [
"jane.doe@acme.com"
]
}
}{
"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"
}
}Contacts
Search & Connect Contacts in the CRM
Searches your connected CRM for contacts and links each one to the CRM record found, without creating any CRM record.
POST
/
contacts
/
crm
/
search-and-connect
Search & Connect Contacts in the CRM
curl --request POST \
--url https://api.lemlist.com/api/contacts/crm/search-and-connect \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"idsOrEmails": [
"ctc_xW8Ou6C03Csv8vatp",
"john.doe@acme.com"
],
"listId": "clt_Ab12Cd34Ef56Gh78I"
}
'import requests
url = "https://api.lemlist.com/api/contacts/crm/search-and-connect"
payload = {
"idsOrEmails": ["ctc_xW8Ou6C03Csv8vatp", "john.doe@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({
idsOrEmails: ['ctc_xW8Ou6C03Csv8vatp', 'john.doe@acme.com'],
listId: 'clt_Ab12Cd34Ef56Gh78I'
})
};
fetch('https://api.lemlist.com/api/contacts/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/contacts/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 \"idsOrEmails\": [\n \"ctc_xW8Ou6C03Csv8vatp\",\n \"john.doe@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/contacts/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([
'idsOrEmails' => [
'ctc_xW8Ou6C03Csv8vatp',
'john.doe@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": [
"jane.doe@acme.com"
]
}
}{
"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 contact and links it to the CRM record found — the Search & connect action of the Contacts page. No CRM record is ever created: use
POST /contacts/crm/create for that. Each contact it links then syncs its mapped fields with that CRM record, which can update it.
Target the contacts with idsOrEmails (lemlist ids or email addresses) or with listId for a whole contact list, static or dynamic: 10,000 contacts at most either way.
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 contact’s outcome lands on itscrmSync block shortly after:
GET /contacts?idsOrEmails=...returns each contact with itscrmSyncblock (searching,crmRecordId,notFoundAt,errors), 100 contacts per call.GET /contacts?listId=...&crmSyncStatus=lists the contacts of a list by state:searchingwhile the search runs, thensynced(linked), ornot_found(no CRM record matched). WithoutlistId, the filter reads every contact 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 email address or LinkedIn URL), left untouched.alreadyInProgress: a CRM search was already queued for them, not queued twice.notFound: the references sent that match no contact 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 contact ids (ctc_xxx) or email addresses, 10,000 at most. Send either idsOrEmails or listId.
Required array length:
1 - 10000 elementsExample:
[ "ctc_xW8Ou6C03Csv8vatp", "john.doe@acme.com" ]
A contact list id (clt_xxx): acts on every contact of the list, static or dynamic, 10,000 at most. Use it instead of idsOrEmails.
Example:
"clt_Ab12Cd34Ef56Gh78I"
Was this page helpful?