Skip to main content

Chatbots & routing

Base URL https://api.leadx.in/api/key/protected. Every request needs an apikey header — see Authentication.

19 endpoints.

GET /manual-chatbot​

Get all manual chatbots.

Auth apikey

:::note Used by the web app components/ManualChatbotTemplatesModal.jsx, pages/AddManualChatbot.jsx, pages/ManualChatbots.jsx :::

Query parameters — the standard list contract: p, n, sortBy, sortOrder, searchBy, searchValue, filters, advancedFilters, ids, nids. See Pagination and Filtering.

Response — data is an array of manualChatbot objects, alongside the pagination fields described in Response format. updatedBy, createdBy are populated, so they arrive as nested objects rather than ids.

cURL
curl -X GET 'https://api.leadx.in/api/key/protected/manual-chatbot?p=1&n=25' \
-H 'apikey: $LEADX_API_KEY'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot?p=1&n=25', {
method: 'GET',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.get(
'/manual-chatbot?p=1&n=25'
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot?p=1&n=25',
{
method: 'GET',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);

req.end();
});

const { data } = await send(null);
console.log(data);
Python
import os
import requests

res = requests.get(
"https://api.leadx.in/api/key/protected/manual-chatbot?p=1&n=25",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot?p=1&n=25');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

POST /manual-chatbot​

Create manual chatbot.

Auth apikey

:::note Used by the web app components/ManualChatbotTemplatesModal.jsx, pages/AddManualChatbot.jsx, pages/ManualChatbots.jsx :::

Request body

FieldTypeRequiredDefault
namestringyes—
descriptionstring—
statusstring—
nodesarray[]
edgesarray[]

Response — data is one manualChatbot object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X POST 'https://api.leadx.in/api/key/protected/manual-chatbot' \
-H 'apikey: $LEADX_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "",
"description": "",
"status": "",
"nodes": [],
"edges": []
}'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot', {
method: 'POST',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "",
"description": "",
"status": "",
"nodes": [],
"edges": []
}),
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.post(
'/manual-chatbot',
{
"name": "",
"description": "",
"status": "",
"nodes": [],
"edges": []
}
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot',
{
method: 'POST',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);
req.write(JSON.stringify(payload));
req.end();
});

const { data } = await send({
"name": "",
"description": "",
"status": "",
"nodes": [],
"edges": []
});
console.log(data);
Python
import os
import requests

res = requests.post(
"https://api.leadx.in/api/key/protected/manual-chatbot",
headers={"apikey": os.environ["LEADX_API_KEY"]},
json={
"name": "",
"description": "",
"status": "",
"nodes": [],
"edges": []
},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({
'name': '',
'description': '',
'status': '',
'nodes': [],
'edges': []
}),
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

DELETE /manual-chatbot​

Delete manual chatbot.

Auth apikey

:::note Used by the web app components/ManualChatbotTemplatesModal.jsx, pages/AddManualChatbot.jsx, pages/ManualChatbots.jsx :::

Response — data is one manualChatbot object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X DELETE 'https://api.leadx.in/api/key/protected/manual-chatbot' \
-H 'apikey: $LEADX_API_KEY'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot', {
method: 'DELETE',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.delete(
'/manual-chatbot'
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot',
{
method: 'DELETE',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);

req.end();
});

const { data } = await send(null);
console.log(data);
Python
import os
import requests

res = requests.delete(
"https://api.leadx.in/api/key/protected/manual-chatbot",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

GET /manual-chatbot/:id​

Get manual chatbot.

Auth apikey

:::note Used by the web app components/ChatWindow.jsx, components/ManualChatbotAiModal.jsx, pages/AddManualChatbot.jsx and 1 more :::

Path parameters

Name
idRequired

Response — data is one manualChatbot object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X GET 'https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID' \
-H 'apikey: $LEADX_API_KEY'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID', {
method: 'GET',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.get(
'/manual-chatbot/MANUAL_CHATBOT_ID'
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID',
{
method: 'GET',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);

req.end();
});

const { data } = await send(null);
console.log(data);
Python
import os
import requests

res = requests.get(
"https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

PUT /manual-chatbot/:id​

Update manual chatbot.

Auth apikey

:::note Used by the web app components/ChatWindow.jsx, components/ManualChatbotAiModal.jsx, pages/AddManualChatbot.jsx and 1 more :::

Path parameters

Name
idRequired

Response — data is one manualChatbot object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X PUT 'https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID' \
-H 'apikey: $LEADX_API_KEY'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID', {
method: 'PUT',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.put(
'/manual-chatbot/MANUAL_CHATBOT_ID'
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID',
{
method: 'PUT',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);

req.end();
});

const { data } = await send(null);
console.log(data);
Python
import os
import requests

res = requests.put(
"https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

DELETE /manual-chatbot/:id​

Delete manual chatbot.

Auth apikey

:::note Used by the web app components/ChatWindow.jsx, components/ManualChatbotAiModal.jsx, pages/AddManualChatbot.jsx and 1 more :::

Path parameters

Name
idRequired

Response — data is one manualChatbot object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X DELETE 'https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID' \
-H 'apikey: $LEADX_API_KEY'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID', {
method: 'DELETE',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.delete(
'/manual-chatbot/MANUAL_CHATBOT_ID'
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID',
{
method: 'DELETE',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);

req.end();
});

