Segments
Base URL https://api.leadx.in/api/key/protected. Every request needs an apikey header — see Authentication.
6 endpoints.
GET /segment
Get all segment.
Auth apikey
:::note Used by the web app
components/CampaignSetup.jsx, pages/AddCategory.jsx, pages/AddSegment.jsx and 5 more
:::
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 Segment objects, alongside the pagination fields described in Response format. updatedBy, createdBy are populated, so they arrive as nested objects rather than ids.
POST /segment
Create segment.
Auth apikey · Success 200
:::note Used by the web app
components/CampaignSetup.jsx, pages/AddCategory.jsx, pages/AddSegment.jsx and 5 more
:::
Request body
| Field | Default |
|---|---|
name | — |
description | — |
filterType | — |
filters | [] |
isActive | — |
Required: name.
Response — data is one Segment object. (Resource deduced from the collections this handler reads, not read off an explicit return.)
Errors SegmentNameAlreadyExists_400
DELETE /segment
Delete segment.
Auth apikey · Success 200
:::note Used by the web app
components/CampaignSetup.jsx, pages/AddCategory.jsx, pages/AddSegment.jsx and 5 more
:::
Request body — the standard bulk selection: ids, nids, selectAll. Query-string filters apply when selectAll is set.
Response — data is null; the outcome is the status code and message.
GET /segment/:id
Get segment.
Auth apikey
:::note Used by the web app
pages/AddSegment.jsx
:::
Path parameters
| Name | |
|---|---|
id | Required |
Response — data is one Segment object. createdBy updatedBy is populated, so it arrives as nested objects rather than ids.
Errors SegmentNotFound_400
PUT /segment/:id
Update segment.
Auth apikey · Success 200
:::note Used by the web app
pages/AddSegment.jsx
:::
Path parameters
| Name | |
|---|---|
id | Required |
Response — data is one Segment object. createdBy updatedBy is populated, so it arrives as nested objects rather than ids.
GET /segment/execute
Resolve a segment to a count.
Auth apikey
Query parameters
| Field | Default | Notes |
|---|---|---|
ids | — | Documents to act on. |
Response — data is one Segment object. (Resource deduced from the collections this handler reads, not read off an explicit return.)