# Flagsmith

> Manage Flagsmith feature flags, environments, segments and tags, turn flags on or off and change their values, read the audit log, and follow new flags, flag changes and audit log entries.

App · 24 actions. Web page: https://docs.lodol.com/docs/integrations/flagsmith

## Actions

### Create environment

Add an environment to a project. Its flags start from each feature's defaults.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.
- Name (`name`, text, required): The environment's name, such as Staging.
- Description (`description`, text): What the environment is for.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "allow_client_traits": true,
    "api_key": "example",
    "description": "example",
    "hide_disabled_flags": true,
    "id": 1,
    "name": "example",
    "project": 1,
    "use_v2_feature_versioning": true,
    "uuid": "example"
  }
}
```

### Create feature flag

Create a feature flag in a project, with the state and value every environment starts with.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.
- Name (`name`, text, required): The flag's name, used in code, such as new_checkout. It can't be changed later.
- Description (`description`, text): What the flag is for.
- On by default (`default_enabled`, true/false): Whether the flag starts on in every environment. Leave empty for off.
- Initial value (`initial_value`, text): The value the flag starts with in every environment, for remote config.
- Tags (`tag_ids`, list): Tags to put on the feature flag.
- Server-side only (`is_server_key_only`, true/false): Hide the flag from client-side SDKs, so only server-side keys can read it.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "created_date": "example",
    "default_enabled": true,
    "description": "example",
    "environment_feature_state": {
      "enabled": true,
      "environment": 1,
      "feature_segment": 1,
      "feature_state_value": "example",
      "id": 1,
      "identity": 1
    },
    "group_owners": [
      1
    ],
    "id": 1,
    "initial_value": "example",
    "is_archived": true,
    "is_server_key_only": true,
    "last_modified_in_any_environment": "example",
    "lifecycle_stage": "example",
    "name": "example",
    "num_identity_overrides": 1,
    "num_segment_overrides": 1,
    "owners": [
      1
    ],
    "project": 1,
    "tags": [
      1
    ],
    "type": "example",
    "uuid": "example"
  }
}
```

### Create segment

Create a segment of users who match all, or any, of the conditions given on their traits.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.
- Name (`name`, text, required): The segment's name, such as beta_testers.
- Description (`description`, text): Who the segment is.
- Users match (`match`, text): Whether users must match all the conditions or any one of them. Leave empty for all. One of: `ALL` (All of the conditions), `ANY` (Any of the conditions).
- Conditions (`conditions`, list, required): Each condition: the trait (property), how it compares (operator, such as EQUAL or CONTAINS) and the value.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "created_at": "example",
    "description": "example",
    "feature": 1,
    "id": 1,
    "name": "example",
    "project": 1,
    "rules": [
      {
        "conditions": [
          {
            "description": "example",
            "operator": "example",
            "property": "example",
            "value": "example"
          }
        ],
        "id": 1,
        "rules": [
          {
            "conditions": [
              {
                "description": "example",
                "operator": "example",
                "property": "example",
                "value": "example"
              }
            ],
            "id": 1,
            "type": "example"
          }
        ],
        "type": "example"
      }
    ],
    "updated_at": "example",
    "uuid": "example"
  }
}
```

### Create tag

Create a tag for a project's feature flags.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.
- Label (`label`, text, required): The tag's name, such as checkout.
- Color (`color`, text): The tag's color as a hex code, such as #3d4db6.
- Description (`description`, text): What the tag marks.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "color": "example",
    "description": "example",
    "id": 1,
    "is_permanent": true,
    "is_system_tag": true,
    "label": "example",
    "project": 1,
    "uuid": "example"
  }
}
```

### Delete environment

Delete an environment and every flag setting in it.

**Inputs**

- Project (`project_id`, number, required): The project the environment is in. At least 1.
- Environment (`environment_key`, text, required): The environment.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {}
}
```

### Delete feature flag

Delete a feature flag from every environment of its project.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.
- Feature flag (`feature_id`, number, required): The feature flag. At least 1.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {}
}
```

### Delete segment

