Create Contacts in the CRM
curl --request POST \
--url https://api.lemlist.com/api/contacts/crm/create \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"idsOrEmails": [
"ctc_xW8Ou6C03Csv8vatp",
"john.doe@acme.com"
],
"listId": "clt_Ab12Cd34Ef56Gh78I",
"asLead": false
}
'import requests
url = "https://api.lemlist.com/api/contacts/crm/create"
payload = {
"idsOrEmails": ["ctc_xW8Ou6C03Csv8vatp", "john.doe@acme.com"],
"listId": "clt_Ab12Cd34Ef56Gh78I",
"asLead": False
}
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',
asLead: false
})
};
fetch('https://api.lemlist.com/api/contacts/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/contacts/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 \"idsOrEmails\": [\n \"ctc_xW8Ou6C03Csv8vatp\",\n \"john.doe@acme.com\"\n ],\n \"listId\": \"clt_Ab12Cd34Ef56Gh78I\",\n \"asLead\": false\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/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([
'idsOrEmails' => [
'ctc_xW8Ou6C03Csv8vatp',
'john.doe@acme.com'
],
'listId' => 'clt_Ab12Cd34Ef56Gh78I',
'asLead' => false
]),
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": [
"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": "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"
}
}Contacts
Create Contacts in the CRM
Pushes contacts to your connected CRM, linking each one to the CRM record found and creating it there when none matches.
POST
/
contacts
/
crm
/
create
Create Contacts in the CRM
curl --request POST \
--url https://api.lemlist.com/api/contacts/crm/create \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"idsOrEmails": [
"ctc_xW8Ou6C03Csv8vatp",
"john.doe@acme.com"
],
"listId": "clt_Ab12Cd34Ef56Gh78I",
"asLead": false
}
'import requests
url = "https://api.lemlist.com/api/contacts/crm/create"
payload = {
"idsOrEmails": ["ctc_xW8Ou6C03Csv8vatp", "john.doe@acme.com"],
"listId": "clt_Ab12Cd34Ef56Gh78I",
"asLead": False
}
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',
asLead: false
})
};
fetch('https://api.lemlist.com/api/contacts/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/contacts/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 \"idsOrEmails\": [\n \"ctc_xW8Ou6C03Csv8vatp\",\n \"john.doe@acme.com\"\n ],\n \"listId\": \"clt_Ab12Cd34Ef56Gh78I\",\n \"asLead\": false\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/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([
'idsOrEmails' => [
'ctc_xW8Ou6C03Csv8vatp',
'john.doe@acme.com'
],
'listId' => 'clt_Ab12Cd34Ef56Gh78I',
'asLead' => false
]),
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": [
"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": "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 contacts to your connected CRM — the Create in CRM action of the Contacts page. Each contact is searched in the CRM first: linked to the record found, created in the CRM otherwise. On Salesforce,
asLead: true creates the missing contacts as Leads instead of Contacts.
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 or created), orerror(refused by the CRM, with its reason). 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.toCreate: searched in the CRM first, then linked or created.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.
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 (Contact, or Lead withasLead).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"
Salesforce only: create the contacts missing from the CRM as Leads instead of Contacts.
Example:
false
Was this page helpful?