Create Saved Search
curl --request POST \
--url https://api.lemlist.com/api/database/saved-searches \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Paris SaaS founders",
"mode": "leads",
"filters": [
{
"filterId": "currentTitle",
"in": [
"Founder"
],
"out": []
},
{
"filterId": "country",
"in": [
"France"
],
"out": []
}
]
}
'import requests
url = "https://api.lemlist.com/api/database/saved-searches"
payload = {
"name": "Paris SaaS founders",
"mode": "leads",
"filters": [
{
"filterId": "currentTitle",
"in": ["Founder"],
"out": []
},
{
"filterId": "country",
"in": ["France"],
"out": []
}
]
}
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({
name: 'Paris SaaS founders',
mode: 'leads',
filters: [
{filterId: 'currentTitle', in: ['Founder'], out: []},
{filterId: 'country', in: ['France'], out: []}
]
})
};
fetch('https://api.lemlist.com/api/database/saved-searches', 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/database/saved-searches")
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 \"name\": \"Paris SaaS founders\",\n \"mode\": \"leads\",\n \"filters\": [\n {\n \"filterId\": \"currentTitle\",\n \"in\": [\n \"Founder\"\n ],\n \"out\": []\n },\n {\n \"filterId\": \"country\",\n \"in\": [\n \"France\"\n ],\n \"out\": []\n }\n ]\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/database/saved-searches",
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([
'name' => 'Paris SaaS founders',
'mode' => 'leads',
'filters' => [
[
'filterId' => 'currentTitle',
'in' => [
'Founder'
],
'out' => [
]
],
[
'filterId' => 'country',
'in' => [
'France'
],
'out' => [
]
]
]
]),
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;
}{
"data": {
"_id": "lss_ExAmPlE4f7Kq2Wz9x"
}
}
People database
Create Saved Search
Creates a People Database saved search for your team.
POST
/
database
/
saved-searches
Create Saved Search
curl --request POST \
--url https://api.lemlist.com/api/database/saved-searches \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Paris SaaS founders",
"mode": "leads",
"filters": [
{
"filterId": "currentTitle",
"in": [
"Founder"
],
"out": []
},
{
"filterId": "country",
"in": [
"France"
],
"out": []
}
]
}
'import requests
url = "https://api.lemlist.com/api/database/saved-searches"
payload = {
"name": "Paris SaaS founders",
"mode": "leads",
"filters": [
{
"filterId": "currentTitle",
"in": ["Founder"],
"out": []
},
{
"filterId": "country",
"in": ["France"],
"out": []
}
]
}
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({
name: 'Paris SaaS founders',
mode: 'leads',
filters: [
{filterId: 'currentTitle', in: ['Founder'], out: []},
{filterId: 'country', in: ['France'], out: []}
]
})
};
fetch('https://api.lemlist.com/api/database/saved-searches', 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/database/saved-searches")
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 \"name\": \"Paris SaaS founders\",\n \"mode\": \"leads\",\n \"filters\": [\n {\n \"filterId\": \"currentTitle\",\n \"in\": [\n \"Founder\"\n ],\n \"out\": []\n },\n {\n \"filterId\": \"country\",\n \"in\": [\n \"France\"\n ],\n \"out\": []\n }\n ]\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lemlist.com/api/database/saved-searches",
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([
'name' => 'Paris SaaS founders',
'mode' => 'leads',
'filters' => [
[
'filterId' => 'currentTitle',
'in' => [
'Founder'
],
'out' => [
]
],
[
'filterId' => 'country',
'in' => [
'France'
],
'out' => [
]
]
]
]),
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;
}{
"data": {
"_id": "lss_ExAmPlE4f7Kq2Wz9x"
}
}
name, filters and mode are all required. The name must be unique within your team — a duplicate answers 409.Pick your filters from Get Database Filters called with usage=ui: filters that are not usable in the People Database UI answer 400 with the code FILTER_UNAVAILABLE_FOR_USAGE. Filters incompatible with the mode or with your team’s plan are dropped silently.The response contains only the created id. The stored
name and filters are sanitized and plan-gated server-side — call Get saved search to read the stored saved search.Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
application/json
Display name, 1 to 200 characters after trimming. Unique within your team.
Required string length:
1 - 200Example:
"Paris SaaS founders"
People Database filters of the saved search. 1 to 10 filters of shape { filterId, in?, out?, exactMatch? } (no other key: an unknown key such as type answers API_INVALID_FILTERS), at most 1000 values per in / out and 1000 characters per value.
Required array length:
1 - 10 elementsShow child attributes
Show child attributes
Search mode the filters target
Available options:
leads, companies Example:
"leads"
Response
Saved search created
Show child attributes
Show child attributes
Was this page helpful?