Skip to content

Overview

Segments group users and companies for targeted feature rollouts. Use segments to beta-test features with specific customers, enable internal testing, or create VIP access lists.

Base URL

/api/platform/segments

NOTE

These endpoints require authentication with a Super Admin account.


Endpoints

List Segments

http
GET /api/platform/segments

Response 200 OK

json
[
  {
    "id": "clx1234...",
    "name": "beta-testers",
    "description": "Early access customers",
    "isActive": true,
    "userIds": ["user-123", "user-456"],
    "companyIds": ["company-789"],
    "updatedAt": "2025-12-01T00:00:00.000Z"
  }
]

Get Segment

http
GET /api/platform/segments/:id

Parameters

NameTypeDescription
idstringSegment ID

Response 200 OK - Full segment object
Response 404 Not Found - Segment not found


Create Segment

http
POST /api/platform/segments

Request Body

json
{
  "name": "internal-team",
  "description": "Internal development and QA team",
  "userIds": ["user-123"],
  "companyIds": [],
  "isActive": true
}
FieldTypeRequiredDescription
namestringUnique segment name
descriptionstringHuman-readable description
userIdsstring[]User IDs to include (default: [])
companyIdsstring[]Company IDs to include (default: [])
isActivebooleanWhether segment is active (default: true)

Response 201 Created

json
{
  "id": "clx1234...",
  "name": "internal-team"
}

Update Segment

http
PUT /api/platform/segments/:id

Request Body - All fields optional

json
{
  "name": "updated-name",
  "description": "Updated description",
  "userIds": ["user-123", "user-456"],
  "companyIds": ["company-789"],
  "isActive": false
}

Response 200 OK - Updated segment object
Response 404 Not Found - Segment not found


Delete Segment

http
DELETE /api/platform/segments/:id

Response 200 OK

json
{
  "success": true
}

WARNING

Deleting a segment also removes all feature flag associations (cascading delete).


Helper Endpoints

These endpoints support the UI's multi-select components for adding users/companies to segments.

Search Companies

http
GET /api/platform/segments/search-companies?q=tech&limit=50

Query Parameters

NameTypeDefaultDescription
qstring-Search query (searches name and ID)
limitnumber50Max results to return

Response 200 OK

json
[
  {
    "id": "company-123",
    "label": "TechFlow MSP",
    "description": "professional plan"
  }
]

Search Users

http
GET /api/platform/segments/search-users?q=john&limit=50

Query Parameters

NameTypeDefaultDescription
qstring-Search query (searches email, name, ID)
limitnumber50Max results to return

Response 200 OK

json
[
  {
    "id": "user-123",
    "label": "john@example.com",
    "description": "John Smith"
  }
]

Resolve Company IDs

http
POST /api/platform/segments/resolve-companies

Request Body

json
{
  "ids": ["company-123", "company-456"]
}

Response 200 OK - Array of { id, label, description } objects


Resolve User IDs

http
POST /api/platform/segments/resolve-users

Request Body

json
{
  "ids": ["user-123", "user-456"]
}

Response 200 OK - Array of { id, label, description } objects


See Also

TendSocial Documentation