Skip to main content

Session-only endpoints

These sit at /api/private, not under /key/protected. They resolve a user before a company is chosen, so they authenticate with a session JWT only — an API key cannot reach them. Documented because the web app depends on them.

Base URL https://api.leadx.in/api/private.

16 endpoints.

PUT /change-password​

Change password.

Auth session JWT only · Success 200

Request body

FieldRequiredDefault
currentPassword—
newPasswordyes—

Required: password, newPassword. Of these, password is nested inside another field (commonly formData), or checked under a different internal name.

Response — data is one User object.

cURL
curl -X PUT 'https://api.leadx.in/api/private/change-password' \
-H 'Authorization: Bearer $LEADX_JWT' \
-H 'Content-Type: application/json' \
-d '{
"currentPassword": "",
"newPassword": ""
}'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/change-password', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"currentPassword": "",
"newPassword": ""
}),
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.put(
'/change-password',
{
"currentPassword": "",
"newPassword": ""
}
);
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/private/change-password',
{
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
'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({
"currentPassword": "",
"newPassword": ""
});
console.log(data);
Python
import os
import requests

res = requests.put(
"https://api.leadx.in/api/private/change-password",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
json={
"currentPassword": "",
"newPassword": ""
},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/change-password');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({
'currentPassword': '',
'newPassword': ''
}),
]);

$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 InvalidPassword_400

POST /company​

Create company.

Auth session JWT only · Success 200

:::note Used by the web app pages/Billing.jsx, pages/CompanyProfile.jsx :::

Request body

FieldRequiredDefault
nameyes—
emailyes—
contactNumber—
timezoneyes—

Required: name, email, countryCode, number, timezone. Of these, countryCode, number are nested inside another field (commonly formData), or checked under a different internal name.

cURL
curl -X POST 'https://api.leadx.in/api/private/company' \
-H 'Authorization: Bearer $LEADX_JWT' \
-H 'Content-Type: application/json' \
-d '{
"name": "",
"email": "",
"contactNumber": "",
"timezone": ""
}'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/company', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "",
"email": "",
"contactNumber": "",
"timezone": ""
}),
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.post(
'/company',
{
"name": "",
"email": "",
"contactNumber": "",
"timezone": ""
}
);
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/private/company',
{
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
'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": "",
"email": "",
"contactNumber": "",
"timezone": ""
});
console.log(data);
Python
import os
import requests

res = requests.post(
"https://api.leadx.in/api/private/company",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
json={
"name": "",
"email": "",
"contactNumber": "",
"timezone": ""
},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/company');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({
'name': '',
'email': '',
'contactNumber': '',
'timezone': ''
}),
]);

$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 InvalidTimezone_400

ALL /country-state-city​

Country state city.

Auth session JWT only

Query parameters

FieldDefault
country—
state—
cURL
curl -X ALL 'https://api.leadx.in/api/private/country-state-city' \
-H 'Authorization: Bearer $LEADX_JWT'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/country-state-city', {
method: 'ALL',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.all(
'/country-state-city'
);
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/private/country-state-city',
{
method: 'ALL',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
},
(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.all(
"https://api.leadx.in/api/private/country-state-city",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/country-state-city');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'ALL',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
],
]);

$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 CountryNotFound_400 · StateNotFound_400

ALL /currencies​

Currency.

Auth session JWT only

cURL
curl -X ALL 'https://api.leadx.in/api/private/currencies' \
-H 'Authorization: Bearer $LEADX_JWT'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/currencies', {
method: 'ALL',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.all(
'/currencies'
);
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/private/currencies',
{
method: 'ALL',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
},
(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.all(
"https://api.leadx.in/api/private/currencies",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/currencies');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'ALL',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
],
]);

$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 /invite/:id​

Invite resolve.

Auth session JWT only · Success 200

Path parameters

Name
idRequired

Request body

FieldTypeRequiredDefault
statusstringyes—

Required: id, status. Of these, id is nested inside another field (commonly formData), or checked under a different internal name.

Response — data is one Member object.

