Skip to content

System Administration

Web Hooks

You can use the Web Hooks to send events from Flagsmith into your own infrastructure. Web Hooks are managed at an Environment level, and can be configured in the Environment settings page.

Currently the following events will generate a Web Hook action:

  • Creating Flags (Sent as event_type FLAG_UPDATED)
  • Updating Flag state for both Flags and Remote Config (Sent as event_type FLAG_UPDATED)
  • Deleting Flags (Sent as event_type FLAG_UPDATED)

You can define any number of Web Hook endpoints per Environment. Web Hooks can be managed from the Environment settings page.

A typical use case for Web Hooks is if you want to cache flag state locally within your server environment.

Each event generates an HTTP POST with the following body payload to each of the Web Hooks defined within that Environment:

 {
  "data": {
    "changed_by": "Some User",
    "new_state": {
      "enabled": true,
      "environment": 23,
      "feature": {
        "created_date": "2020-02-25T22:11:16.355547Z",
        "default_enabled": false,
        "description": null,
        "id": 2411,
        "initial_value": "blue",
        "name": "feature_name",
        "project": 12,
        "type": "FLAG|CONFIG"
      },
      "feature_segment": null,
      "feature_state_value": null,
      "id": 10430,
      "identity": null,
      "identity_identifier": null
    },
    "previous_state": {
    "enabled": false,
      "environment": 23,
      "feature": {
        "created_date": "2020-02-25T22:11:16.355547Z",
        "default_enabled": false,
        "description": null,
        "id": 2411,
        "initial_value": "red",
        "name": "feature_name",
        "project": 12,
        "type": "FLAG|CONFIG"
      },
      "feature_segment": null,
      "feature_state_value": null,
      "id": 10430,
      "identity": null,
      "identity_identifier": null
    },
    "timestamp": "2020-03-07T13:59:07.040Z"
  },
  "event_type": "FLAG_UPDATED"
}

Audit Log Webhooks

You can use Audit Log Webhooks to stream your Organisation's Audit Log into your own infrastructure. This can be useful for compliance or to reference against local CI/CD infrastructure.

{
  "created_date": "2020-02-23T17:30:57.006318Z",
  "log": "New Flag / Remote Config created: my_feature",
  "author": {
    "id": 3,
    "email": "user@domain.com",
    "first_name": "Kyle",
    "last_name": "Johnson"
  },
  "environment": null,
  "project": {
    "id": 6,
    "name": "Project name",
    "organisation": 1
  },
  "related_object_id": 6,
  "related_object_type": "FEATURE"
}

Full API Access

The client SDK libraries are designed solely for end client use, and do not have an interface to the full Flagsmith API. However, you can easily access the full API by generating an Admin API Token and passing that in your requests.

Generating an Admin API token for your Environment

You can generate Admin API tokens on a per Environment basis, from the Environment Settings page. Only Organisation Administrators can generate or view Admin API tokens. Once you have generated a token, you can use them by passing in the header HTTP_X_API_KEY: <Admin API Key>

curl -X "GET" "https://api.flagsmith.com/v1/environments/" \
     -H 'HTTP_X_API_KEY: <Admin API Key>' \
  }'