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;
}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;
}Takes a Why
The People Database resolves a person’s company from their own profile. If the
person has changed jobs since the run, they belong to a different company than
the one you sourced — so lemlist checks, and 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 People Database resolves a person’s company from their own profile. If the
person has changed jobs since the run, they belong to a different company than
the one you sourced — so lemlist checks, and answers 409 rather than filing
them under the wrong account and reporting success.
| Code | Meaning |
|---|---|
201 | Contact created. |
404 | The person is no longer in the People Database. Re-run the sourcing to refresh the recommendations. |
409 | Their profile now lists a different employer, so they were not added to this account. |
Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
application/json
People-Database id, from a run's contacts[].leadId.
Example:
"123456789"
Example:
"cpn_K4tRm2Qw9Yb7Xz1Ns"
File the new contact into this contact list (clt_xxx). Omit to leave it in all contacts.
Example:
"clt_P3vDh8Lk5Tq2Wm6Rj"
Also run email enrichment on the new contact. Spends enrichment credits.
Response
Contact created.
Was this page helpful?