const { data } = await send(null);
console.log(data);
Python
import os
import requests

res = requests.delete(
"https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/MANUAL_CHATBOT_ID');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

POST /manual-chatbot/ai-generate​

Generate manual chatbot with AI.

Auth apikey

Request body

FieldDefaultNotes
prompt—The outreach goal, in plain language.

Response — data is one manualChatbot object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X POST 'https://api.leadx.in/api/key/protected/manual-chatbot/ai-generate' \
-H 'apikey: $LEADX_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"prompt": ""
}'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/ai-generate', {
method: 'POST',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"prompt": ""
}),
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.post(
'/manual-chatbot/ai-generate',
{
"prompt": ""
}
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/ai-generate',
{
method: 'POST',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);
req.write(JSON.stringify(payload));
req.end();
});

const { data } = await send({
"prompt": ""
});
console.log(data);
Python
import os
import requests

res = requests.post(
"https://api.leadx.in/api/key/protected/manual-chatbot/ai-generate",
headers={"apikey": os.environ["LEADX_API_KEY"]},
json={
"prompt": ""
},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/ai-generate');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({
'prompt': ''
}),
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

Errors AIUsageLimitReached_429

GET /manual-chatbot/chatbot-router​

Get chatbot router.

Auth apikey

Response — data is one manualChatbot object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X GET 'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router' \
-H 'apikey: $LEADX_API_KEY'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router', {
method: 'GET',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.get(
'/manual-chatbot/chatbot-router'
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router',
{
method: 'GET',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);

req.end();
});

const { data } = await send(null);
console.log(data);
Python
import os
import requests

res = requests.get(
"https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

PUT /manual-chatbot/chatbot-router​

Update chatbot router.

Auth apikey

Response — data is one manualChatbot object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X PUT 'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router' \
-H 'apikey: $LEADX_API_KEY'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router', {
method: 'PUT',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.put(
'/manual-chatbot/chatbot-router'
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router',
{
method: 'PUT',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);

req.end();
});

const { data } = await send(null);
console.log(data);
Python
import os
import requests

res = requests.put(
"https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

GET /manual-chatbot/chatbot-router/apps​

Get entry point apps.

Auth apikey

:::note Used by the web app pages/ChatbotManager.jsx :::

cURL
curl -X GET 'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/apps' \
-H 'apikey: $LEADX_API_KEY'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/apps', {
method: 'GET',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.get(
'/manual-chatbot/chatbot-router/apps'
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/apps',
{
method: 'GET',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);

req.end();
});

const { data } = await send(null);
console.log(data);
Python
import os
import requests

res = requests.get(
"https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/apps",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/apps');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

GET /manual-chatbot/chatbot-router/bots​

Get routable chatbots.

Auth apikey

:::note Used by the web app pages/AddManualChatbot.jsx, pages/ChatbotManager.jsx :::

Response — data is one manualChatbot object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X GET 'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/bots' \
-H 'apikey: $LEADX_API_KEY'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/bots', {
method: 'GET',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.get(
'/manual-chatbot/chatbot-router/bots'
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/bots',
{
method: 'GET',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);

req.end();
});

const { data } = await send(null);
console.log(data);
Python
import os
import requests

res = requests.get(
"https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/bots",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/bots');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

POST /manual-chatbot/chatbot-router/entry-points​

Create entry point.

Auth apikey

:::note Used by the web app pages/ChatbotManager.jsx :::

Request body

FieldRequiredDefault
channelyes—

Response — data is one manualChatbot object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X POST 'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points' \
-H 'apikey: $LEADX_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"channel": ""
}'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points', {
method: 'POST',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"channel": ""
}),
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.post(
'/manual-chatbot/chatbot-router/entry-points',
{
"channel": ""
}
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points',
{
method: 'POST',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);
req.write(JSON.stringify(payload));
req.end();
});

const { data } = await send({
"channel": ""
});
console.log(data);
Python
import os
import requests

res = requests.post(
"https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points",
headers={"apikey": os.environ["LEADX_API_KEY"]},
json={
"channel": ""
},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({
'channel': ''
}),
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

PUT /manual-chatbot/chatbot-router/entry-points/:entryPointId​

Update entry point.

Auth apikey

:::note Used by the web app pages/ChatbotManager.jsx :::

Path parameters

Name
entryPointIdRequired

Response — data is one manualChatbot object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X PUT 'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID' \
-H 'apikey: $LEADX_API_KEY'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID', {
method: 'PUT',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.put(
'/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID'
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID',
{
method: 'PUT',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);

req.end();
});

const { data } = await send(null);
console.log(data);
Python
import os
import requests

res = requests.put(
"https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

DELETE /manual-chatbot/chatbot-router/entry-points/:entryPointId​

Delete entry point.

Auth apikey

:::note Used by the web app pages/ChatbotManager.jsx :::

Path parameters

Name
entryPointIdRequired

Response — data is one manualChatbot object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X DELETE 'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID' \
-H 'apikey: $LEADX_API_KEY'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID', {
method: 'DELETE',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.delete(
'/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID'
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID',
{
method: 'DELETE',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);

req.end();
});

