Products & services
Base URL https://api.leadx.in/api/key/protected. Every request needs an apikey header — see Authentication.
5 endpoints.
GET /product-service
Get all product service.
Auth apikey
:::note Used by the web app
components/CustomField.jsx, components/TableWrapper.jsx, pages/AIGeniePage.jsx and 3 more
:::
Response — data is an array of ProductService objects, alongside the pagination fields described in Response format. (Resource deduced from the collections this handler reads, not read off an explicit return.)
curl -X GET 'https://api.leadx.in/api/key/protected/product-service' \
-H 'apikey: $LEADX_API_KEY'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/product-service', {
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(
'/product-service'
);
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/product-service',
{
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/product-service",
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/product-service');
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 /product-service
Create product service.
Auth apikey · Success 201
:::note Used by the web app
components/CustomField.jsx, components/TableWrapper.jsx, pages/AIGeniePage.jsx and 3 more
:::
Request body
| Field | Type | Default | Notes |
|---|---|---|---|
formData | object | {} | System and custom fields together — see Custom fields. |
Response — data is one ProductService object. (Resource deduced from the collections this handler reads, not read off an explicit return.)
curl -X POST 'https://api.leadx.in/api/key/protected/product-service' \
-H 'apikey: $LEADX_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"formData": {}
}'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/product-service', {
method: 'POST',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"formData": {}
}),
});
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(
'/product-service',
{
"formData": {}
}
);
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/product-service',
{
method: 'POST',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);
req.write(JSON.stringify(payload));
req.end();
});
const { data } = await send({
"formData": {}
});
console.log(data);
import os
import requests
res = requests.post(
"https://api.leadx.in/api/key/protected/product-service",
headers={"apikey": os.environ["LEADX_API_KEY"]},
json={
"formData": {}
},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/product-service');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({
'formData': {}
}),
]);
$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 InvalidCustomFieldValue_400 · InvalidCustomField_400 · InvalidSystemField_400 · ProductServiceDataRequired_400 · ProductServiceNameAlreadyExists_400
PUT /product-service
Bulk update product service.
Auth apikey · Success 200
:::note Used by the web app
components/CustomField.jsx, components/TableWrapper.jsx, pages/AIGeniePage.jsx and 3 more
:::
Request body — the standard bulk selection (ids, nids, selectAll) plus formData and updateType.
curl -X PUT 'https://api.leadx.in/api/key/protected/product-service' \
-H 'apikey: $LEADX_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"ids": [
"RESOURCE_ID"
],
"selectAll": false,
"formData": {},
"updateType": "set"
}'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/product-service', {
method: 'PUT',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"ids": [
"RESOURCE_ID"
],
"selectAll": false,
"formData": {},
"updateType": "set"
}),
});
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(
'/product-service',
{
"ids": [
"RESOURCE_ID"
],
"selectAll": false,
"formData": {},
"updateType": "set"
}
);
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/product-service',
{
method: 'PUT',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);
req.write(JSON.stringify(payload));
req.end();
});
const { data } = await send({
"ids": [
"RESOURCE_ID"
],
"selectAll": false,
"formData": {},
"updateType": "set"
});
console.log(data);
import os
import requests
res = requests.put(
"https://api.leadx.in/api/key/protected/product-service",
headers={"apikey": os.environ["LEADX_API_KEY"]},
json={
"ids": [
"RESOURCE_ID"
],
"selectAll": False,
"formData": {},
"updateType": "set"
},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/product-service');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({
'ids': [
'RESOURCE_ID'
],
'selectAll': false,
'formData': {},
'updateType': 'set'
}),
]);
$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 /product-service/:id
Get product service.
Auth apikey
Path parameters
| Name | |
|---|---|
id | Required |
Response — data is one ProductService object. company createdBy updatedBy is populated, so it arrives as nested objects rather than ids.
curl -X GET 'https://api.leadx.in/api/key/protected/product-service/PRODUCT_SERVICE_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/product-service/PRODUCT_SERVICE_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(
'/product-service/PRODUCT_SERVICE_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/product-service/PRODUCT_SERVICE_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/product-service/PRODUCT_SERVICE_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/product-service/PRODUCT_SERVICE_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']);
Errors ProductServiceNotFound_404
PUT /product-service/:id
Update product service.
Auth apikey · Success 200
Path parameters
| Name | |
|---|---|
id | Required |
Request body
| Field | Type | Default | Notes |
|---|---|---|---|
formData | object | {} | System and custom fields together — see Custom fields. |
tags | — | Tag ids. | |
category | string | — | Contact category id. |
Response — data is one ProductService object.
curl -X PUT 'https://api.leadx.in/api/key/protected/product-service/PRODUCT_SERVICE_ID' \
-H 'apikey: $LEADX_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"formData": {},
"tags": "",
"category": ""
}'
// Node 18+ and every modern browser ship fetch.
const res = await fetch('https://api.leadx.in/api/key/protected/product-service/PRODUCT_SERVICE_ID', {
method: 'PUT',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"formData": {},
"tags": "",
"category": ""
}),
});
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(
'/product-service/PRODUCT_SERVICE_ID',
{
"formData": {},
"tags": "",
"category": ""
}
);
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/product-service/PRODUCT_SERVICE_ID',
{
method: 'PUT',
headers: {
apikey: process.env.LEADX_API_KEY,
'Content-Type': 'application/json',
},
},
(res) => {
let raw = '';
res.on('data', (chunk) => { raw += chunk; });
res.on('end', () => {
const body = JSON.parse(raw);
if (res.statusCode >= 400) reject(new Error(`${res.statusCode} ${body.message}`));
else resolve(body);
});
},
);
req.on('error', reject);
req.write(JSON.stringify(payload));
req.end();
});
const { data } = await send({
"formData": {},
"tags": "",
"category": ""
});
console.log(data);
import os
import requests
res = requests.put(
"https://api.leadx.in/api/key/protected/product-service/PRODUCT_SERVICE_ID",
headers={"apikey": os.environ["LEADX_API_KEY"]},
json={
"formData": {},
"tags": "",
"category": ""
},
timeout=30,
)
payload = res.json()
res.raise_for_status()
print(payload["data"])
<?php
$ch = curl_init('https://api.leadx.in/api/key/protected/product-service/PRODUCT_SERVICE_ID');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'apikey: ' . getenv('LEADX_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({
'formData': {},
'tags': '',
'category': ''
}),
]);
$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 InvalidCustomFieldValue_400 · InvalidCustomField_400 · InvalidSystemField_400 · ProductServiceNameAlreadyExists_400 · ProductServiceNotFound_400