For the complete documentation index, see llms.txt. This page is also available as Markdown.

API Reference

Features enabled

get
/features/enabled

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.

Authorizations
AuthorizationstringRequired

Set the Authorization header to:

  Authorization: Bearer <publishable_key>
Query parameters
contextJsonstringOptional

JSON-encoded evaluation context. Preserves arrays and cannot be combined with legacy context.* parameters. The decoded value is limited to 16 KiB.

Example: {"user":{"id":"u2956","roles":["admin","editor"]},"company":{"id":"c123"}}
keystring · min: 1 · max: 255Optional

Feature key - unique identifier of the feature which you can find in app.reflag.com Example:

new-order-created
waitForVersionnumberOptional

The version number of the full environment flag state used by /features and waitForVersion.

Responses
200

OK

application/json

Standard response format for successful API calls

successboolean · enumRequired

Indicates if the request was successful

Possible values:
flagStateVersionnumberRequired

The version number of the full environment flag state used by /features and waitForVersion.

remoteContextUsedbooleanRequired

Indicates if the remote context was used

get/features/enabled
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,
  "flagStateVersion": 1,
  "features": {
    "ANY_ADDITIONAL_PROPERTY": {
      "key": "text",
      "targetingVersion": 1,
      "isEnabled": true,
      "optInEnabled": true,
      "optIn": {
        "userOptedIn": true,
        "companyOptedIn": true,
        "isOptedIn": true,
        "name": "text",
        "description": null
      },
      "stage": null,
      "config": {
        "name": null,
        "version": 1,
        "default": true,
        "payload": null,
        "ruleEvaluationResults": [
          true
        ],
        "evaluationErrors": [
          {
            "code": "MISSING_CONTEXT_FIELD",
            "field": "text",
            "operator": "text",
            "message": "text"
          }
        ]
      },
      "ruleEvaluationResults": [
        true
      ],
      "evaluationErrors": [
        {
          "code": "MISSING_CONTEXT_FIELD",
          "field": "text",
          "operator": "text",
          "message": "text"
        }
      ]
    }
  },
  "remoteContextUsed": true
}

Features

get
/features

Use this endpoint to get the list of all features with their targeting rules.

Authorizations
AuthorizationstringRequired

Set the Authorization header to:

Authorization: Bearer <secret_key>
Query parameters
waitForVersionnumberOptional

The version number of the full environment flag state used by /features and waitForVersion.

Responses
200

OK

application/json

Standard response format for successful API calls

successboolean · enumRequired

Indicates if the request was successful

Possible values:
flagStateVersionnumberRequired

The version number of the full environment flag state used by /features and waitForVersion.

get/features
GET /features HTTP/1.1
Host: front.reflag.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "success": true,
  "flagStateVersion": 1,
  "features": [
    {
      "key": "text",
      "description": null,
      "createdAt": "text",
      "link": null,
      "targeting": {
        "version": 1,
        "rules": [
          "[Circular Reference]"
        ]
      },
      "config": {
        "version": 1,
        "variants": [
          "[Circular Reference]"
        ]
      },
      "stage": null
    }
  ]
}

Features evaluated

get
/features/evaluated

Use this endpoint to get the list of all features evaluated for the user.

Authorizations
AuthorizationstringRequired

Set the Authorization header to:

  Authorization: Bearer <publishable_key>
Query parameters
contextJsonstringOptional

JSON-encoded evaluation context. Preserves arrays and cannot be combined with legacy context.* parameters. The decoded value is limited to 16 KiB.

Example: {"user":{"id":"u2956","roles":["admin","editor"]},"company":{"id":"c123"}}
keystring · min: 1 · max: 255Optional

Feature key - unique identifier of the feature which you can find in app.reflag.com Example:

new-order-created
waitForVersionnumberOptional

The version number of the full environment flag state used by /features and waitForVersion.

Responses
200

OK

application/json