Delete a segment. Flags that targeted it stop doing so.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.
- Segment (`segment_id`, number, required): The segment. At least 1.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {}
}
```

### Delete tag

Delete a tag and take it off every flag that has it.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.
- Tag (`tag_id`, number, required): The tag. At least 1.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {}
}
```

### Get environment

Get an environment's name, SDK key and settings.

**Inputs**

- Project (`project_id`, number, required): The project the environment is in. At least 1.
- Environment (`environment_key`, text, required): The environment.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "allow_client_traits": true,
    "api_key": "example",
    "description": "example",
    "hide_disabled_flags": true,
    "id": 1,
    "name": "example",
    "project": 1,
    "use_v2_feature_versioning": true,
    "uuid": "example"
  }
}
```

### Get feature flag

Get a feature flag's settings, tags and owners.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.
- Feature flag (`feature_id`, number, required): The feature flag. At least 1.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "created_date": "example",
    "default_enabled": true,
    "description": "example",
    "environment_feature_state": {
      "enabled": true,
      "environment": 1,
      "feature_segment": 1,
      "feature_state_value": "example",
      "id": 1,
      "identity": 1
    },
    "group_owners": [
      1
    ],
    "id": 1,
    "initial_value": "example",
    "is_archived": true,
    "is_server_key_only": true,
    "last_modified_in_any_environment": "example",
    "lifecycle_stage": "example",
    "name": "example",
    "num_identity_overrides": 1,
    "num_segment_overrides": 1,
    "owners": [
      1
    ],
    "project": 1,
    "tags": [
      1
    ],
    "type": "example",
    "uuid": "example"
  }
}
```

### Get project

Get a project's settings.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "enable_realtime_updates": true,
    "hide_disabled_flags": true,
    "id": 1,
    "name": "example",
    "organisation": 1,
    "prevent_flag_defaults": true,
    "stale_flags_limit_days": 1,
    "use_edge_identities": true,
    "uuid": "example"
  }
}
```

### Get segment

Get a segment and its rules.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.
- Segment (`segment_id`, number, required): The segment. At least 1.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "created_at": "example",
    "description": "example",
    "feature": 1,
    "id": 1,
    "name": "example",
    "project": 1,
    "rules": [
      {
        "conditions": [
          {
            "description": "example",
            "operator": "example",
            "property": "example",
            "value": "example"
          }
        ],
        "id": 1,
        "rules": [
          {
            "conditions": [
              {
                "description": "example",
                "operator": "example",
                "property": "example",
                "value": "example"
              }
            ],
            "id": 1,
            "type": "example"
          }
        ],
        "type": "example"
      }
    ],
    "updated_at": "example",
    "uuid": "example"
  }
}
```

### List audit log

List what changed and who changed it, newest first, optionally for one project or environment.

**Inputs**

- Project (`project_id`, number): Only changes in this project. At least 1.
- Environment IDs (`environment_ids`, list): Only changes in these environments, by their numeric ID.
- Search (`search`, text): Only entries whose text contains this (at least 3 characters).
- Page (`page`, number): Which page of results to return, starting at 1. Leave empty for the first. At least 1.
- Results per page (`page_size`, number): How many results a page holds, up to 100. Leave empty for 100. From 1 to 100.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "count": 1,
    "next": "example",
    "previous": "example",
    "results": [
      {
        "author": {
          "email": "example",
          "first_name": "example",
          "id": 1,
          "last_name": "example"
        },
        "created_date": "example",
        "environment": {
          "api_key": "example",
          "id": 1,
          "name": "example"
        },
        "id": 1,
        "is_system_event": true,
        "log": "example",
        "project": {
          "id": 1,
          "name": "example"
        },
        "related_object_id": 1,
        "related_object_type": "example"
      }
    ]
  }
}
```

### List environments

List a project's environments with their SDK keys.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "count": 1,
    "next": "example",
    "previous": "example",
    "results": [
      {
        "allow_client_traits": true,
        "api_key": "example",
        "description": "example",
        "hide_disabled_flags": true,
        "id": 1,
        "name": "example",
        "project": 1,
        "use_v2_feature_versioning": true,
        "uuid": "example"
      }
    ]
  }
}
```

### List feature flags

