Create Companies in the CRM
curl --request POST \
--url https://api.lemlist.com/api/companies/crm/create \
--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/create"
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/create', 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/create")
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/create",
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,
"toCreate": 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": "CREATE_IN_CRM_NOT_ALLOWED",
"message": "Only a team admin can create records in the CRM"
}
}{
"success": false,
"error": {
"code": "LIST_NOT_FOUND",
"message": "List not found"
}
}Companies
Create Companies in the CRM
Pushes companies to your connected CRM, linking each one to the CRM record found and creating it there when none matches.
POST
/
companies
/
crm
/
create
Create Companies in the CRM
curl --request POST \
--url https://api.lemlist.com/api/companies/crm/create \
--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/create"
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/create', 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/create")
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/create",
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,
"toCreate": 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": "CREATE_IN_CRM_NOT_ALLOWED",
"message": "Only a team admin can create records in the CRM"
}
}{
"success": false,
"error": {
"code": "LIST_NOT_FOUND",
"message": "List not found"
}
}Pushes companies to your connected CRM — the Create in CRM action of the Companies page. Each company is searched in the CRM first: linked to the record found, created in the CRM otherwise.
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 or created), orerror(refused by the CRM, with its reason). 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.toCreate: searched in the CRM first, then linked or created.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.
Who can call it
The API key must belong to a team admin, like the action in the app. On Salesforce, the connection must grant the object created (Account).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?