Search leads
curl --request POST \
--url https://api.closebot.com/lead/search \
--header 'Content-Type: application/json' \
--header 'X-CB-KEY: <api-key>' \
--data '
{
"totalOnly": true,
"sourceOnlyFast": true,
"offset": 123,
"count": 123,
"search": "<string>",
"sourceIds": [
"<string>"
],
"channels": [
"<string>"
],
"botIds": [
"<string>"
],
"personaIds": [
"<string>"
],
"minimumResponses": 123,
"lastMessageDirection": "<string>",
"followUpScheduled": true
}
'import requests
url = "https://api.closebot.com/lead/search"
payload = {
"totalOnly": True,
"sourceOnlyFast": True,
"offset": 123,
"count": 123,
"search": "<string>",
"sourceIds": ["<string>"],
"channels": ["<string>"],
"botIds": ["<string>"],
"personaIds": ["<string>"],
"minimumResponses": 123,
"lastMessageDirection": "<string>",
"followUpScheduled": 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({
totalOnly: true,
sourceOnlyFast: true,
offset: 123,
count: 123,
search: '<string>',
sourceIds: ['<string>'],
channels: ['<string>'],
botIds: ['<string>'],
personaIds: ['<string>'],
minimumResponses: 123,
lastMessageDirection: '<string>',
followUpScheduled: 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([
'totalOnly' => true,
'sourceOnlyFast' => true,
'offset' => 123,
'count' => 123,
'search' => '<string>',
'sourceIds' => [
'<string>'
],
'channels' => [
'<string>'
],
'botIds' => [
'<string>'
],
'personaIds' => [
'<string>'
],
'minimumResponses' => 123,
'lastMessageDirection' => '<string>',
'followUpScheduled' => 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 \"totalOnly\": true,\n \"sourceOnlyFast\": true,\n \"offset\": 123,\n \"count\": 123,\n \"search\": \"<string>\",\n \"sourceIds\": [\n \"<string>\"\n ],\n \"channels\": [\n \"<string>\"\n ],\n \"botIds\": [\n \"<string>\"\n ],\n \"personaIds\": [\n \"<string>\"\n ],\n \"minimumResponses\": 123,\n \"lastMessageDirection\": \"<string>\",\n \"followUpScheduled\": 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 \"totalOnly\": true,\n \"sourceOnlyFast\": true,\n \"offset\": 123,\n \"count\": 123,\n \"search\": \"<string>\",\n \"sourceIds\": [\n \"<string>\"\n ],\n \"channels\": [\n \"<string>\"\n ],\n \"botIds\": [\n \"<string>\"\n ],\n \"personaIds\": [\n \"<string>\"\n ],\n \"minimumResponses\": 123,\n \"lastMessageDirection\": \"<string>\",\n \"followUpScheduled\": 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 \"totalOnly\": true,\n \"sourceOnlyFast\": true,\n \"offset\": 123,\n \"count\": 123,\n \"search\": \"<string>\",\n \"sourceIds\": [\n \"<string>\"\n ],\n \"channels\": [\n \"<string>\"\n ],\n \"botIds\": [\n \"<string>\"\n ],\n \"personaIds\": [\n \"<string>\"\n ],\n \"minimumResponses\": 123,\n \"lastMessageDirection\": \"<string>\",\n \"followUpScheduled\": 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>",
"mostRecentFailureReason": "<string>",
"mimicSourceId": "<string>",
"starred": true,
"unread": true,
"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"
}
]
}
],
"total": 123
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}Lead
Search leads
POST
/
lead
/
search
Search leads
curl --request POST \
--url https://api.closebot.com/lead/search \
--header 'Content-Type: application/json' \
--header 'X-CB-KEY: <api-key>' \
--data '
{
"totalOnly": true,
"sourceOnlyFast": true,
"offset": 123,
"count": 123,
"search": "<string>",
"sourceIds": [
"<string>"
],
"channels": [
"<string>"
],
"botIds": [
"<string>"
],
"personaIds": [
"<string>"
],
"minimumResponses": 123,
"lastMessageDirection": "<string>",
"followUpScheduled": true
}
'import requests
url = "https://api.closebot.com/lead/search"
payload = {
"totalOnly": True,
"sourceOnlyFast": True,
"offset": 123,
"count": 123,
"search": "<string>",
"sourceIds": ["<string>"],
"channels": ["<string>"],
"botIds": ["<string>"],
"personaIds": ["<string>"],
"minimumResponses": 123,
"lastMessageDirection": "<string>",
"followUpScheduled": 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({
totalOnly: true,
sourceOnlyFast: true,
offset: 123,
count: 123,
search: '<string>',
sourceIds: ['<string>'],
channels: ['<string>'],
botIds: ['<string>'],
personaIds: ['<string>'],
minimumResponses: 123,
lastMessageDirection: '<string>',
followUpScheduled: 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([
'totalOnly' => true,
'sourceOnlyFast' => true,
'offset' => 123,
'count' => 123,
'search' => '<string>',
'sourceIds' => [
'<string>'
],
'channels' => [
'<string>'
],
'botIds' => [
'<string>'
],
'personaIds' => [
'<string>'
],
'minimumResponses' => 123,
'lastMessageDirection' => '<string>',
'followUpScheduled' => 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 \"totalOnly\": true,\n \"sourceOnlyFast\": true,\n \"offset\": 123,\n \"count\": 123,\n \"search\": \"<string>\",\n \"sourceIds\": [\n \"<string>\"\n ],\n \"channels\": [\n \"<string>\"\n ],\n \"botIds\": [\n \"<string>\"\n ],\n \"personaIds\": [\n \"<string>\"\n ],\n \"minimumResponses\": 123,\n \"lastMessageDirection\": \"<string>\",\n \"followUpScheduled\": 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 \"totalOnly\": true,\n \"sourceOnlyFast\": true,\n \"offset\": 123,\n \"count\": 123,\n \"search\": \"<string>\",\n \"sourceIds\": [\n \"<string>\"\n ],\n \"channels\": [\n \"<string>\"\n ],\n \"botIds\": [\n \"<string>\"\n ],\n \"personaIds\": [\n \"<string>\"\n ],\n \"minimumResponses\": 123,\n \"lastMessageDirection\": \"<string>\",\n \"followUpScheduled\": 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 \"totalOnly\": true,\n \"sourceOnlyFast\": true,\n \"offset\": 123,\n \"count\": 123,\n \"search\": \"<string>\",\n \"sourceIds\": [\n \"<string>\"\n ],\n \"channels\": [\n \"<string>\"\n ],\n \"botIds\": [\n \"<string>\"\n ],\n \"personaIds\": [\n \"<string>\"\n ],\n \"minimumResponses\": 123,\n \"lastMessageDirection\": \"<string>\",\n \"followUpScheduled\": 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>",
"mostRecentFailureReason": "<string>",
"mimicSourceId": "<string>",
"starred": true,
"unread": true,
"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"
}
]
}
],
"total": 123
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"instance": "<string>"
}Authorizations
CloseBot API Key Authorization
Body
application/jsontext/jsonapplication/*+json
The search query input.
The offset of the search results.
The count of the search results.
The search query.
The source IDs.
The channel IDs.
The bot IDs.
The persona IDs.
The minimum number of responses.
The last message direction.
Whether the follow up is scheduled.
⌘I

