Feature

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

Endpoints

GET
GET
GET
POST

Retrieve feature flags local evaluation

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

  • send_cohorts
    booleannull
    Default: false

Response


Example request

GET /api/projects/:project_id/feature_flags/local_evaluation
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/local_evaluation/

Example response

Status 200
RESPONSE
{
"flags": [
{
"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"
]
}
],
"group_type_mapping": {
"property1": "string",
"property2": "string"
},
"cohorts": {}
}
Status 402 Payment required
Status 500 Internal server error

Retrieve feature flags local evaluation

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

  • send_cohorts
    booleannull
    Default: false

Response


Example request

GET /api/projects/:project_id/feature_flags/local_evaluation
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/local_evaluation/

Example response

Status 200
RESPONSE
{
"flags": [
{
"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"
]
}
],
"group_type_mapping": {
"property1": "string",
"property2": "string"
},
"cohorts": {}
}
Status 402 Payment required
Status 500 Internal server error

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 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

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

  • 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
}

Retrieve feature flags my 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

  • 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

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
}

Create feature flags 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
}

Community questions

Questions about this page? or post a community question.