List a project's feature flags, optionally searched by name or filtered by tag, type or archive state.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.
- Search (`search`, text): Only flags whose name contains this.
- Tags (`tag_ids`, list): Only flags with these tags.
- Archived (`is_archived`, true/false): Only archived flags, or only flags that are not archived.
- Type (`type`, text): Only standard or only multivariate flags. One of: `STANDARD`, `MULTIVARIATE`.
- Sort by (`sort_field`, text): What to sort by. Leave empty for date created. One of: `created_date` (Date created), `name`.
- Sort order (`sort_direction`, text): Which come first. Leave empty for oldest first. One of: `ASC` (Oldest or A to Z first), `DESC` (Newest or Z to A first).
- Page (`page`, number): Which page of results to return, starting at 1. Leave empty for the first. At least 1.
- Results per page (`page_size`, number): How many results a page holds, up to 100. Leave empty for 100. From 1 to 100.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "count": 1,
    "next": "example",
    "previous": "example",
    "results": [
      {
        "created_date": "example",
        "default_enabled": true,
        "description": "example",
        "environment_feature_state": {
          "enabled": true,
          "environment": 1,
          "feature_segment": 1,
          "feature_state_value": "example",
          "id": 1,
          "identity": 1
        },
        "group_owners": [
          1
        ],
        "id": 1,
        "initial_value": "example",
        "is_archived": true,
        "is_server_key_only": true,
        "last_modified_in_any_environment": "example",
        "lifecycle_stage": "example",
        "name": "example",
        "num_identity_overrides": 1,
        "num_segment_overrides": 1,
        "owners": [
          1
        ],
        "project": 1,
        "tags": [
          1
        ],
        "type": "example",
        "uuid": "example"
      }
    ]
  }
}
```

### List flags in environment

List whether each feature flag is on in an environment, and its value.

**Inputs**

- Project (`project_id`, number, required): The project the environment is in. At least 1.
- Environment (`environment_key`, text, required): The environment.
- Feature flag (`feature_id`, number): Only this feature flag. At least 1.
- Page (`page`, number): Which page of results to return, starting at 1. Leave empty for the first. At least 1.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "count": 1,
    "next": "example",
    "previous": "example",
    "results": [
      {
        "created_at": "example",
        "enabled": true,
        "environment": 1,
        "feature": 1,
        "feature_segment": 1,
        "feature_state_value": "example",
        "id": 1,
        "identity": 1,
        "live_from": "example",
        "updated_at": "example",
        "uuid": "example"
      }
    ]
  }
}
```

### List organisation users

List the people in an organisation, with their role and last sign-in.

**Inputs**

- Organisation (`organisation_id`, number, required): The organisation. At least 1.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "users": [
      {
        "date_joined": "example",
        "email": "example",
        "first_name": "example",
        "id": 1,
        "last_login": "example",
        "last_name": "example",
        "role": "example"
      }
    ]
  }
}
```

### List organisations

List the organisations the API key belongs to.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "count": 1,
    "next": "example",
    "previous": "example",
    "results": [
      {
        "created_date": "example",
        "id": 1,
        "name": "example",
        "num_seats": 1,
        "uuid": "example"
      }
    ]
  }
}
```

### List projects

List the projects the API key can see.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "projects": [
      {
        "enable_realtime_updates": true,
        "hide_disabled_flags": true,
        "id": 1,
        "name": "example",
        "organisation": 1,
        "prevent_flag_defaults": true,
        "stale_flags_limit_days": 1,
        "use_edge_identities": true,
        "uuid": "example"
      }
    ]
  }
}
```

### List segments

List a project's segments and their rules.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.
- Search (`search`, text): Only segments whose name contains this.
- Page (`page`, number): Which page of results to return, starting at 1. Leave empty for the first. At least 1.
- Results per page (`page_size`, number): How many results a page holds, up to 100. Leave empty for 100. From 1 to 100.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "count": 1,
    "next": "example",
    "previous": "example",
    "results": [
      {
        "created_at": "example",
        "description": "example",
        "feature": 1,
        "id": 1,
        "name": "example",
        "project": 1,
        "rules": [
          {
            "conditions": [
              {
                "description": "example",
                "operator": "example",
                "property": "example",
                "value": "example"
              }
            ],
            "id": 1,
            "rules": [
              {
                "conditions": [
                  {
                    "description": "example",
                    "operator": "example",
                    "property": "example",
                    "value": "example"
                  }
                ],
                "id": 1,
                "type": "example"
              }
            ],
            "type": "example"
          }
        ],
        "updated_at": "example",
        "uuid": "example"
      }
    ]
  }
}
```

