User Schema
The User Schema API provides schema discovery for user properties, enabling dynamic segment building and user targeting in your loyalty campaigns.
Overview
The User Schema endpoint returns a comprehensive schema of all available user properties for your organization, combining:
Standard Properties - 23 built-in properties available to all organizations
Custom Fields - Organisation-specific fields defined via the Custom Fields API
Integration Properties - Data from connected systems (CRM, CDP, etc.)
This enables:
Dynamic segment builder UIs
API-driven segmentation
Self-documenting user properties
Type-safe filtering and targeting
Endpoints
Get User Schema
Retrieve all available user properties for segmentation and filtering.
Endpoint: GET /users/schema
Query Parameters:
includeInactive
boolean
No
Include inactive custom fields (default: false)
Example Request:
Example Response:
Property Types
Standard Properties (23 built-in)
Identity
userId- Unique user identifieremail- User email addresscreatedAt- Registration datelastActiveAt- Last activity timestamp
Loyalty
tier- Current loyalty tier (bronze, silver, gold, platinum, diamond)points- Current points balancelifetimePoints- Total points earned all-timexp- Experience pointslevel- User level based on XPcoins- Coins balance
Achievements
badges- Array of earned badge IDsbadgeCount- Total badges earned
Engagement
streak- Current consecutive days activelongestStreak- Longest streak achievedtransactionCount- Total transactions
Location
country- ISO 3166-1 alpha-2 country codecity- User citytimezone- User timezone
Preferences
language- ISO 639-1 language code
Social
referralCount- Number of users referredreferredBy- User ID of referrer
Metadata
segments- Array of segment IDstags- Custom tags array
Custom Field Properties
Properties defined via the Custom Fields API are automatically included with:
Namespace: Prefixed with
custom.(e.g.,custom.favorite_team)Type Mapping: Field types map to appropriate operators
Options: Select and multi-select fields include available options
Source Tracking: Includes
fieldIdfor reference
Integration Properties (Future)
Properties from connected systems:
Salesforce:
integration.salesforce.account_typeHubSpot:
integration.hubspot.lifecycle_stageSegment:
integration.segment.computed_traits
Operators
Each property type supports specific operators:
String Operators
equals- Exact matchnotEquals- Not equalcontains- Contains substringnotContains- Does not containstartsWith- Starts withendsWith- Ends within- One of (list)notIn- Not one of (list)
Number Operators
equals- Exact matchnotEquals- Not equalgreaterThan- Greater thanlessThan- Less thanbetween- Between two values
Date Operators
equals- Exact date matchbefore- Before dateafter- After datebetween- Between two dates
Array Operators
contains- Contains itemnotContains- Does not containcontainsAll- Contains all itemscontainsAny- Contains any item
Existence Operators
exists- Field has a valuenotExists- Field is null/undefined
Categories
Properties are organized into logical categories:
identity
Basic user identification
userId, email, createdAt
loyalty
Points, tiers, and rewards
tier, points, lifetimePoints
achievements
Badges and accomplishments
badges, badgeCount
engagement
Activity and participation
streak, transactionCount
segmentation
Segment membership
segments
location
Geographic information
country, city, timezone
preferences
User preferences
language
social
Referrals and connections
referralCount, referredBy
metadata
Custom tags and data
tags
custom
Organisation-defined fields
custom.*
integration
Connected system data
integration.*
Use Cases
Dynamic Segment Builder UI
Build a segment builder that adapts to your organization's schema:
Campaign Targeting
Use schema to validate targeting criteria:
API-Driven Segmentation
Discover and use properties programmatically:
Type-Safe Filtering
Use operator information to build type-safe filters:
Integration with Custom Fields
Custom fields defined via the Custom Fields API are automatically included in the schema:
Step 1: Create Custom Field
Step 2: Retrieve Schema
Result:
Schema Evolution
The schema adapts to your organization:
Add Custom Field → Automatically appears in schema
Update Field Options → Options refresh in schema
Delete Custom Field → Removed from schema (unless
includeInactive=true)Connect Integration → Integration properties added automatically
Best Practices
Cache Schema: Cache the schema response for 5-10 minutes to reduce API calls
Category Organisation: Group properties by category in your UI for better UX
Operator Validation: Check
operatorsarray before allowing filter operationsCustom Field Namespace: Always prefix custom fields with
custom.in criteriaType Safety: Use
typefield to render appropriate input controls (text, number, select)Example Usage: Reference the
examplesarray for common segment patternsSource Tracking: Use
sourcefield to distinguish between standard, custom, and integration properties
Error Responses
401 Unauthorized:
500 Internal Server Error:
Schema Response Example
Full example showing all three property sources:
Last updated

