curl --request POST \
--url https://api.closebot.com/lead/search \
--header 'Content-Type: application/json' \
--header 'X-CB-KEY: <api-key>' \
--data '
{
"sourceIds": [
"<string>"
],
"channels": [
"<string>"
],
"botIds": [
"<string>"
],
"personaIds": [
"<string>"
],
"totalOnly": true,
"sourceOnlyFast": true,
"offset": 123,
"count": 123,
"search": "<string>",
"topicIds": [
"<string>"
],
"minimumResponses": 123,
"lastMessageDirection": "<string>",
"followUpScheduled": true,
"starredOnly": true,
"mentionedOnly": true
}
'import requests
url = "https://api.closebot.com/lead/search"
payload = {
"sourceIds": ["<string>"],
"channels": ["<string>"],
"botIds": ["<string>"],
"personaIds": ["<string>"],
"totalOnly": True,
"sourceOnlyFast": True,
"offset": 123,
"count": 123,
"search": "<string>",
"topicIds": ["<string>"],
"minimumResponses": 123,
"lastMessageDirection": "<string>",
"followUpScheduled": True,
"starredOnly": True,
"mentionedOnly": True
}
headers = {
"X-CB-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-CB-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sourceIds: ['<string>'],
channels: ['<string>'],
botIds: ['<string>'],
personaIds: ['<string>'],
totalOnly: true,
sourceOnlyFast: true,
offset: 123,
count: 123,
search: '<string>',
topicIds: ['<string>'],
minimumResponses: 123,
lastMessageDirection: '<string>',
followUpScheduled: true,
starredOnly: true,
mentionedOnly: true
})
};
fetch('https://api.closebot.com/lead/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.closebot.com/lead/search",
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([
'sourceIds' => [
'<string>'
],
'channels' => [
'<string>'
],
'botIds' => [
'<string>'
],
'personaIds' => [
'<string>'
],
'totalOnly' => true,
'sourceOnlyFast' => true,
'offset' => 123,
'count' => 123,
'search' => '<string>',
'topicIds' => [
'<string>'
],
'minimumResponses' => 123,
'lastMessageDirection' => '<string>',
'followUpScheduled' => true,
'starredOnly' => true,
'mentionedOnly' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-CB-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.closebot.com/lead/search"
payload := strings.NewReader("{\n \"sourceIds\": [\n \"<string>\"\n ],\n \"channels\": [\n \"<string>\"\n ],\n \"botIds\": [\n \"<string>\"\n ],\n \"personaIds\": [\n \"<string>\"\n ],\n \"totalOnly\": true,\n \"sourceOnlyFast\": true,\n \"offset\": 123,\n \"count\": 123,\n \"search\": \"<string>\",\n \"topicIds\": [\n \"<string>\"\n ],\n \"minimumResponses\": 123,\n \"lastMessageDirection\": \"<string>\",\n \"followUpScheduled\": true,\n \"starredOnly\": true,\n \"mentionedOnly\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-CB-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.closebot.com/lead/search")
.header("X-CB-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sourceIds\": [\n \"<string>\"\n ],\n \"channels\": [\n \"<string>\"\n ],\n \"botIds\": [\n \"<string>\"\n ],\n \"personaIds\": [\n \"<string>\"\n ],\n \"totalOnly\": true,\n \"sourceOnlyFast\": true,\n \"offset\": 123,\n \"count\": 123,\n \"search\": \"<string>\",\n \"topicIds\": [\n \"<string>\"\n ],\n \"minimumResponses\": 123,\n \"lastMessageDirection\": \"<string>\",\n \"followUpScheduled\": true,\n \"starredOnly\": true,\n \"mentionedOnly\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.closebot.com/lead/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-CB-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sourceIds\": [\n \"<string>\"\n ],\n \"channels\": [\n \"<string>\"\n ],\n \"botIds\": [\n \"<string>\"\n ],\n \"personaIds\": [\n \"<string>\"\n ],\n \"totalOnly\": true,\n \"sourceOnlyFast\": true,\n \"offset\": 123,\n \"count\": 123,\n \"search\": \"<string>\",\n \"topicIds\": [\n \"<string>\"\n ],\n \"minimumResponses\": 123,\n \"lastMessageDirection\": \"<string>\",\n \"followUpScheduled\": true,\n \"starredOnly\": true,\n \"mentionedOnly\": true\n}"
response = http.request(request)
puts response.read_body{
"leads": [
{
"id": "<string>",
"name": "<string>",
"contactId": "<string>",
"lastMessageTime": "2023-11-07T05:31:56Z",
"lastMessage": "<string>",
"lastMessageDirection": "<string>",
"lastMessageBotId": "<string>",
"lastMessageChannel": "<string>",
"mostRecentFailureReason": "<string>",
"mimicSourceId": "<string>",
"starred": true,
"unread": true,
"score": 123,
"source": {
"name": "<string>",
"id": "<string>"
},
"wontRespondUntil": "2023-11-07T05:31:56Z",
"tags": [
"<string>"
],
"fields": [
{
"field": "<string>",
"name": "<string>",
"value": "<string>",
"aiProduced": true
}
],
"instances": [
{
"botId": "<string>",
"botVersion": "<string>",
"followUpTimezoneKind": "<string>",
"followUpTimezone": "<string>",
"followUpTime": "2023-11-07T05:31:56Z",
"isSmartFollowUpTime": true,
"scheduleRespondTime": "2023-11-07T05:31:56Z"
}
],
"lastMessageIsNote": true,
"mentionedMe": true
}
],
"total": 123,
"starredTotal": 123,
"mentionsTotal": 123
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}Search leads
curl --request POST \
--url https://api.closebot.com/lead/search \
--header 'Content-Type: application/json' \
--header 'X-CB-KEY: <api-key>' \
--data '
{
"sourceIds": [
"<string>"
],
"channels": [
"<string>"
],
"botIds": [
"<string>"
],
"personaIds": [
"<string>"
],
"totalOnly": true,
"sourceOnlyFast": true,
"offset": 123,
"count": 123,
"search": "<string>",
"topicIds": [
"<string>"
],
"minimumResponses": 123,
"lastMessageDirection": "<string>",
"followUpScheduled": true,
"starredOnly": true,
"mentionedOnly": true
}
'import requests
url = "https://api.closebot.com/lead/search"
payload = {
"sourceIds": ["<string>"],
"channels": ["<string>"],
"botIds": ["<string>"],
"personaIds": ["<string>"],
"totalOnly": True,
"sourceOnlyFast": True,
"offset": 123,
"count": 123,
"search": "<string>",
"topicIds": ["<string>"],
"minimumResponses": 123,
"lastMessageDirection": "<string>",
"followUpScheduled": True,
"starredOnly": True,
"mentionedOnly": True
}
headers = {
"X-CB-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-CB-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sourceIds: ['<string>'],
channels: ['<string>'],
botIds: ['<string>'],
personaIds: ['<string>'],
totalOnly: true,
sourceOnlyFast: true,
offset: 123,
count: 123,
search: '<string>',
topicIds: ['<string>'],
minimumResponses: 123,
lastMessageDirection: '<string>',
followUpScheduled: true,
starredOnly: true,
mentionedOnly: true
})
};
fetch('https://api.closebot.com/lead/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.closebot.com/lead/search",
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([
'sourceIds' => [
'<string>'
],
'channels' => [
'<string>'
],
'botIds' => [
'<string>'
],
'personaIds' => [
'<string>'
],
'totalOnly' => true,
'sourceOnlyFast' => true,
'offset' => 123,
'count' => 123,
'search' => '<string>',
'topicIds' => [
'<string>'
],
'minimumResponses' => 123,
'lastMessageDirection' => '<string>',
'followUpScheduled' => true,
'starredOnly' => true,
'mentionedOnly' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-CB-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.closebot.com/lead/search"
payload := strings.NewReader("{\n \"sourceIds\": [\n \"<string>\"\n ],\n \"channels\": [\n \"<string>\"\n ],\n \"botIds\": [\n \"<string>\"\n ],\n \"personaIds\": [\n \"<string>\"\n ],\n \"totalOnly\": true,\n \"sourceOnlyFast\": true,\n \"offset\": 123,\n \"count\": 123,\n \"search\": \"<string>\",\n \"topicIds\": [\n \"<string>\"\n ],\n \"minimumResponses\": 123,\n \"lastMessageDirection\": \"<string>\",\n \"followUpScheduled\": true,\n \"starredOnly\": true,\n \"mentionedOnly\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-CB-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.closebot.com/lead/search")
.header("X-CB-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sourceIds\": [\n \"<string>\"\n ],\n \"channels\": [\n \"<string>\"\n ],\n \"botIds\": [\n \"<string>\"\n ],\n \"personaIds\": [\n \"<string>\"\n ],\n \"totalOnly\": true,\n \"sourceOnlyFast\": true,\n \"offset\": 123,\n \"count\": 123,\n \"search\": \"<string>\",\n \"topicIds\": [\n \"<string>\"\n ],\n \"minimumResponses\": 123,\n \"lastMessageDirection\": \"<string>\",\n \"followUpScheduled\": true,\n \"starredOnly\": true,\n \"mentionedOnly\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.closebot.com/lead/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-CB-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sourceIds\": [\n \"<string>\"\n ],\n \"channels\": [\n \"<string>\"\n ],\n \"botIds\": [\n \"<string>\"\n ],\n \"personaIds\": [\n \"<string>\"\n ],\n \"totalOnly\": true,\n \"sourceOnlyFast\": true,\n \"offset\": 123,\n \"count\": 123,\n \"search\": \"<string>\",\n \"topicIds\": [\n \"<string>\"\n ],\n \"minimumResponses\": 123,\n \"lastMessageDirection\": \"<string>\",\n \"followUpScheduled\": true,\n \"starredOnly\": true,\n \"mentionedOnly\": true\n}"
response = http.request(request)
puts response.read_body{
"leads": [
{
"id": "<string>",
"name": "<string>",
"contactId": "<string>",
"lastMessageTime": "2023-11-07T05:31:56Z",
"lastMessage": "<string>",
"lastMessageDirection": "<string>",
"lastMessageBotId": "<string>",
"lastMessageChannel": "<string>",
"mostRecentFailureReason": "<string>",
"mimicSourceId": "<string>",
"starred": true,
"unread": true,
"score": 123,
"source": {
"name": "<string>",
"id": "<string>"
},
"wontRespondUntil": "2023-11-07T05:31:56Z",
"tags": [
"<string>"
],
"fields": [
{
"field": "<string>",
"name": "<string>",
"value": "<string>",
"aiProduced": true
}
],
"instances": [
{
"botId": "<string>",
"botVersion": "<string>",
"followUpTimezoneKind": "<string>",
"followUpTimezone": "<string>",
"followUpTime": "2023-11-07T05:31:56Z",
"isSmartFollowUpTime": true,
"scheduleRespondTime": "2023-11-07T05:31:56Z"
}
],
"lastMessageIsNote": true,
"mentionedMe": true
}
],
"total": 123,
"starredTotal": 123,
"mentionsTotal": 123
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}Authorizations
CloseBot API Key Authorization
Body
The search query input.
The source IDs.
The channel IDs.
The bot IDs.
The persona IDs.
The offset of the search results.
The count of the search results.
The search query.
Conversation topic IDs. A lead matches if it carries any of them.
Optional rather than required, unlike the lists above: every existing caller predates topics, and making it required would break all of them.
The minimum number of responses.
The last message direction.
Whether the follow up is scheduled.
Restrict results to starred leads (the sidebar Priority tab).
Restrict results to leads with a note that @-mentions the caller (the sidebar Mentions tab).
Response
OK
Show child attributes
Show child attributes
Count of starred leads across the whole (unpaginated) baseline scope (before StarredOnly/MentionedOnly narrowing). Only populated on the source-only fast path — the sidebar Priority count reads it.
Count of leads with a note @-mentioning the caller across the baseline scope. Only populated on the source-only fast path — the sidebar Mentions count reads it.

