Segments

Create and manage user segments with include and exclude criteria for targeted campaigns

Segments allow you to create dynamic or static groups of users based on criteria such as tier, points, badges, custom fields, and more. Segments can be used in campaigns, rewards, and other loyalty mechanics to target specific user groups.

Overview

Segment Types:

  • Dynamic: Automatically includes users matching criteria

  • Static: Fixed list of user IDs

Key Features:

  • Include AND Exclude clauses for precise targeting

  • Support for multiple criteria (tier, points, badges, custom fields, dates)

  • Used in campaigns, rewards, benefits, and quizzes

  • Real-time segment evaluation


Endpoints

List Segments

GET /v1/segments

Retrieve all segments for your organization.

Query Parameters:

  • limit (optional): Number of results (default: 50, max: 100)

  • type (optional): Filter by type (static or dynamic)

Response:


Create Segment

POST /v1/segments

Create a new user segment with include and exclude criteria.

Request Body:

Supported Operators:

  • equals / not_equals

  • in / not_in (for arrays)

  • contains / not_contains (for string/array fields)

  • >= / > / <= / < (for numeric fields)

  • exists / not_exists (check field presence)

Common Fields:

  • tier - User tier (bronze, silver, gold, platinum)

  • points - Total points balance

  • xp - Experience points

  • coins - Coins balance

  • badges - Array of badge IDs

  • email - User email

  • customFields.* - Any custom field (e.g., customFields.vip)

  • createdAt - Account creation date

  • updatedAt - Last profile update date

Optional Fields:

  • url - Optional URL linking to external resource or campaign page (e.g., quiz, experience, landing page). This field is purely informational and not used in segment evaluation.

Response (201 Created):


Get Segment

GET /v1/segments/{segmentId}

Retrieve details of a specific segment.

Response:


Update Segment

PUT /v1/segments/{segmentId}

Update an existing segment's criteria, name, or description.

Request Body:

Response:


Delete Segment

DELETE /v1/segments/{segmentId}

Delete a segment. Note: This will not affect campaigns or rules currently using this segment.

Response:


Using Segments in Campaigns

Segments can be referenced in campaign rules to target specific user groups.

Example Campaign with Segment:


Include vs Exclude Logic

Include Criteria (AND logic)

Users must match ALL include criteria to be in the segment.

Example: "Gold OR Platinum tier AND 1000+ points"

Exclude Criteria (AND logic with NOT)

Users matching ANY exclude criteria are removed from the segment.

Example: "NOT bronze tier AND NOT banned"

Combined Example

Segment: "Engaged VIPs (excluding test accounts)"

Logic: (Gold OR Platinum) AND (Points >= 1000) AND (Email Verified) AND NOT (Test Account) AND NOT (Employee) AND NOT (Banned or Suspended)


Common Use Cases

1. Reward High-Value Non-Test Users

2. Re-engagement Campaign (Inactive Users)

3. Quiz Eligibility (First-time Participants)

4. Premium Benefits (Paid Members Only)


Segment Evaluation

Dynamic Segments

  • Evaluated in real-time when used in campaigns/rules

  • User membership can change as their profile updates

  • No manual refresh required

Static Segments

  • Fixed list of user IDs

  • Must be manually updated via API

  • Useful for one-time campaigns or manual selections

Estimated Size

The estimatedSize field represents an approximation of users matching the segment criteria:

  • For Dynamic Segments: Calculated periodically (not real-time) by querying user profiles matching the criteria. This is an estimate and may not reflect the exact current count.

  • For Static Segments: Equals the number of user IDs in the segment's fixed list.

  • Initial Value: Set to 0 when a segment is first created. Updated during background processing.

  • Update Frequency: Refreshed periodically (typically every few hours) for dynamic segments.

  • Use Case: Useful for campaign planning and understanding segment reach, but should not be relied upon for exact counts.

Note: For real-time, exact user counts, use the Audience API's search endpoint with the same criteria.

Performance Considerations

  • Segments with many criteria may take longer to evaluate

  • Use indexed fields (tier, points, userId) when possible

  • Limit to 10 criteria per segment for optimal performance

  • Consider caching segment results for high-traffic campaigns


API Limits

Operation
Limit

Segments per organization

1,000

Criteria per segment

20

Exclude criteria per segment

20

Users per static segment

100,000


Error Responses

400 Bad Request:

404 Not Found:



Support

For questions about segments:

Last updated