Analytics dashboards
Base URL https://api.leadx.in/api/key/protected. Every request needs an apikey header — see Authentication.
20 endpoints.
GET /analytics-dashboard
Get all analytics dashboard.
Auth apikey
:::note Used by the web app
components/AnalyticsDashboardComponent.jsx, pages/AddAnalyticsDashboard.jsx
:::
curl -X GET 'https://api.leadx.in/api/key/protected/analytics-dashboard' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard', {
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);
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(
'/analytics-dashboard'
);
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}`);
}
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/analytics-dashboard',
{
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);
import os
import requests
res = requests.get(
"https://api.leadx.in/api/key/protected/analytics-dashboard",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard');
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 /analytics-dashboard
Create analytics dashboard.
Auth apikey
:::note Used by the web app
components/AnalyticsDashboardComponent.jsx, pages/AddAnalyticsDashboard.jsx
:::
curl -X POST 'https://api.leadx.in/api/key/protected/analytics-dashboard' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard', {
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);
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(
'/analytics-dashboard'
);
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}`);
}
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/analytics-dashboard',
{
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);
import os
import requests
res = requests.post(
"https://api.leadx.in/api/key/protected/analytics-dashboard",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard');
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 /analytics-dashboard/:id
Get analytics dashboard.
Auth apikey
:::note Used by the web app
components/AnalyticsDashboardComponent.jsx, pages/AddAnalyticsDashboard.jsx
:::
Path parameters
| Name | |
|---|---|
id | Required |
curl -X GET 'https://api.leadx.in/api/key/protected/analytics-dashboard/ANALYTICS_DASHBOARD_ID' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/ANALYTICS_DASHBOARD_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);
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(
'/analytics-dashboard/ANALYTICS_DASHBOARD_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}`);
}
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/analytics-dashboard/ANALYTICS_DASHBOARD_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);
import os
import requests
res = requests.get(
"https://api.leadx.in/api/key/protected/analytics-dashboard/ANALYTICS_DASHBOARD_ID",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/ANALYTICS_DASHBOARD_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 /analytics-dashboard/:id
Update analytics dashboard.
Auth apikey
:::note Used by the web app
components/AnalyticsDashboardComponent.jsx, pages/AddAnalyticsDashboard.jsx
:::
Path parameters
| Name | |
|---|---|
id | Required |
curl -X PUT 'https://api.leadx.in/api/key/protected/analytics-dashboard/ANALYTICS_DASHBOARD_ID' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/ANALYTICS_DASHBOARD_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);
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(
'/analytics-dashboard/ANALYTICS_DASHBOARD_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}`);
}
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/analytics-dashboard/ANALYTICS_DASHBOARD_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);
import os
import requests
res = requests.put(
"https://api.leadx.in/api/key/protected/analytics-dashboard/ANALYTICS_DASHBOARD_ID",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/ANALYTICS_DASHBOARD_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 /analytics-dashboard/:id
Delete analytics dashboard.
Auth apikey
:::note Used by the web app
components/AnalyticsDashboardComponent.jsx, pages/AddAnalyticsDashboard.jsx
:::
Path parameters
| Name | |
|---|---|
id | Required |
curl -X DELETE 'https://api.leadx.in/api/key/protected/analytics-dashboard/ANALYTICS_DASHBOARD_ID' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/ANALYTICS_DASHBOARD_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);
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(
'/analytics-dashboard/ANALYTICS_DASHBOARD_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}`);
}
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/analytics-dashboard/ANALYTICS_DASHBOARD_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);
import os
import requests
res = requests.delete(
"https://api.leadx.in/api/key/protected/analytics-dashboard/ANALYTICS_DASHBOARD_ID",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/ANALYTICS_DASHBOARD_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']);
PUT /analytics-dashboard/reorder
Reorder analytics dashboard.
Auth apikey
curl -X PUT 'https://api.leadx.in/api/key/protected/analytics-dashboard/reorder' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/reorder', {
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);
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(
'/analytics-dashboard/reorder'
);
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}`);
}
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/analytics-dashboard/reorder',
{
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);
import os
import requests
res = requests.put(
"https://api.leadx.in/api/key/protected/analytics-dashboard/reorder",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/reorder');
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 /analytics-dashboard/statistics/activity
Get activity statistics.
Auth apikey
:::note Used by the web app
components/AnalyticsDashboardComponent.jsx
:::
curl -X GET 'https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/activity' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/activity', {
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);
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(
'/analytics-dashboard/statistics/activity'
);
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}`);
}
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/analytics-dashboard/statistics/activity',
{
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);
import os
import requests
res = requests.get(
"https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/activity",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/activity');
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 /analytics-dashboard/statistics/apps
Get app statistics.
Auth apikey
:::note Used by the web app
components/AnalyticsDashboardComponent.jsx
:::
curl -X GET 'https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/apps' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/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);
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(
'/analytics-dashboard/statistics/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}`);
}
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/analytics-dashboard/statistics/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);
import os
import requests
res = requests.get(
"https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/apps",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/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 /analytics-dashboard/statistics/campaigns
Get campaign statistics.
Auth apikey
:::note Used by the web app
components/AnalyticsDashboardComponent.jsx
:::
curl -X GET 'https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/campaigns' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/campaigns', {
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);
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(
'/analytics-dashboard/statistics/campaigns'
);
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}`);
}
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/analytics-dashboard/statistics/campaigns',
{
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);
import os
import requests
res = requests.get(
"https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/campaigns",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/campaigns');
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 /analytics-dashboard/statistics/contacts
Get contact statistics.
Auth apikey
:::note Used by the web app
components/AnalyticsDashboardComponent.jsx
:::
curl -X GET 'https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/contacts' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/contacts', {
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);
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(
'/analytics-dashboard/statistics/contacts'
);
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}`);
}
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/analytics-dashboard/statistics/contacts',
{
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);
import os
import requests
res = requests.get(
"https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/contacts",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/contacts');
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 /analytics-dashboard/statistics/leads
Get lead statistics.
Auth apikey
:::note Used by the web app
components/AnalyticsDashboardComponent.jsx
:::
curl -X GET 'https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/leads' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/leads', {
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);
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(
'/analytics-dashboard/statistics/leads'
);
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}`);
}
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/analytics-dashboard/statistics/leads',
{
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);
import os
import requests
res = requests.get(
"https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/leads",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/leads');
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 /analytics-dashboard/statistics/messages
Get message statistics.
Auth apikey
:::note Used by the web app
components/AnalyticsDashboardComponent.jsx
:::
curl -X GET 'https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/messages' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/messages', {
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);
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(
'/analytics-dashboard/statistics/messages'
);
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}`);
}
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/analytics-dashboard/statistics/messages',
{
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);
import os
import requests
res = requests.get(
"https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/messages",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/messages');
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 /analytics-dashboard/statistics/overview
Get overview statistics.
Auth apikey
:::note Used by the web app
components/AnalyticsDashboardComponent.jsx
:::
curl -X GET 'https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/overview' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/overview', {
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);
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(
'/analytics-dashboard/statistics/overview'
);
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}`);
}
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/analytics-dashboard/statistics/overview',
{
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);
import os
import requests
res = requests.get(
"https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/overview",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/overview');
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 /analytics-dashboard/statistics/revenue
Get revenue statistics.
Auth apikey
:::note Used by the web app
components/AnalyticsDashboardComponent.jsx
:::
curl -X GET 'https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/revenue' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/revenue', {
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);
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(
'/analytics-dashboard/statistics/revenue'
);
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}`);
}
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/analytics-dashboard/statistics/revenue',
{
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);
import os
import requests
res = requests.get(
"https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/revenue",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/revenue');
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 /analytics-dashboard/statistics/team
Get team statistics.
Auth apikey
:::note Used by the web app
components/AnalyticsDashboardComponent.jsx
:::
curl -X GET 'https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/team' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/team', {
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);
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(
'/analytics-dashboard/statistics/team'
);
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}`);
}
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/analytics-dashboard/statistics/team',
{
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);
import os
import requests
res = requests.get(
"https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/team",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/statistics/team');
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 /analytics-dashboard/widget
Get all analytics widgets.
Auth apikey
curl -X GET 'https://api.leadx.in/api/key/protected/analytics-dashboard/widget' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/widget', {
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);
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(
'/analytics-dashboard/widget'
);
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}`);
}
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/analytics-dashboard/widget',
{
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);
import os
import requests
res = requests.get(
"https://api.leadx.in/api/key/protected/analytics-dashboard/widget",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/widget');
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 /analytics-dashboard/widget
Create analytics widget.
Auth apikey
curl -X POST 'https://api.leadx.in/api/key/protected/analytics-dashboard/widget' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/widget', {
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);
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(
'/analytics-dashboard/widget'
);
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}`);
}
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/analytics-dashboard/widget',
{
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);
import os
import requests
res = requests.post(
"https://api.leadx.in/api/key/protected/analytics-dashboard/widget",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/widget');
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 /analytics-dashboard/widget/:id
Get analytics widget.
Auth apikey
Path parameters
| Name | |
|---|---|
id | Required |
curl -X GET 'https://api.leadx.in/api/key/protected/analytics-dashboard/widget/ANALYTICS_DASHBOARD_ID' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/widget/ANALYTICS_DASHBOARD_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);
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(
'/analytics-dashboard/widget/ANALYTICS_DASHBOARD_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}`);
}
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/analytics-dashboard/widget/ANALYTICS_DASHBOARD_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);
import os
import requests
res = requests.get(
"https://api.leadx.in/api/key/protected/analytics-dashboard/widget/ANALYTICS_DASHBOARD_ID",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/widget/ANALYTICS_DASHBOARD_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 /analytics-dashboard/widget/:id
Update analytics widget.
Auth apikey
Path parameters
| Name | |
|---|---|
id | Required |
curl -X PUT 'https://api.leadx.in/api/key/protected/analytics-dashboard/widget/ANALYTICS_DASHBOARD_ID' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/widget/ANALYTICS_DASHBOARD_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);
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(
'/analytics-dashboard/widget/ANALYTICS_DASHBOARD_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}`);
}
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/analytics-dashboard/widget/ANALYTICS_DASHBOARD_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);
import os
import requests
res = requests.put(
"https://api.leadx.in/api/key/protected/analytics-dashboard/widget/ANALYTICS_DASHBOARD_ID",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/widget/ANALYTICS_DASHBOARD_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 /analytics-dashboard/widget/:id
Delete analytics widget.
Auth apikey
Path parameters
| Name | |
|---|---|
id | Required |
curl -X DELETE 'https://api.leadx.in/api/key/protected/analytics-dashboard/widget/ANALYTICS_DASHBOARD_ID' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/analytics-dashboard/widget/ANALYTICS_DASHBOARD_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);
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(
'/analytics-dashboard/widget/ANALYTICS_DASHBOARD_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}`);
}
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/analytics-dashboard/widget/ANALYTICS_DASHBOARD_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);
import os
import requests
res = requests.delete(
"https://api.leadx.in/api/key/protected/analytics-dashboard/widget/ANALYTICS_DASHBOARD_ID",
headers={"apikey": os.environ["LEADX_API_KEY"]},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/analytics-dashboard/widget/ANALYTICS_DASHBOARD_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']);