Add a Sourced Contact
curl --request POST \
--url https://api.lemlist.com/api/contact-sourcing/contacts \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"leadId": "123456789",
"companyId": "cpn_K4tRm2Qw9Yb7Xz1Ns"
}
'import requests
url = "https://api.lemlist.com/api/contact-sourcing/contacts"
payload = {
"leadId": "123456789",
"companyId": "cpn_K4tRm2Qw9Yb7Xz1Ns"
}
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({leadId: '123456789', companyId: 'cpn_K4tRm2Qw9Yb7Xz1Ns'})
};
fetch('https://api.lemlist.com/api/contact-sourcing/contacts', 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/contact-sourcing/contacts")
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 \"leadId\": \"123456789\",\n \"companyId\": \"cpn_K4tRm2Qw9Yb7Xz1Ns\"\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/contact-sourcing/contacts",
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([
'leadId' => '123456789',
'companyId' => 'cpn_K4tRm2Qw9Yb7Xz1Ns'
]),
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;
}{
"error": "ABS_CONTACT_SOURCING_CONTACT_CREATE_NOT_ALLOWED",
"message": "You do not have the permission to create contacts"
}Contact sourcing
Add a Sourced Contact
Turns one contact-sourcing recommendation into a lemlist contact.
POST
/
contact-sourcing
/
contacts
Add a Sourced Contact
curl --request POST \
--url https://api.lemlist.com/api/contact-sourcing/contacts \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"leadId": "123456789",
"companyId": "cpn_K4tRm2Qw9Yb7Xz1Ns"
}
'import requests
url = "https://api.lemlist.com/api/contact-sourcing/contacts"
payload = {
"leadId": "123456789",
"companyId": "cpn_K4tRm2Qw9Yb7Xz1Ns"
}
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({leadId: '123456789', companyId: 'cpn_K4tRm2Qw9Yb7Xz1Ns'})
};
fetch('https://api.lemlist.com/api/contact-sourcing/contacts', 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/contact-sourcing/contacts")
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 \"leadId\": \"123456789\",\n \"companyId\": \"cpn_K4tRm2Qw9Yb7Xz1Ns\"\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/contact-sourcing/contacts",
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([
'leadId' => '123456789',
'companyId' => 'cpn_K4tRm2Qw9Yb7Xz1Ns'
]),
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;
}{
"error": "ABS_CONTACT_SOURCING_CONTACT_CREATE_NOT_ALLOWED",
"message": "You do not have the permission to create contacts"
}Takes a Why
The new contact is filed under the account you pass, whatever the People
Database resolves from the person’s own profile — that is what keeps a
recommendation on the account it was made for.
Someone your workspace already has as a contact is the one case this does not
apply to: they stay on the account they are already filed under. An Add never
moves a contact from one account to another, so rather than report a creation
that did not happen, the call answers
leadId from a run’s contacts array and creates the matching contact
in your workspace.
Filing and enriching
listIdfiles the new contact into a contact list. Without it the contact lands in All contacts.findEmail: truealso runs email enrichment on the new contact. It spends enrichment credits, so it is off by default.
Why companyId is required
The new contact is filed under the account you pass, whatever the People
Database resolves from the person’s own profile — that is what keeps a
recommendation on the account it was made for.
Someone your workspace already has as a contact is the one case this does not
apply to: they stay on the account they are already filed under. An Add never
moves a contact from one account to another, so rather than report a creation
that did not happen, the call answers 409.
| Code | Meaning |
|---|---|
201 | Contact created. |
403 | The API key’s user does not have the “Create contacts” permission (ABS_CONTACT_SOURCING_CONTACT_CREATE_NOT_ALLOWED). Nothing is written. |
404 | The person is already one of your contacts, or no longer in the People Database. Re-run the sourcing to refresh the recommendations. |
409 | The person is already one of your contacts, filed under another account. They were left there. |
Authorizations
Body
application/json
Response
Contact created.
Was this page helpful?