Get Feature Flags
Get a list of all features in the given project. By default, each feature includes configurations for each environment. You can filter environments with the env query parameter. For example, setting env=production
restricts the returned configurations to just your production environment. You can also filter feature flags by tag with the tag query parameter.
We support the following fields for filters:
query
is a string that matches against the flags' keys and names. It is not case sensitive.archived
is a boolean to filter the list to archived flags. When this is absent, only unarchived flags are returned.type
is a string allowing filtering totemporary
orpermanent
flags.status
is a string allowing filtering tonew
,inactive
,active
, orlaunched
flags in the specified environment. This filter also requires afilterEnv
field to be set to a valid environment. For example:filter=status:active,filterEnv:production
.tags
is a + separated list of tags. It filters the list to members who have all of the tags in the list.hasExperiment
is a boolean with values of true or false and returns any flags that have an attached metric.hasDataExport
is a boolean with values of true or false and returns any flags that are exporting data in the specified environment. This includes flags that are exporting data from Experimentation. This filter also requires that you set afilterEnv
field to a valid environment key. For example:filter=hasDataExport:true,filterEnv:production
evaluated
is an object that contains a key ofafter
and a value in Unix time in milliseconds. This returns all flags that have been evaluated since the time you specify in the environment provided. This filter also requires you to set afilterEnv
field to a valid environment. For example:filter=evaluated:{"after": 1590768455282},filterEnv:production
.filterEnv
is a string with the key of a valid environment. You can use the filterEnv field for filters that are environment-specific. If there are multiple environment-specific filters, you should only declare this parameter once. For example:filter=evaluated:{"after": 1590768455282},filterEnv:production,status:active
.
An example filter is query:abc,tags:foo+bar
. This matches flags with the string abc
in their key or name, ignoring case, which also have the tags foo
and bar
.
By default, this returns all flags. You can page through the list with the limit
parameter and by following the first
, prev
, next
, and last
links in the returned _links
field. These links will not be present if the pages they refer to don't exist. For example, the first
and prev
links will be missing from the response on the first page.
Parameters
Parameter | Description |
---|---|
Archived | A boolean to filter the list to archived flags. When this is absent, only unarchived flags will be returned. |
Compare | A boolean to filter results by only flags that have differences between environments. |
Env | Filter configurations by environment. |
Filter | A comma-separated list of filters. Each filter is of the form field:value. |
Limit | The number of feature flags to return. Defaults to -1, which returns all flags. |
Offset | Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query limit . |
Project Key | The project key. |
Sort | A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order. |
Summary | By default in API version >= 1, flags will not include their list of prerequisites, targets or rules. Set summary=0 to include these fields for each flag returned. |
Tag | Filter feature flags by tag. |
Example Output
{
"_links": {
"self": {
"href": "/api/v2/flags/default",
"type": "application/json"
}
},
"items": [
{
"_links": {
"parent": {
"href": "/api/v2/flags/my-project",
"type": "application/json"
},
"self": {
"href": "/api/v2/flags/my-project/my-flag",
"type": "application/json"
}
},
"_maintainer": {
"_id": "569f183514f4432160000007",
"_links": {
"self": {
"href": "/api/v2/members/569f183514f4432160000007",
"type": "application/json"
}
},
"email": "a.example@example.com",
"firstName": "An",
"lastName": "Example",
"role": "owner"
},
"_version": 1,
"archived": false,
"archivedDate": 0,
"clientSideAvailability": {
"usingEnvironmentId": false,
"usingMobileKey": false
},
"creationDate": 0,
"customProperties": {},
"defaults": {
"offVariation": 1,
"onVariation": 0
},
"description": "This flag controls the example widgets",
"environments": {
"my-environment": {
"_environmentName": "My Environment",
"_site": {
"href": "/default/my-environment/features/client-side-flag",
"type": "text/html"
},
"_summary": {
"prerequisites": 0,
"variations": {
"0": {
"isFallthrough": true,
"nullRules": 0,
"rules": 0,
"targets": 0
},
"1": {
"isOff": true,
"nullRules": 0,
"rules": 0,
"targets": 0
}
}
},
"archived": false,
"fallthrough": {
"variation": 0
},
"lastModified": 1627071171347,
"offVariation": 1,
"on": false,
"prerequisites": [],
"rules": [],
"salt": "61eddeadbeef4da1facecafe3a60a397",
"sel": "810edeadbeef4844facecafe438f2999492",
"targets": [],
"trackEvents": false,
"trackEventsFallthrough": false,
"version": 1
}
},
"experiments": {
"baselineIdx": 0,
"items": [
{
"_environmentSettings": {},
"_metric": {
"_access": {
"allowed": [
{
"action": "string",
"reason": {
"actions": [
"string"
],
"effect": "string",
"notActions": [
"string"
],
"notResources": [
"string"
],
"resources": [
"string"
],
"role_name": "string"
}
}
],
"denied": [
{
"action": "string",
"reason": {
"actions": [
"string"
],
"effect": "string",
"notActions": [
"string"
],
"notResources": [
"string"
],
"resources": [
"string"
],
"role_name": "string"
}
}
]
},
"_attachedFlagCount": 0,
"_creationDate": 0,
"_id": "5902deadbeef667524a01290",
"_links": {
"parent": {
"href": "/api/v2/metrics/my-project",
"type": "application/json"
},
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"_maintainer": {
"_id": "569f183514f4432160000007",
"_links": {
"self": {
"href": "/api/v2/members/569f183514f4432160000007",
"type": "application/json"
}
},
"email": "a.example@example.com",
"firstName": "An",
"lastName": "Example",
"role": "owner"
},
"_site": {
"href": "string",
"type": "string"
},
"description": "string",
"eventKey": "string",
"isNumeric": false,
"key": "my-metric",
"kind": "string",
"lastModified": {
"date": "2021-08-05T19:46:31.148082Z"
},
"maintainerId": "569fdeadbeef1644facecafe",
"name": "my-metric",
"successCriteria": "string",
"tags": [],
"unit": "string"
},
"environments": [
"production",
"test",
"my-environment"
],
"metricKey": "my-metric"
}
]
},
"goalIds": [],
"includeInSnippet": true,
"key": "my-flag",
"kind": "boolean",
"maintainerId": "569f183514f4432160000007",
"name": "My Flag",
"tags": [
"example-tag"
],
"temporary": true,
"variations": [
{
"_id": "e432f62b-55f6-49dd-a02f-eb24acf39d05",
"value": true
},
{
"_id": "a00bf58d-d252-476c-b915-15a74becacb4",
"value": false
}
]
}
],
"totalCount": 1,
"totalCountWithDifferences": 0
}
Workflow Library Example
Get Feature Flags with Launchdarkly and Send Results Via Email