cURL
curl -X POST 'https://api.leadx.in/api/private/invite/INVITE_ID' \
-H 'Authorization: Bearer $LEADX_JWT' \
-H 'Content-Type: application/json' \
-d '{
"status": ""
}'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/invite/INVITE_ID', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"status": ""
}),
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.post(
'/invite/INVITE_ID',
{
"status": ""
}
);
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/private/invite/INVITE_ID',
{
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
'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({
"status": ""
});
console.log(data);
Python
import os
import requests

res = requests.post(
"https://api.leadx.in/api/private/invite/INVITE_ID",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
json={
"status": ""
},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/invite/INVITE_ID');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({
'status': ''
}),
]);

$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 InvalidInviteStatus_400 · InviteExpired_400 · MemberNotFound_404

GET /invites​

Get invites.

Auth session JWT only

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 Member objects, alongside the pagination fields described in Response format. company, createdBy are populated, so they arrive as nested objects rather than ids.

cURL
curl -X GET 'https://api.leadx.in/api/private/invites?p=1&n=25' \
-H 'Authorization: Bearer $LEADX_JWT'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/invites?p=1&n=25', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.get(
'/invites?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/private/invites?p=1&n=25',
{
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
},
(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/private/invites?p=1&n=25",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/invites?p=1&n=25');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
],
]);

$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 /memberships​

Memberships.

Auth session JWT only

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 Member objects, alongside the pagination fields described in Response format. company is populated, so it arrives as nested objects rather than ids.

cURL
curl -X GET 'https://api.leadx.in/api/private/memberships?p=1&n=25' \
-H 'Authorization: Bearer $LEADX_JWT'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/memberships?p=1&n=25', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.get(
'/memberships?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/private/memberships?p=1&n=25',
{
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
},
(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/private/memberships?p=1&n=25",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/memberships?p=1&n=25');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
],
]);

$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 /memberships/:id​

Membership.

Auth session JWT only

Path parameters

Name
idRequired

Response — data is one Member object. company role is populated, so it arrives as nested objects rather than ids.

cURL
curl -X GET 'https://api.leadx.in/api/private/memberships/MEMBERSHIPS_ID' \
-H 'Authorization: Bearer $LEADX_JWT'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/memberships/MEMBERSHIPS_ID', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.get(
'/memberships/MEMBERSHIPS_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/private/memberships/MEMBERSHIPS_ID',
{
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
},
(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/private/memberships/MEMBERSHIPS_ID",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/memberships/MEMBERSHIPS_ID');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
],
]);

$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 /partner-program​

Get partner program.

Auth session JWT only

cURL
curl -X GET 'https://api.leadx.in/api/private/partner-program' \
-H 'Authorization: Bearer $LEADX_JWT'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/partner-program', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.get(
'/partner-program'
);
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/private/partner-program',
{
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
},
(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/private/partner-program",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/partner-program');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
],
]);

$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 /partner-program/referrals​

Get partner referrals.

Auth session JWT only

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

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

cURL
curl -X GET 'https://api.leadx.in/api/private/partner-program/referrals?p=1&n=25' \
-H 'Authorization: Bearer $LEADX_JWT'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/partner-program/referrals?p=1&n=25', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.get(
'/partner-program/referrals?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/private/partner-program/referrals?p=1&n=25',
{
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
},
(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/private/partner-program/referrals?p=1&n=25",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/partner-program/referrals?p=1&n=25');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
],
]);

$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 /partner-program/request​

Request partner program.

Auth session JWT only · Success 200

Request body

FieldDefault
requestNote""
cURL
curl -X POST 'https://api.leadx.in/api/private/partner-program/request' \
-H 'Authorization: Bearer $LEADX_JWT' \
-H 'Content-Type: application/json' \
-d '{
"requestNote": ""
}'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/partner-program/request', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"requestNote": ""
}),
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.post(
'/partner-program/request',
{
"requestNote": ""
}
);
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/private/partner-program/request',
{
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
'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({
"requestNote": ""
});
console.log(data);
Python
import os
import requests

res = requests.post(
"https://api.leadx.in/api/private/partner-program/request",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
json={
"requestNote": ""
},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/partner-program/request');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({
'requestNote': ''
}),
]);

$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 PartnerProgramAlreadyApproved_400 · PartnerProgramAlreadyRequested_400 · PartnerProgramRevoked_400

GET /profile​

Get profile.

Auth session JWT only

