Feature flags

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

POST
POST
POST
GET
GET
GET
POST

Create feature flags bulk delete

Bulk delete feature flags by filter criteria or explicit IDs.

Accepts either:

  • {"filters": {...}} - Same filter params as list endpoint (search, active, type, etc.)
  • {"ids": [...]} - Explicit list of flag IDs (no limit)

Returns same format as bulk_delete for UI compatibility.

Uses bulk operations for efficiency: database updates are batched and cache invalidation happens once at the end rather than per-flag.

Required API key scopes

feature_flag:write

Request parameters

  • filters
  • ids
    array

Response


Example request

POST /api/projects/:project_id/feature_flags/bulk_delete
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/feature_flags/bulk_delete/\
-d filters=undefined

Example response

Status 200
RESPONSE
{
"deleted": [
{
"id": 0,
"key": "string",
"rollout_state": "fully_rolled_out",
"active_variant": "string"
}
],
"errors": [
{
"id": null,
"key": "string",
"reason": "string"
}
]
}
Status 400 Invalid input — e.g., both filters and ids supplied, neither supplied, or unknown filter keys.
RESPONSE
{
"error": "string"
}

Create feature flags bulk keys

Get feature flag keys by IDs. Accepts a list of feature flag IDs and returns a mapping of ID to key.

Required API key scopes

feature_flag:read

Request parameters

  • ids
    array

Response


Example request

POST /api/projects/:project_id/feature_flags/bulk_keys
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/feature_flags/bulk_keys/\
-d ids="array"

Example response

Status 200
RESPONSE
{
"keys": {
"property1": "string",
"property2": "string"
},
"warning": "string"
}
Status 400 Invalid flag IDs provided.
RESPONSE
{
"error": "string"
}

Create feature flags bulk update tags

Bulk update tags on multiple objects.

PAT access: this action has no required_scopes= on the decorator — inheriting viewsets must add "bulk_update_tags" to their scope_object_write_actions list to accept personal API keys. Without that opt-in, APIScopePermission rejects PAT requests with "This action does not support personal API key access". Done per-viewset so granting <scope>:write for one resource doesn't leak access to sibling resources that share this mixin.

Accepts:

  • {"ids": [...], "action": "add"|"remove"|"set", "tags": ["tag1", "tag2"]}

Actions:

  • "add": Add tags to existing tags on each object
  • "remove": Remove specific tags from each object
  • "set": Replace all tags on each object with the provided list

Required API key scopes

feature_flag:write

Request parameters

  • ids
    array
  • action
  • tags
    array

Response


Example request

POST /api/projects/:project_id/feature_flags/bulk_update_tags
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/feature_flags/bulk_update_tags/\
-d ids="array",\
-d action=undefined,\
-d tags="array"

Example response

Status 200
RESPONSE
{
"updated": [
{
"id": 0,
"tags": [
"string"
]
}
],
"skipped": [
{
"id": 0,
"reason": "string"
}
]
}

Retrieve feature flags evaluation reasons

Also available via the PostHog MCP server:

  • feature-flags-evaluation-reasons-retrieveGet feature flag evaluation reasons

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.

Required API key scopes

feature_flag:read

Query parameters

  • distinct_id
    string
  • flag_keys
    array
  • groups
    string
    Default: {}

Example request

GET /api/projects/:project_id/feature_flags/evaluation_reasons
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/feature_flags/evaluation_reasons/

Example response

Status 200 No response body
Status 502 Flag evaluation service error
RESPONSE
{
"error": "string"
}
Status 503 Flag evaluation service temporarily unavailable
RESPONSE
{
"error": "string"
}

Retrieve feature flags matching ids

Get IDs of all feature flags matching the current filters. Uses the same filtering logic as the list endpoint. Returns only IDs that the user has permission to edit.

Required API key scopes

feature_flag:read

Example request

GET /api/projects/:project_id/feature_flags/matching_ids
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/feature_flags/matching_ids/

Example response

Status 200 No response body

Retrieve feature flags my flags

Also available via the PostHog MCP server:

  • feature-flags-my-flags-retrieveGet my evaluated 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.

Required API key scopes

feature_flag:read

Query parameters

  • flag_keys
    array
  • groups
    string
    Default: {}

Example request

GET /api/projects/:project_id/feature_flags/my_flags
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/feature_flags/my_flags/

Example response

Status 200
RESPONSE
{
"feature_flag": {
"id": 0,
"team_id": 0,
"name": "string",
"key": "string",
"filters": {},
"deleted": true,
"active": true,
"ensure_experience_continuity": true,
"version": -2147483648,
"evaluation_runtime": "server",
"bucketing_identifier": "distinct_id",
"evaluation_contexts": [
"string"
]
},
"value": null
}

Create feature flags user blast radius

Also available via the PostHog MCP server:

  • feature-flags-user-blast-radius-createGet user blast radius

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.

Required API key scopes

feature_flag:read

Request parameters

  • condition
    object
  • group_type_index
    integernull

Response


Example request

POST /api/projects/:project_id/feature_flags/user_blast_radius
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/feature_flags/user_blast_radius/\
-d condition="object"

Example response

Status 200
RESPONSE
{
"affected": 0,
"total": 0
}