### List tags

List the tags a project's feature flags can carry.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.
- Page (`page`, number): Which page of results to return, starting at 1. Leave empty for the first. At least 1.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "count": 1,
    "next": "example",
    "previous": "example",
    "results": [
      {
        "color": "example",
        "description": "example",
        "id": 1,
        "is_permanent": true,
        "is_system_tag": true,
        "label": "example",
        "project": 1,
        "uuid": "example"
      }
    ]
  }
}
```

### Update feature flag

Change a feature flag's description or tags, or archive it.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.
- Feature flag (`feature_id`, number, required): The feature flag. At least 1.
- Description (`description`, text): What the flag is for.
- Tags (`tag_ids`, list): The flag's tags. These replace the tags it has.
- Archived (`is_archived`, true/false): Archive the flag, or bring it back from the archive.
- Server-side only (`is_server_key_only`, true/false): Hide the flag from client-side SDKs, so only server-side keys can read it.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "created_date": "example",
    "default_enabled": true,
    "description": "example",
    "environment_feature_state": {
      "enabled": true,
      "environment": 1,
      "feature_segment": 1,
      "feature_state_value": "example",
      "id": 1,
      "identity": 1
    },
    "group_owners": [
      1
    ],
    "id": 1,
    "initial_value": "example",
    "is_archived": true,
    "is_server_key_only": true,
    "last_modified_in_any_environment": "example",
    "lifecycle_stage": "example",
    "name": "example",
    "num_identity_overrides": 1,
    "num_segment_overrides": 1,
    "owners": [
      1
    ],
    "project": 1,
    "tags": [
      1
    ],
    "type": "example",
    "uuid": "example"
  }
}
```

### Update flag in environment

Turn a feature flag on or off in one environment, or change its value there.

**Inputs**

- Project (`project_id`, number, required): The project the environment is in. At least 1.
- Environment (`environment_key`, text, required): The environment.
- Feature flag (`feature_id`, number, required): The feature flag. At least 1.
- On (`enabled`, true/false): Whether the flag is on in this environment. Leave empty to keep it as it is.
- Value (`value`, text): The flag's value in this environment, for remote config. Leave empty to keep it.
- Value type (`value_type`, text): How the value is kept. Leave empty for text. One of: `string` (Text), `integer` (Whole number), `boolean` (True or false).

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "created_at": "example",
    "enabled": true,
    "environment": 1,
    "feature": 1,
    "feature_segment": 1,
    "feature_state_value": "example",
    "id": 1,
    "identity": 1,
    "live_from": "example",
    "updated_at": "example",
    "uuid": "example"
  }
}
```

### Update segment

Rename a segment or change its description. Its rules stay as they are.

**Inputs**

- Project (`project_id`, number, required): The project. At least 1.
- Segment (`segment_id`, number, required): The segment. At least 1.
- Name (`name`, text): The segment's new name.
- Description (`description`, text): Who the segment is.

**Outputs**

- `data` (object): The response from Flagsmith.

**Example output**

```json
{
  "data": {
    "created_at": "example",
    "description": "example",
    "feature": 1,
    "id": 1,
    "name": "example",
    "project": 1,
    "rules": [
      {
        "conditions": [
          {
            "description": "example",
            "operator": "example",
            "property": "example",
            "value": "example"
          }
        ],
        "id": 1,
        "rules": [
          {
            "conditions": [
              {
                "description": "example",
                "operator": "example",
                "property": "example",
                "value": "example"
              }
            ],
            "id": 1,
            "type": "example"
          }
        ],
        "type": "example"
      }
    ],
    "updated_at": "example",
    "uuid": "example"
  }
}
```