:::note Used by the web app components/CompanySwitcherAndProfile.jsx, components/CustomField.jsx, components/Navbar.jsx and 5 more :::

Response — data is one Member object. role user is populated, so it arrives as nested objects rather than ids.

cURL
curl -X GET 'https://api.leadx.in/api/private/profile' \
-H 'Authorization: Bearer $LEADX_JWT'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/profile', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.get(
'/profile'
);
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/private/profile',
{
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
},
(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/private/profile",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/profile');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
],
]);

$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 /profile​

Update profile.

Auth session JWT only

:::note Used by the web app components/CompanySwitcherAndProfile.jsx, components/CustomField.jsx, components/Navbar.jsx and 5 more :::

Request body

FieldDefault
aiOnboarded—
onboarded—
layout—
darkMode—
columns—
cURL
curl -X PUT 'https://api.leadx.in/api/private/profile' \
-H 'Authorization: Bearer $LEADX_JWT' \
-H 'Content-Type: application/json' \
-d '{
"aiOnboarded": "",
"onboarded": "",
"layout": "",
"darkMode": "",
"columns": ""
}'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/profile', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"aiOnboarded": "",
"onboarded": "",
"layout": "",
"darkMode": "",
"columns": ""
}),
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.put(
'/profile',
{
"aiOnboarded": "",
"onboarded": "",
"layout": "",
"darkMode": "",
"columns": ""
}
);
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/private/profile',
{
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
'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({
"aiOnboarded": "",
"onboarded": "",
"layout": "",
"darkMode": "",
"columns": ""
});
console.log(data);
Python
import os
import requests

res = requests.put(
"https://api.leadx.in/api/private/profile",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
json={
"aiOnboarded": "",
"onboarded": "",
"layout": "",
"darkMode": "",
"columns": ""
},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/profile');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({
'aiOnboarded': '',
'onboarded': '',
'layout': '',
'darkMode': '',
'columns': ''
}),
]);

$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 /refer-program​

Get refer program.

Auth session JWT only

cURL
curl -X GET 'https://api.leadx.in/api/private/refer-program' \
-H 'Authorization: Bearer $LEADX_JWT'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/refer-program', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.get(
'/refer-program'
);
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/private/refer-program',
{
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
},
(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/private/refer-program",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/refer-program');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
],
]);

$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 /refer-program​

Update refer program.

Auth session JWT only · Success 200

Request body

FieldTypeDefault
statusstring—

Response — data is one ReferProgram object.

cURL
curl -X PUT 'https://api.leadx.in/api/private/refer-program' \
-H 'Authorization: Bearer $LEADX_JWT' \
-H 'Content-Type: application/json' \
-d '{
"status": ""
}'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/refer-program', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"status": ""
}),
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.put(
'/refer-program',
{
"status": ""
}
);
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/private/refer-program',
{
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
'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({
"status": ""
});
console.log(data);
Python
import os
import requests

res = requests.put(
"https://api.leadx.in/api/private/refer-program",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
json={
"status": ""
},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/refer-program');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({
'status': ''
}),
]);

$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 InvalidReferProgramStatus_400

GET /refer-program/referrals​

Get refer referrals.

Auth session JWT only

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 User objects, alongside the pagination fields described in Response format.

cURL
curl -X GET 'https://api.leadx.in/api/private/refer-program/referrals?p=1&n=25' \
-H 'Authorization: Bearer $LEADX_JWT'
fetch
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/private/refer-program/referrals?p=1&n=25', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
});

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/private',
headers: { Authorization: `Bearer ${process.env.LEADX_JWT}` },
});

try {
const { data } = await leadx.get(
'/refer-program/referrals?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/private/refer-program/referrals?p=1&n=25',
{
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.LEADX_JWT}`,
},
},
(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/private/refer-program/referrals?p=1&n=25",
headers={"Authorization": f"Bearer {os.environ['LEADX_JWT']}"},
timeout=30,
)

payload = res.json()
res.raise_for_status()
print(payload["data"])
PHP
<?php
$ch = curl_init('https://api.leadx.in/api/private/refer-program/referrals?p=1&n=25');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: ' . 'Bearer ' . getenv('LEADX_JWT'),
],
]);

$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']);