Subscriptions
Base URL https://api.leadx.in/api/key/protected. Every request needs an apikey header — see Authentication.
12 endpoints.
POST /subscription
Create subscription.
Auth apikey
curl -X POST 'https://api.leadx.in/api/key/protected/subscription' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/subscription', {
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(
'/subscription'
);
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/subscription',
{
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/subscription",
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/subscription');
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']);
DELETE /subscription/:subscriptionId
Remove specific subscription.
Auth apikey · Success 200
:::note Used by the web app
pages/Billing.jsx, pages/BillingHistory.jsx, pages/MyPlanDetails.jsx and 1 more
:::
Path parameters
| Name | |
|---|---|
subscriptionId | Required |
Response — data is one Subscription object. planDetails.features.feature changeRequest is populated, so it arrives as nested objects rather than ids.
curl -X DELETE 'https://api.leadx.in/api/key/protected/subscription/SUBSCRIPTIONID' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/subscription/SUBSCRIPTIONID', {
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(
'/subscription/SUBSCRIPTIONID'
);
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/subscription/SUBSCRIPTIONID',
{
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/subscription/SUBSCRIPTIONID",
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/subscription/SUBSCRIPTIONID');
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']);
Errors SubscriptionNotFound_400
POST /subscription/change
Change subscription.
Auth apikey · Success 200
curl -X POST 'https://api.leadx.in/api/key/protected/subscription/change' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/subscription/change', {
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(
'/subscription/change'
);
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/subscription/change',
{
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/subscription/change",
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/subscription/change');
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']);
Errors PlanMaxUsers_400 · PlanMinUsers_400
DELETE /subscription/current
Remove current subscription.
Auth apikey · Success 200
Response — data is one Subscription object. planDetails.features.feature changeRequest is populated, so it arrives as nested objects rather than ids.
curl -X DELETE 'https://api.leadx.in/api/key/protected/subscription/current' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/subscription/current', {
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(
'/subscription/current'
);
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/subscription/current',
{
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/subscription/current",
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/subscription/current');
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']);
Errors SubscriptionNotFound_400
GET /subscription/history
Get subscription history.
Auth apikey
curl -X GET 'https://api.leadx.in/api/key/protected/subscription/history' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/subscription/history', {
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(
'/subscription/history'
);
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/subscription/history',
{
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/subscription/history",
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/subscription/history');
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 /subscription/list
Get all subscriptions.
Auth apikey
Query parameters — the standard list contract: p, n, sortBy, sortOrder, searchBy, searchValue, filters, advancedFilters, ids, nids. See Pagination and Filtering.
curl -X GET 'https://api.leadx.in/api/key/protected/subscription/list?p=1&n=25' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/subscription/list?p=1&n=25', {
method: 'GET',
headers: {
apikey: process.env.LEADX_API_KEY,
},
});
const payload = await res.json();
if (!res.ok) {
// Errors carry { status, success, message } — not the success envelope.
throw new Error(`${res.status} ${payload.message}`);
}
console.log(payload.data);
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(
'/subscription/list?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}`);
}
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/subscription/list?p=1&n=25',
{
method: 'GET',
headers: {
apikey: process.env.LEADX_API_KEY,
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);
req.end();
});
const { data } = await send(null);
console.log(data);
import os
import requests
res = requests.get(
"https://api.leadx.in/api/key/protected/subscription/list?p=1&n=25",
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/subscription/list?p=1&n=25');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}
print_r($payload['data']);
POST /subscription/preview
Price a plan change before committing to it.
Auth apikey
curl -X POST 'https://api.leadx.in/api/key/protected/subscription/preview' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/subscription/preview', {
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(
'/subscription/preview'
);
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/subscription/preview',
{
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/subscription/preview",
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/subscription/preview');
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']);
Errors PlanMaxUsers_400
DELETE /subscription/queued
Remove all queued subscriptions.
Auth apikey · Success 200
curl -X DELETE 'https://api.leadx.in/api/key/protected/subscription/queued' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/subscription/queued', {
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(
'/subscription/queued'
);
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/subscription/queued',
{
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/subscription/queued",
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/subscription/queued');
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']);
DELETE /subscription/queued/:subscriptionId
Remove queued subscription.
Auth apikey · Success 200
Path parameters
| Name | |
|---|---|
subscriptionId | Required |
curl -X DELETE 'https://api.leadx.in/api/key/protected/subscription/queued/SUBSCRIPTIONID' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/subscription/queued/SUBSCRIPTIONID', {
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(
'/subscription/queued/SUBSCRIPTIONID'
);
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/subscription/queued/SUBSCRIPTIONID',
{
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/subscription/queued/SUBSCRIPTIONID",
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/subscription/queued/SUBSCRIPTIONID');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
],
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$payload = json_decode($response, true);
if ($status >= 400) {
throw new RuntimeException("$status {$payload['message']}");
}
print_r($payload['data']);
POST /subscription/seats/change
Change seat upgrade.
Auth apikey · Success 200
:::note Used by the web app
pages/SeatManagement.jsx
:::
curl -X POST 'https://api.leadx.in/api/key/protected/subscription/seats/change' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/subscription/seats/change', {
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(
'/subscription/seats/change'
);
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/subscription/seats/change',
{
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/subscription/seats/change",
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/subscription/seats/change');
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']);
Errors SubscriptionNotFound_400
POST /subscription/seats/preview
Price a seat change before committing to it.
Auth apikey
:::note Used by the web app
pages/SeatManagement.jsx
:::
curl -X POST 'https://api.leadx.in/api/key/protected/subscription/seats/preview' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/subscription/seats/preview', {
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(
'/subscription/seats/preview'
);
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/subscription/seats/preview',
{
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/subscription/seats/preview",
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/subscription/seats/preview');
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 /subscription/upcoming
Get upcoming subscription changes.
Auth apikey
curl -X GET 'https://api.leadx.in/api/key/protected/subscription/upcoming' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/subscription/upcoming', {
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(
'/subscription/upcoming'
);
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/subscription/upcoming',
{
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/subscription/upcoming",
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/subscription/upcoming');
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']);