feature_flags

Create, read, update and delete feature flags. See docs for more information on feature flags.

If you're looking to use feature flags on your application, you can either use our JavaScript Library or our dedicated endpoint to check if feature flags are enabled for a given user.

patch/api/projects/{project_id}/feature_flags/{id}/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/feature_flags/{id}/
  • Auth: HTTP bearer

Path parameters

idinteger required

A unique integer value identifying this feature flag.

project_idstring required

Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Request body

keystring

Feature flag key.

namestring

Feature flag description (stored in the name field for backwards compatibility).

activeboolean

Whether the feature flag is active.

archivedboolean

Whether the flag is archived. Archived flags are hidden from the flag list by default and must be disabled (active: false).

tagsstring[]

Organizational tags for this feature flag.

evaluation_contextsstring[]

Evaluation contexts that control where this flag evaluates at runtime.

is_remote_configurationboolean nullable

Whether this flag is a remote configuration flag that delivers a payload rather than gating a feature.

ensure_experience_continuityboolean nullable

Whether to persist a user's flag value across the anonymous-to-identified transition (the 'persist across authentication steps' option). Incompatible with device_id bucketing.

Response

idinteger required
namestring

contains the description for the flag (field name name is kept for backwards-compatibility)

keystring required
filtersobject
deletedboolean
activeboolean
archivedboolean

Whether the flag is archived. Archived flags are hidden from the flag list by default and must be disabled (active: false).

created_atstring date-time required
updated_atstring date-time nullable required
versioninteger
ensure_experience_continuityboolean nullable
experiment_setinteger[] required
surveysobject required
featuresobject required
can_editboolean required
usage_dashboardinteger nullable required

Legacy dashboard of saved usage insights for this flag, or null if it has none. Usage charts are on the flag's Usage tab. The API does not create these dashboards.

analytics_dashboardsinteger[]
has_enriched_analyticsboolean nullable
user_access_levelstring nullable required

The effective access level the user has for this object

creation_context'feature_flags' | 'experiments' | 'surveys' | 'early_access_features' | 'web_experiments' | 'product_tours'
  • feature_flags - feature_flags
  • experiments - experiments
  • surveys - surveys
  • early_access_features - early_access_features
  • web_experiments - web_experiments
  • product_tours - product_tours
is_remote_configurationboolean nullable
has_encrypted_payloadsboolean nullable
statusstring required

Staleness classification: ACTIVE, STALE, ARCHIVED, DELETED or UNKNOWN. This is not the serving state. Read the active field for that. A disabled flag that is not archived or deleted reports ACTIVE, because disabled flags are not evaluated for staleness.

last_called_atstring date-time nullable required

Last time this feature flag was called (from $feature_flag_called events)

_create_in_folderstring
is_used_in_replay_settingsboolean required

Check if any team gates session recording on this flag, by linked flag or trigger group.

is_eligible_for_experimentboolean required

Whether this flag can back an experiment: multivariate with 2 to 20 variants.

Changes

No recorded changes to this operation across all 1 revision of this API.