Targeting allows you to enable Feature Flags for specific users or organizations. When a flag is enabled for a target, that target will receive the flag’s enabled value instead of the default value.
Get a list of all enabled feature flags for an organization.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const featureFlags = await workos.organizations.listOrganizationFeatureFlags({ organizationId: 'org_01EHZNVPK3SFK441A1RGBFSHRT', }); console.log(featureFlags.data);
{ "object": "list", "data": [ { "object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": "Enable advanced analytics dashboard feature", "owner": { "email": "jane@example.com", "first_name": "Jane", "last_name": "Doe" }, "tags": [ "reports" ], "enabled": true, "default_value": false, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" } ], "list_metadata": { "before": "flag_01HXYZ123456789ABCDEFGHIJ", "after": "flag_01HXYZ987654321KJIHGFEDCBA" } }
| curl "https://api.workos.com/organizations/org_01EHZNVPK3SFK441A1RGBFSHRT/feature-flags" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| import { WorkOS } from '@workos-inc/node'; | |
| const workos = new WorkOS('sk_example_123456789'); | |
| const featureFlags = await workos.organizations.listOrganizationFeatureFlags({ | |
| organizationId: 'org_01EHZNVPK3SFK441A1RGBFSHRT', | |
| }); | |
| console.log(featureFlags.data); |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.key = "sk_example_123456789" | |
| end | |
| feature_flags = WorkOS::Organizations.list_organization_feature_flags( | |
| organization_id: "org_01EHZNVPK3SFK441A1RGBFSHRT" | |
| ) |
| from workos import WorkOSClient | |
| workos_client = WorkOSClient( | |
| api_key="sk_example_123456789", client_id="client_123456789" | |
| ) | |
| feature_flags = workos_client.organizations.list_feature_flags( | |
| organization_id="org_01EHZNVPK3SFK441A1RGBFSHRT" | |
| ) |
| { | |
| "object": "list", | |
| "data": [ | |
| { | |
| "object": "feature_flag", | |
| "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", | |
| "slug": "advanced-analytics", | |
| "name": "Advanced Analytics", | |
| "description": "Enable advanced analytics dashboard feature", | |
| "owner": { | |
| "email": "jane@example.com", | |
| "first_name": "Jane", | |
| "last_name": "Doe" | |
| }, | |
| "tags": [ | |
| "reports" | |
| ], | |
| "enabled": true, | |
| "default_value": false, | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| } | |
| ], | |
| "list_metadata": { | |
| "before": "flag_01HXYZ123456789ABCDEFGHIJ", | |
| "after": "flag_01HXYZ987654321KJIHGFEDCBA" | |
| } | |
| } |
GET/organizations /:organizationId /feature-flagsParameters Returns objectGet a list of all enabled feature flags for the provided user. This includes feature flags enabled specifically for the user as well as any organizations that the user is a member of.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const featureFlags = await workos.userManagement.listUserFeatureFlags({ userId: 'user_01EHZNVPK3SFK441A1RGBFSHRT', }); console.log(featureFlags.data);
{ "object": "list", "data": [ { "object": "feature_flag", "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", "slug": "advanced-analytics", "name": "Advanced Analytics", "description": "Enable advanced analytics dashboard feature", "owner": { "email": "jane@example.com", "first_name": "Jane", "last_name": "Doe" }, "tags": [ "reports" ], "enabled": true, "default_value": false, "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z" } ], "list_metadata": { "before": "flag_01HXYZ123456789ABCDEFGHIJ", "after": "flag_01HXYZ987654321KJIHGFEDCBA" } }
| curl "https://api.workos.com/user_management/users/user_01E4ZCR3C56J083X43JQXF3JK5/feature-flags" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| import { WorkOS } from '@workos-inc/node'; | |
| const workos = new WorkOS('sk_example_123456789'); | |
| const featureFlags = await workos.userManagement.listUserFeatureFlags({ | |
| userId: 'user_01EHZNVPK3SFK441A1RGBFSHRT', | |
| }); | |
| console.log(featureFlags.data); |
| from workos import WorkOSClient | |
| workos_client = WorkOSClient( | |
| api_key="sk_example_123456789", client_id="client_123456789" | |
| ) | |
| feature_flags = workos_client.user_management.list_feature_flags( | |
| user_id="user_01EHZNVPK3SFK441A1RGBFSHRT" | |
| ) |
| { | |
| "object": "list", | |
| "data": [ | |
| { | |
| "object": "feature_flag", | |
| "id": "flag_01EHZNVPK3SFK441A1RGBFSHRT", | |
| "slug": "advanced-analytics", | |
| "name": "Advanced Analytics", | |
| "description": "Enable advanced analytics dashboard feature", | |
| "owner": { | |
| "email": "jane@example.com", | |
| "first_name": "Jane", | |
| "last_name": "Doe" | |
| }, | |
| "tags": [ | |
| "reports" | |
| ], | |
| "enabled": true, | |
| "default_value": false, | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| } | |
| ], | |
| "list_metadata": { | |
| "before": "flag_01HXYZ123456789ABCDEFGHIJ", | |
| "after": "flag_01HXYZ987654321KJIHGFEDCBA" | |
| } | |
| } |
GET/user_management /users /:userId /feature-flagsParameters Returns objectEnables a feature flag for a specific target in the current environment. Currently, supported targets include users and organizations.
curl --request POST \ --url https://api.workos.com/feature-flags/test-flag/targets/org_01EHZNVPK3SFK441A1RGBFSHRT \ --header "Authorization: Bearer sk_example_123456789"
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); await workos.featureFlags.addFlagTarget({ slug: 'test-flag', targetId: 'org_01EHZNVPK3SFK441A1RGBFSHRT', });
POST/feature-flags /:slug /targets /:resourceIdParameters Returns Removes a target from the feature flag’s target list in the current environment. Currently, supported targets include users and organizations.
curl --request DELETE \ --url https://api.workos.com/feature-flags/test-flag/targets/org_01EHZNVPK3SFK441A1RGBFSHRT \ --header "Authorization: Bearer sk_example_123456789"
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); await workos.featureFlags.removeFlagTarget({ slug: 'test-flag', targetId: 'org_01EHZNVPK3SFK441A1RGBFSHRT', });
DELETE/feature-flags /:slug /targets /:resourceIdParameters Returns