Get leads for a chatbot
curl --request GET \
--url https://www.chatbase.co/api/v1/get-leads \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chatbase.co/api/v1/get-leads"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.chatbase.co/api/v1/get-leads', 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://www.chatbase.co/api/v1/get-leads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://www.chatbase.co/api/v1/get-leads"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://www.chatbase.co/api/v1/get-leads")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chatbase.co/api/v1/get-leads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"collectedCustomers": [
{
"id": "lead_123",
"name": "John Doe",
"email": "john@example.com",
"phone": "+1234567890",
"created_at": "2024-01-01T12:00:00Z",
"chatbot_id": "ckl123abc456",
"account_id": "acc_123abc456"
}
]
}{
"message": "Invalid request data"
}{
"message": "No API key provided."
}{
"message": "Resource not found"
}{
"message": "Internal server error"
}Leads
Get leads for a chatbot
Retrieves collected leads/customers for a specific chatbot
GET
/
get-leads
Get leads for a chatbot
curl --request GET \
--url https://www.chatbase.co/api/v1/get-leads \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.chatbase.co/api/v1/get-leads"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.chatbase.co/api/v1/get-leads', 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://www.chatbase.co/api/v1/get-leads",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://www.chatbase.co/api/v1/get-leads"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://www.chatbase.co/api/v1/get-leads")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chatbase.co/api/v1/get-leads")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"collectedCustomers": [
{
"id": "lead_123",
"name": "John Doe",
"email": "john@example.com",
"phone": "+1234567890",
"created_at": "2024-01-01T12:00:00Z",
"chatbot_id": "ckl123abc456",
"account_id": "acc_123abc456"
}
]
}{
"message": "Invalid request data"
}{
"message": "No API key provided."
}{
"message": "Resource not found"
}{
"message": "Internal server error"
}Authorizations
API key in Bearer token format
Query Parameters
ID of the chatbot
Start date for lead filtering (YYYY-MM-DD)
End date for lead filtering (YYYY-MM-DD)
Page number for pagination
Number of items per page
Response
Leads retrieved successfully
Show child attributes
Show child attributes
⌘I