A Feature Flag controls feature availability for organizations and users in your application.
Get the details of an existing feature flag.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const featureFlag = await workos.featureFlags.getFeatureFlag('advanced-analytics'); console.log(featureFlag);
Get a list of all of your existing feature flags matching the criteria specified.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const featureFlags = await workos.featureFlags.listFeatureFlags(); console.log(featureFlags.data);
featureFlags .listFeatureFlags()Parameters objectReturns objectEnables a feature flag in the current environment.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const featureFlag = await workos.featureFlags.enableFeatureFlag('advanced-analytics'); console.log(featureFlag);
Disables a feature flag in the current environment.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const featureFlag = await workos.featureFlags.disableFeatureFlag('advanced-analytics'); console.log(featureFlag);