Standard response format for successful API calls

successboolean · enumRequired

Indicates if the request was successful

Possible values:
flagStateVersionnumberRequired

The version number of the full environment flag state used by /features and waitForVersion.

remoteContextUsedbooleanRequired

Indicates if the remote context was used

get/features/evaluated
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,
  "flagStateVersion": 1,
  "features": {
    "ANY_ADDITIONAL_PROPERTY": {
      "key": "text",
      "targetingVersion": 1,
      "isEnabled": true,
      "optInEnabled": true,
      "optIn": {
        "userOptedIn": true,
        "companyOptedIn": true,
        "isOptedIn": true,
        "name": "text",
        "description": null
      },
      "stage": null,
      "config": {
        "name": null,
        "version": 1,
        "default": true,
        "payload": null,
        "ruleEvaluationResults": [
          true
        ],
        "evaluationErrors": [
          {
            "code": "MISSING_CONTEXT_FIELD",
            "field": "text",
            "operator": "text",
            "message": "text"
          }
        ]
      },
      "ruleEvaluationResults": [
        true
      ],
      "evaluationErrors": [
        {
          "code": "MISSING_CONTEXT_FIELD",
          "field": "text",
          "operator": "text",
          "message": "text"
        }
      ]
    }
  },
  "remoteContextUsed": true
}

Features events

post
/features/events

Use this endpoint to send feature events to Reflag.

Authorizations
AuthorizationstringRequired

Set the Authorization header to:

  Authorization: Bearer <publishable_key>
Body

Represents an event related to feature flag evaluation

actionstring · enumRequiredPossible values:
keystring · min: 1 · max: 255Required

Feature key - unique identifier of the feature which you can find in app.reflag.com Example:

new-order-created
targetingVersionnumberOptional

The version of the targeting rules. Every time when targeting rules are updated the version is incremented.

evalResultbooleanRequired

The result of the evaluation

evalRuleResultsboolean[]Optional

The results of evaluation for each of the rules

evalMissingFieldsstring[]Optional

The fields that were missing in the context for successful evaluation

Responses
200

OK

application/json

Standard response format for successful API calls

successboolean · enumRequired

Indicates if the request was successful

Possible values:
post/features/events
POST /features/events HTTP/1.1
Host: front.reflag.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 185

{
  "action": "check-is-enabled",
  "key": "text",
  "targetingVersion": 1,
  "evalContext": {
    "user": {},
    "company": {},
    "other": {}
  },
  "evalResult": true,
  "evalRuleResults": [
    true
  ],
  "evalMissingFields": [
    "text"
  ]
}
{
  "success": true
}

User

post
/user

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.

Authorizations
AuthorizationstringRequired

Set the Authorization header to:

  Authorization: Bearer <publishable_key>
Body

Represents a user entity with their attributes and metadata

userIdstring · min: 1Required

Unique identifier for the user

attributesobject · attributesOptional

Additional attributes of the user

timestampstring · date-timeOptional

Timestamp associated with the user data

Responses
200

OK

application/json

Standard response format for successful API calls

successboolean · enumRequired

Indicates if the request was successful

Possible values:
post/user
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": "2026-01-01T00:00:00.000Z"
}
{
  "success": true
}

Company

post
/company

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.

Authorizations
AuthorizationstringRequired

Set the Authorization header to:

  Authorization: Bearer <publishable_key>
Body

Represents a company entity with its attributes and associated user

userIdstring · min: 1Optional

Identifier for the user linked to the company

companyIdstring · min: 1Required

Unique identifier for the company

attributesobject · attributesOptional

Additional attributes of the company

timestampstring · date-timeOptional

Timestamp associated with the company data

Responses
200

OK

application/json

Standard response format for successful API calls

successboolean · enumRequired

Indicates if the request was successful

Possible values:
post/company
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": "2026-01-01T00:00:00.000Z"
}
{
  "success": true
}

