GET /api/feature-flags
Fetches feature flags and experiments for a user. This endpoint is called by the SDK to get the current state of feature flags.Request
Headers
Your API key
Query Parameters
The user’s ID (if user is identified)
The anonymous ID
JSON-encoded user properties for targeting (optional)
Example Request
Response
Success Response
Object mapping flag keys to flag objects
Object mapping experiment keys to experiment objects
ISO 8601 timestamp
Flag Object
Flag key
Whether the flag is enabled
Assigned variant (for experiments)
Flag value
Rollout percentage (0-100)
Experiment Object
Experiment key
Experiment name
Available variants
Assigned variant for this user
Experiment status
Example Response
Feature Flag Evaluation
Consistent Hashing
For percentage-based rollouts, use consistent hashing to ensure the same user always gets the same variant:Targeting Rules
Support targeting based on user properties:equals: Property equals valuenot_equals: Property does not equal valuecontains: Property contains value (for arrays/strings)not_contains: Property does not contain valuegreater_than: Property is greater than valueless_than: Property is less than valueis_set: Property existsis_not_set: Property does not exist
Best Practices
Caching
Caching
Cache feature flags to reduce database load. Refresh cache when flags are updated.
Consistent Assignment
Consistent Assignment
Use consistent hashing to ensure users always get the same variant.
Targeting
Targeting
Evaluate targeting rules based on user properties to determine flag values.