const { data } = await send(null);
console.log(data);
Python
import os
import requests

res = requests.delete(
"https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

POST /manual-chatbot/chatbot-router/entry-points/:entryPointId/test​

Test chatbot router.

Auth apikey

:::note Used by the web app pages/ChatbotManager.jsx :::

Path parameters

Name
entryPointIdRequired

Request body

FieldTypeRequiredDefault
textstringyes—

Response — data is one manualChatbot object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X POST 'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID/test' \
-H 'apikey: $LEADX_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"text": ""
}'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID/test', {
method: 'POST',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"text": ""
}),
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.post(
'/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID/test',
{
"text": ""
}
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID/test',
{
method: 'POST',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);
req.write(JSON.stringify(payload));
req.end();
});

const { data } = await send({
"text": ""
});
console.log(data);
Python
import os
import requests

res = requests.post(
"https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID/test",
headers={"apikey": os.environ["LEADX_API_KEY"]},
json={
"text": ""
},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/entry-points/ENTRYPOINTID/test');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({
'text': ''
}),
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

POST /manual-chatbot/chatbot-router/rebuild​

Rebuild chatbot router indexes.

Auth apikey

:::note Used by the web app pages/ChatbotManager.jsx :::

Response — data is one manualChatbot object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X POST 'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/rebuild' \
-H 'apikey: $LEADX_API_KEY'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/rebuild', {
method: 'POST',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.post(
'/manual-chatbot/chatbot-router/rebuild'
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/rebuild',
{
method: 'POST',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);

req.end();
});

const { data } = await send(null);
console.log(data);
Python
import os
import requests

res = requests.post(
"https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/rebuild",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/rebuild');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

GET /manual-chatbot/chatbot-router/session/stop​

Get chatbot session status.

Auth apikey

:::note Used by the web app components/ChatWindow.jsx :::

Response — data is one botSession object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X GET 'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/session/stop' \
-H 'apikey: $LEADX_API_KEY'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/session/stop', {
method: 'GET',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.get(
'/manual-chatbot/chatbot-router/session/stop'
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/session/stop',
{
method: 'GET',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);

req.end();
});

const { data } = await send(null);
console.log(data);
Python
import os
import requests

res = requests.get(
"https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/session/stop",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/session/stop');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

PUT /manual-chatbot/chatbot-router/session/stop​

Stop chatbot session.

Auth apikey

:::note Used by the web app components/ChatWindow.jsx :::

Request body

FieldTypeRequiredDefault
channelstringyes—
appObjectIdyes—
accountObjectIdnull

Response — data is one botSession object. (Resource deduced from the collections this handler reads, not read off an explicit return.)

cURL
curl -X PUT 'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/session/stop' \
-H 'apikey: $LEADX_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"channel": "",
"app": "",
"account": ""
}'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/session/stop', {
method: 'PUT',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"channel": "",
"app": "",
"account": ""
}),
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.put(
'/manual-chatbot/chatbot-router/session/stop',
{
"channel": "",
"app": "",
"account": ""
}
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/session/stop',
{
method: 'PUT',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);
req.write(JSON.stringify(payload));
req.end();
});

const { data } = await send({
"channel": "",
"app": "",
"account": ""
});
console.log(data);
Python
import os
import requests

res = requests.put(
"https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/session/stop",
headers={"apikey": os.environ["LEADX_API_KEY"]},
json={
"channel": "",
"app": "",
"account": ""
},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/chatbot-router/session/stop');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({
'channel': '',
'app': '',
'account': ''
}),
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);

POST /manual-chatbot/keywords​

Extract manual chatbot keywords.

Auth apikey

cURL
curl -X POST 'https://api.leadx.in/api/key/protected/manual-chatbot/keywords' \
-H 'apikey: $LEADX_API_KEY'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/manual-chatbot/keywords', {
method: 'POST',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});

const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}

console.log(payload.data);
axios
import axios from 'axios';

const leadx = axios.create({
baseURL: 'https://api.leadx.in/api/key/protected',
headers: { apikey: process.env.LEADX_API_KEY },
});

try {
const { data } = await leadx.post(
'/manual-chatbot/keywords'
);
console.log(data.data);
} catch (err) {
// axios throws on 4xx/5xx; the envelope is on err.response.data.
throw new Error(`${err.response?.status} ${err.response?.data?.message ?? err.message}`);
}
Node (no deps)
import { request } from 'node:https';

// The dependency-free version, for somewhere fetch is not available.
const send = (payload) =>
new Promise((resolve, reject) => {
const req = request(
'https://api.leadx.in/api/key/protected/manual-chatbot/keywords',
{
method: 'POST',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);

req.end();
});

const { data } = await send(null);
console.log(data);
Python
import os
import requests

res = requests.post(
"https://api.leadx.in/api/key/protected/manual-chatbot/keywords",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/manual-chatbot/keywords');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}

print_r($payload['data']);