Event

post
/event

Use this endpoint when you want to send a tracking events to Reflag.

Authorizations
AuthorizationstringRequired

Set the Authorization header to:

  Authorization: Bearer <publishable_key>
Body

Represents a tracking event with associated user, company, and metadata

userIdstring · min: 1Required

Identifier for the user initiating the event

eventstring · min: 1Required

The name of the generated event

attributesobject · attributesOptional

Additional event-related attributes

companyIdstring · min: 1Optional

Identifier for the company linked to the event

timestampstring · date-timeOptional

Timestamp associated with the event

Responses
200

OK

application/json

Standard response format for successful API calls

successboolean · enumRequired

Indicates if the request was successful

Possible values:
post/event
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": "2026-01-01T00:00:00.000Z"
}
{
  "success": true
}

Feedback

post
/feedback

Use this endpoint when you want to send feedback events to Reflag.

Authorizations
AuthorizationstringRequired

Set the Authorization header to:

  Authorization: Bearer <publishable_key>
Body

Represents user feedback data with associated context and metadata

feedbackIdstring · min: 1Optional

Unique identifier for updating existing feedback

userIdstring · min: 1Required

Identifier of the user providing feedback

companyIdstring · min: 1Optional

Identifier of the company linked to the feedback

promptIdstring · min: 10 · max: 40Optional

Identifier of the feedback prompt

featureIdstring · min: 1 · max: 14Optional

Identifier of the feature the feedback is related to

keystring · min: 1 · max: 255Optional

Feature key - unique identifier of the feature which you can find in app.reflag.com Example:

new-order-created
questionstring · min: 1 · max: 256Optional

In case the feedback is initiated by a prompt this will be the question which was asked

promptedQuestionstring · min: 1 · max: 256Optional

In case the feedback is initiated by a prompt this will be the question which was asked

sourcestring · enumOptional

The source of the feedback

Possible values:
scorenumber · max: 5Optional

The score of the feedback

commentstring · min: 1 · max: 4000Optional

The user's input

timestampstring · date-timeOptional

When the feedback was submitted

Responses
200

OK

application/json

Standard response format for successful API calls

successboolean · enumRequired

Indicates if the request was successful

Possible values:
post/feedback
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": "2026-01-01T00:00:00.000Z"
}
{
  "success": true
}

Bulk

post
/bulk

Use this endpoint when you want to send multiple events to Reflag.

Authorizations
AuthorizationstringRequired

Set the Authorization header to:

  Authorization: Bearer <publishable_key>
Bodyall of[]

A collection of different types of operations to be processed in bulk

and
anyOptional
or
or
or
or
Responses
200

OK

application/json

Standard response format for successful API calls

successboolean · enumRequired

Indicates if the request was successful

Possible values:
post/bulk
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": "2026-01-01T00:00:00.000Z"
  }
]
{
  "success": true
}

Rules schema

Attribute
Type
Description

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

Attribute
Type
Desription

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

Attribute
Type
Desription

type

negation

Negation filter is used to negate the evaluation result of the underlying filters.

filter

Filter

Filter object to be negated

Attribute
Type
Desription

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.

When the context field holds an array:

  • IS matches if the array has just one item equal to the value you chose. IS_NOT matches if it has more than one item, is empty, or its only item differs.

  • CONTAINS matches if the array includes the value you chose. NOT_CONTAINS matches if it does not.

  • ANY_OF matches if the array includes at least one of the values you chose. NOT_ANY_OF matches if it includes none.

  • SET matches arrays with at least one item. NOT_SET matches empty arrays.

These checks match whole values and treat uppercase and lowercase letters as different. For example, ["admin"] does not contain adm or Admin. Numeric and date operators, plus IS_TRUE and IS_FALSE, do not work with arrays.

See array attribute operators for examples.

Attribute
Type
Desription

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.

Attribute
Type
Desription

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?