API Reference
Use this endpoint to get the list of enabled features for the user. The response will contain the list of features that are enabled for the user.
Feature key - unique identifier of the feature which you can find in app.reflag.com Example:
new-order-created
OK
Bad request
function flattenObject(obj, prefix = '') {
return Object.keys(obj).reduce((acc, key) => {
const value = obj[key];
const newKey = prefix ? `${prefix}.${encodeURIComponent(key)}` : encodeURIComponent(key);
if (typeof value === 'object' && value !== null) {
Object.assign(acc, flattenObject(value, newKey));
} else {
acc[newKey] = encodeURIComponent(value);
}
return acc;
}, {});
}
function encodeQueryParams(deepObject) {
const flattened = flattenObject(deepObject);
return Object.keys(flattened)
.map(key => `${key}=${flattened[key]}`)
.join('&');
}
const params = {
context: {
user: {
id: 'u2956',
role: 'developer',
},
company: {
id: 'c123',
name: 'Example Inc',
country: 'US',
},
},
};
// Perform the GET request using fetch
const res = await fetch(`https://front.reflag.com/features/enabled?${encodeQueryParams(params)}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer <your_public_key>`,
},
});
const data = await res.json();
console.log(data);
{
"success": true,
"features": {
"ANY_ADDITIONAL_PROPERTY": {
"key": "text",
"targetingVersion": 1,
"isEnabled": true,
"stage": null,
"config": {
"name": null,
"version": 1,
"default": true,
"payload": null,
"ruleEvaluationResults": [
true
],
"missingContextFields": [
"text"
]
},
"ruleEvaluationResults": [
true
],
"missingContextFields": [
"text"
]
}
},
"remoteContextUsed": true
}Use this endpoint to get the list of all features with their targeting rules.
OK
Bad request
GET /features HTTP/1.1
Host: front.reflag.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"success": true,
"features": [
{
"key": "text",
"description": null,
"createdAt": "text",
"link": null,
"targeting": {
"version": 1,
"rules": [
"[Circular Reference]"
]
},
"config": {
"version": 1,
"variants": [
"[Circular Reference]"
]
},
"stage": null
}
]
}Use this endpoint to get the list of all features evaluated for the user.
Feature key - unique identifier of the feature which you can find in app.reflag.com Example:
new-order-created
OK
Bad request
function flattenObject(obj, prefix = '') {
return Object.keys(obj).reduce((acc, key) => {
const value = obj[key];
const newKey = prefix ? `${prefix}.${encodeURIComponent(key)}` : encodeURIComponent(key);
if (typeof value === 'object' && value !== null) {
Object.assign(acc, flattenObject(value, newKey));
} else {
acc[newKey] = encodeURIComponent(value);
}
return acc;
}, {});
}
function encodeQueryParams(deepObject) {
const flattened = flattenObject(deepObject);
return Object.keys(flattened)
.map(key => `${key}=${flattened[key]}`)
.join('&');
}
const params = {
context: {
user: {
id: 'u2956',
role: 'developer',
},
company: {
id: 'c123',
name: 'Example Inc',
country: 'US',
},
},
};
// Perform the GET request using fetch
const res = await fetch(`https://front.reflag.com/features/evaluated?${encodeQueryParams(params)}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer <your_public_key>',
},
});
const data = await res.json();
console.log(data);
{
"success": true,
"features": {
"ANY_ADDITIONAL_PROPERTY": {
"key": "text",
"targetingVersion": 1,
"isEnabled": true,
"stage": null,
"config": {
"name": null,
"version": 1,
"default": true,
"payload": null,
"ruleEvaluationResults": [
true
],
"missingContextFields": [
"text"
]
},
"ruleEvaluationResults": [
true
],
"missingContextFields": [
"text"
]
}
},
"remoteContextUsed": true
}Use this endpoint to send feature events to Reflag.
Represents an event related to feature flag evaluation
Feature key - unique identifier of the feature which you can find in app.reflag.com Example:
new-order-created
The version of the targeting rules. Every time when targeting rules are updated the version is incremented.
The result of the evaluation
The results of evaluation for each of the rules
The fields that were missing in the context for successful evaluation
OK
Bad request
POST /features/events HTTP/1.1
Host: front.reflag.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 176
[
{
"action": "check-is-enabled",
"key": "text",
"targetingVersion": 1,
"evalContext": {
"user": {},
"company": {}
},
"evalResult": true,
"evalRuleResults": [
true
],
"evalMissingFields": [
"text"
]
}
]{
"success": true
}Use this endpoint when you want to send user attributes to Reflag. If the user does not exist, it will be created. This endpoint is also used whenever you construct Reflag client in any of the SDKs.
Represents a user entity with their attributes and metadata
Unique identifier for the user
Additional attributes of the user
Timestamp associated with the user data
OK
Bad request
POST /user HTTP/1.1
Host: front.reflag.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 72
{
"userId": "text",
"attributes": {},
"timestamp": "2025-10-30T16:40:08.239Z"
}{
"success": true
}Use this endpoint when you want to send company attributes to Reflag. If the company does not exist, it will be created. You can also use this endpoint to assign user to a company by including the user ID. This endpoint is also used whenever you construct Reflag client in any of the SDKs.
Represents a company entity with its attributes and associated user
Identifier for the user linked to the company
Unique identifier for the company
Additional attributes of the company
Timestamp associated with the company data
OK
Bad request
POST /company HTTP/1.1
Host: front.reflag.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 91
{
"userId": "text",
"companyId": "text",
"attributes": {},
"timestamp": "2025-10-30T16:40:08.239Z"
}{
"success": true
}Use this endpoint when you want to send a tracking events to Reflag.
Represents a tracking event with associated user, company, and metadata
Identifier for the user initiating the event
The name of the generated event
Additional event-related attributes
Identifier for the company linked to the event
Timestamp associated with the event
OK
Bad request
POST /event HTTP/1.1
Host: front.reflag.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 106
{
"userId": "text",
"event": "text",
"attributes": {},
"companyId": "text",
"timestamp": "2025-10-30T16:40:08.239Z"
}{
"success": true
}Use this endpoint when you want to send feedback events to Reflag.
Represents user feedback data with associated context and metadata
Unique identifier for updating existing feedback
Identifier of the user providing feedback
Identifier of the company linked to the feedback
Identifier of the feedback prompt
Identifier of the feature the feedback is related to
Feature key - unique identifier of the feature which you can find in app.reflag.com Example:
new-order-created
In case the feedback is initiated by a prompt this will be the question which was asked
In case the feedback is initiated by a prompt this will be the question which was asked
The source of the feedback
The score of the feedback
The user's input
When the feedback was submitted
OK
Bad request
POST /feedback HTTP/1.1
Host: front.reflag.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 231
{
"feedbackId": "text",
"userId": "text",
"companyId": "text",
"promptId": "text",
"featureId": "text",
"key": "text",
"question": "text",
"promptedQuestion": "text",
"source": "api",
"score": 1,
"comment": "text",
"timestamp": "2025-10-30T16:40:08.239Z"
}{
"success": true
}Use this endpoint when you want to send multiple events to Reflag.
A collection of different types of operations to be processed in bulk
A single item in a bulk operation request that can be of different types
OK
Bad request
POST /bulk HTTP/1.1
Host: front.reflag.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 88
[
{
"type": "user",
"userId": "text",
"attributes": {},
"timestamp": "2025-10-30T16:40:08.239Z"
}
]{
"success": true
}Rules schema
filter
Filter
Object containing filtering rules which will evaluate against context object. Filter can be an instance of 5 different filter types described below.
Filter Schema
type
group
Filter group will evaluate by applying a logical operation to the array of filters provided
filters
Filter[]
Array of filters
operator
enum(and, or)
Logical operation
type
negation
Negation filter is used to negate the evaluation result of the underlying filters.
filter
Filter
Filter object to be negated
type
context
field
string
Refers to a field of the context object. Example: company.tier
values
string[]
Array of values which will be compared with the value of the context field. Operators SET, NOT_SET, IS_TRUE, IS_FALSE require 0 values, ANY_OF and NOT_ANY_OF support multiple values. All the other operators require exactly one value.
operator
enum(IS,IS_NOT,ANY_OF,NOT_ANY_OF,CONTAINS,NOT_CONTAINS","GT" ,LT,AFTER,BEFORE,SET,NOT_SET,IS_TRUE,IS_FALSE)
Operator for comparison of the context field with provided values.
type
rolloutPercentage
Rollout percentage filter is used for gradual rollouts. It evaluates to true or false proportionally based on the rollout threshold provided. Reflag evaluates the filter by calculating a numeric hash from the rollout attribute. Contexts of which hash is under the threshold provided will evaluate to true.
partialRolloutAttribute
company.id
Currently only "company.id" is supported.
partialRolloutThreshold
number
Number from 0 to 10000 where 0 means no one will have access and 10000 means everyone will have access.
type
constant
Filter constant will evaluate to the value provided. This is expected when the feature is enabled either for everyone or no one.
value
boolean
Value to which the filter should evaluate
Last updated
Was this helpful?