Feature
For instructions on how to authenticate to use this endpoint, see API overview.
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.
Endpoints
List all feature flags
Path Parameters
- project_idstring
Query Parameters
- limitinteger
- offsetinteger
Response
Request
GET
/api /projects /:project_id /feature_flags
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \https://app.posthog.com/api/projects/:project_id/feature_flags/
Response
RESPONSE
{"count": 123,"next": "http://api.example.org/accounts/?offset=400&limit=100","previous": "http://api.example.org/accounts/?offset=200&limit=100","results": [{"id": 0,"name": "string","key": "string","filters": {"property1": null,"property2": null},"deleted": true,"active": true,"created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","email": "user@example.com"},"created_at": "2019-08-24T14:15:22Z","is_simple_flag": true,"rollout_percentage": 0,"ensure_experience_continuity": true,"experiment_set": [0],"rollback_conditions": {"property1": null,"property2": null},"performed_rollback": true}]}
Create feature flags
Path Parameters
- project_idstring
Request Parameters
- namestring
contains the description for the flag (field name
name
is kept for backwards-compatibility) - keystring
- filtersobject
- deletedboolean
- activeboolean
- created_atstring
- ensure_experience_continuityboolean
- rollback_conditionsobject
- performed_rollbackboolean
Response
Request
POST
/api /projects /:project_id /feature_flags
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl-H 'Content-Type: application/json'\-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \https://app.posthog.com/api/projects/:project_id/feature_flags/\-d key="string"
Response
RESPONSE
{"id": 0,"name": "string","key": "string","filters": {"property1": null,"property2": null},"deleted": true,"active": true,"created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","email": "user@example.com"},"created_at": "2019-08-24T14:15:22Z","is_simple_flag": true,"rollout_percentage": 0,"ensure_experience_continuity": true,"experiment_set": [0],"rollback_conditions": {"property1": null,"property2": null},"performed_rollback": true}
Retrieve feature flags
Path Parameters
- idinteger
- project_idstring
Response
Request
GET
/api /projects /:project_id /feature_flags /:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \https://app.posthog.com/api/projects/:project_id/feature_flags/:id/
Response
RESPONSE
{"id": 0,"name": "string","key": "string","filters": {"property1": null,"property2": null},"deleted": true,"active": true,"created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","email": "user@example.com"},"created_at": "2019-08-24T14:15:22Z","is_simple_flag": true,"rollout_percentage": 0,"ensure_experience_continuity": true,"experiment_set": [0],"rollback_conditions": {"property1": null,"property2": null},"performed_rollback": true}
Update feature flags
Path Parameters
- idinteger
- project_idstring
Request Parameters
- namestring
contains the description for the flag (field name
name
is kept for backwards-compatibility) - keystring
- filtersobject
- deletedboolean
- activeboolean
- created_atstring
- ensure_experience_continuityboolean
- rollback_conditionsobject
- performed_rollbackboolean
Response
Request
PATCH
/api /projects /:project_id /feature_flags /:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl -X PATCH \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \https://app.posthog.com/api/projects/:project_id/feature_flags/:id/\-d name="string"
Response
RESPONSE
{"id": 0,"name": "string","key": "string","filters": {"property1": null,"property2": null},"deleted": true,"active": true,"created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","email": "user@example.com"},"created_at": "2019-08-24T14:15:22Z","is_simple_flag": true,"rollout_percentage": 0,"ensure_experience_continuity": true,"experiment_set": [0],"rollback_conditions": {"property1": null,"property2": null},"performed_rollback": true}
Delete feature flags
Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true
Path Parameters
- idinteger
- project_idstring
Request
DELETE
/api /projects /:project_id /feature_flags /:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl -X DELETE \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \https://app.posthog.com/api/projects/:project_id/feature_flags/:id/
Response
No responseRetrieve feature flags activity retrieve
Path Parameters
- idinteger
- project_idstring
Response
Request
GET
/api /projects /:project_id /feature_flags /:id /activity
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \https://app.posthog.com/api/projects/:project_id/feature_flags/:id/activity/
Response
RESPONSE
{"id": 0,"name": "string","key": "string","filters": {"property1": null,"property2": null},"deleted": true,"active": true,"created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","email": "user@example.com"},"created_at": "2019-08-24T14:15:22Z","is_simple_flag": true,"rollout_percentage": 0,"ensure_experience_continuity": true,"experiment_set": [0],"rollback_conditions": {"property1": null,"property2": null},"performed_rollback": true}
Retrieve feature flags activity
Path Parameters
- project_idstring
Response
Request
GET
/api /projects /:project_id /feature_flags /activity
export POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \https://app.posthog.com/api/projects/:project_id/feature_flags/activity/
Response
RESPONSE
{"id": 0,"name": "string","key": "string","filters": {"property1": null,"property2": null},"deleted": true,"active": true,"created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","email": "user@example.com"},"created_at": "2019-08-24T14:15:22Z","is_simple_flag": true,"rollout_percentage": 0,"ensure_experience_continuity": true,"experiment_set": [0],"rollback_conditions": {"property1": null,"property2": null},"performed_rollback": true}
Retrieve feature flags evaluation reasons
Path Parameters
- project_idstring
Response
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" \https://app.posthog.com/api/projects/:project_id/feature_flags/evaluation_reasons/
Response
RESPONSE
{"id": 0,"name": "string","key": "string","filters": {"property1": null,"property2": null},"deleted": true,"active": true,"created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","email": "user@example.com"},"created_at": "2019-08-24T14:15:22Z","is_simple_flag": true,"rollout_percentage": 0,"ensure_experience_continuity": true,"experiment_set": [0],"rollback_conditions": {"property1": null,"property2": null},"performed_rollback": true}
Retrieve feature flags local evaluation
Path Parameters
- project_idstring
Response
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" \https://app.posthog.com/api/projects/:project_id/feature_flags/local_evaluation/
Response
RESPONSE
{"id": 0,"name": "string","key": "string","filters": {"property1": null,"property2": null},"deleted": true,"active": true,"created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","email": "user@example.com"},"created_at": "2019-08-24T14:15:22Z","is_simple_flag": true,"rollout_percentage": 0,"ensure_experience_continuity": true,"experiment_set": [0],"rollback_conditions": {"property1": null,"property2": null},"performed_rollback": true}
Retrieve feature flags my flags
Path Parameters
- project_idstring
Response
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" \https://app.posthog.com/api/projects/:project_id/feature_flags/my_flags/
Response
RESPONSE
{"id": 0,"name": "string","key": "string","filters": {"property1": null,"property2": null},"deleted": true,"active": true,"created_by": {"id": 0,"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f","distinct_id": "string","first_name": "string","email": "user@example.com"},"created_at": "2019-08-24T14:15:22Z","is_simple_flag": true,"rollout_percentage": 0,"ensure_experience_continuity": true,"experiment_set": [0],"rollback_conditions": {"property1": null,"property2": null},"performed_rollback": true}