2018-11-20 20:34:42 +01:00
---
id: features
title: /api/admin/features
---
2021-03-09 21:44:45 +01:00
> In order to access the admin api endpoints you need to identify yourself. If you are using the `unsecure` authentication method, you may use [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) to identify yourself.
2020-12-03 21:29:01 +01:00
2016-09-06 21:23:56 +02:00
### Fetching Feature Toggles
2017-06-28 10:17:48 +02:00
`GET: http://unleash.host.com/api/admin/features`
2016-09-06 21:23:56 +02:00
2018-11-22 11:20:28 +01:00
This endpoint is the one all admin ui should use to fetch all available feature toggles from the _unleash-server_ . The response returns all active feature toggles and their current strategy configuration. A feature toggle will have _at least_ one configured strategy. A strategy will have a `name` and `parameters` map.
2016-09-06 21:23:56 +02:00
**Example response:**
2018-11-22 11:20:28 +01:00
2016-09-06 21:23:56 +02:00
```json
{
2017-06-28 10:17:48 +02:00
"version": 2,
2016-09-06 21:23:56 +02:00
"features": [
{
"name": "Feature.A",
"description": "lorem ipsum",
2020-08-06 11:18:52 +02:00
"type": "release",
2016-09-06 21:23:56 +02:00
"enabled": false,
2020-08-07 10:46:35 +02:00
"stale": false,
2016-09-06 21:23:56 +02:00
"strategies": [
{
"name": "default",
"parameters": {}
}
2018-01-30 15:57:12 +01:00
],
"variants": [
{
"name": "variant1",
2019-01-24 11:26:07 +01:00
"weight": 50
2018-01-30 15:57:12 +01:00
},
{
"name": "variant2",
2019-01-24 11:26:07 +01:00
"weight": 50
2018-01-30 15:57:12 +01:00
}
2021-01-04 10:29:33 +01:00
],
"tags": [
{
"id": 1,
"type": "simple",
"value": "TeamRed"
}
2017-06-28 10:17:48 +02:00
]
2016-09-06 21:23:56 +02:00
},
{
"name": "Feature.B",
"description": "lorem ipsum",
"enabled": true,
2020-08-07 10:46:35 +02:00
"stale": false,
2016-09-06 21:23:56 +02:00
"strategies": [
{
"name": "ActiveForUserWithId",
"parameters": {
"userIdList": "123,221,998"
}
},
{
"name": "GradualRolloutRandom",
"parameters": {
"percentage": "10"
}
}
2018-01-30 15:57:12 +01:00
],
2021-01-04 10:29:33 +01:00
"variants": [],
"tags": []
2016-09-06 21:23:56 +02:00
}
]
}
```
2021-01-22 13:39:42 +01:00
#### Filter feature toggles
Supports three params for now
- `tag` - filters for features tagged with tag
- `project` - filters for features belonging to project
- `namePrefix` - filters for features beginning with prefix
For `tag` and `project` performs OR filtering if multiple arguments
To filter for any feature tagged with a `simple` tag with value `taga` or a `simple` tag with value `tagb` use
`GET https://unleash.host.com/api/admin/features?tag[]=simple:taga&tag[]simple:tagb`
To filter for any feature belonging to project `myproject` use
`GET https://unleash.host.com/api/admin/features?project=myproject`
Response format is the same as `api/admin/features`
### Fetch specific feature toggle
2017-06-28 10:17:48 +02:00
`GET: http://unleash.host.com/api/admin/features/:featureName`
2016-09-06 21:23:56 +02:00
2018-11-22 11:20:28 +01:00
Used to fetch details about a specific featureToggle. This is mostly provded to make it easy to debug the API and should not be used by the client implementations.
2016-09-06 21:23:56 +02:00
```json
{
"name": "Feature.A",
"description": "lorem ipsum..",
2020-08-06 11:18:52 +02:00
"type": "release",
2016-09-06 21:23:56 +02:00
"enabled": false,
2020-08-07 10:46:35 +02:00
"stale": false,
2016-09-06 21:23:56 +02:00
"strategies": [
{
"name": "default",
"parameters": {}
}
2018-01-30 15:57:12 +01:00
],
2021-01-04 10:29:33 +01:00
"variants": [],
"tags": []
2016-09-06 21:23:56 +02:00
}
```
### Create a new Feature Toggle
2017-06-28 10:17:48 +02:00
`POST: http://unleash.host.com/api/admin/features/`
2016-09-06 21:23:56 +02:00
**Body:**
2018-11-22 11:20:28 +01:00
```json
2016-09-06 21:23:56 +02:00
{
"name": "Feature.A",
"description": "lorem ipsum..",
2020-08-06 11:18:52 +02:00
"type": "release",
2016-09-06 21:23:56 +02:00
"enabled": false,
2020-08-07 10:46:35 +02:00
"stale": false,
2016-09-06 21:23:56 +02:00
"strategies": [
{
"name": "default",
"parameters": {}
}
]
}
```
2020-08-06 11:18:52 +02:00
Used by the admin-dashboard to create a new feature toggles.
**Notes:**
- _name_ **must be globally unique** , otherwise you will get a _403-response_ .
- _type_ is optional. If not defined it defaults to `release`
2016-09-06 21:23:56 +02:00
2021-03-09 21:44:45 +01:00
Returns 200-response if the feature toggle was created successfully.
2016-09-06 21:23:56 +02:00
2016-09-07 12:12:17 +02:00
### Update a Feature Toggle
2016-09-06 21:23:56 +02:00
2017-06-28 10:17:48 +02:00
`PUT: http://unleash.host.com/api/admin/features/:toggleName`
2016-09-06 21:23:56 +02:00
**Body:**
2018-11-22 11:20:28 +01:00
```json
2016-09-06 21:23:56 +02:00
{
"name": "Feature.A",
"description": "lorem ipsum..",
2020-08-06 11:18:52 +02:00
"type": "release",
2016-09-06 21:23:56 +02:00
"enabled": false,
2020-08-07 10:46:35 +02:00
"stale": false,
2016-09-06 21:23:56 +02:00
"strategies": [
{
"name": "default",
"parameters": {}
}
2018-01-30 15:57:12 +01:00
],
"variants": []
2016-09-06 21:23:56 +02:00
}
```
2018-11-22 11:20:28 +01:00
Used by the admin dashboard to update a feature toggles. The name has to match an existing features toggle.
2016-09-06 21:23:56 +02:00
2021-03-09 21:44:45 +01:00
Returns 200-response if the feature toggle was updated successfully.
2016-09-06 21:23:56 +02:00
2021-01-04 10:29:33 +01:00
### Tag a Feature Toggle
`POST https://unleash.host.com/api/admin/features/:featureName/tags`
Used to tag a feature
If the tuple (type, value) does not already exist, it will be added to the list of tags. Then Unleash will add a relation between the feature name and the tag.
**Body:**
```json
{
"type": "simple",
"value": "Team-Green"
}
```
## Success
- Returns _201-CREATED_ if the feature was tagged successfully
- Creates the tag if needed, then connects the tag to the existing feature
## Failures
- Returns _404-NOT-FOUND_ if the `type` was not found
### Remove a tag from a Feature Toggle
`DELETE https://unleash.host.com/api/admin/features/:featureName/tags/:type/:value`
Removes the specified tag from the `(type, value)` tuple from the Feature Toggle's list of tags.
## Success
- Returns _200-OK_
## Failures
- Returns 404 if the tag does not exist
- Returns 500 if the database could not be reached
2016-09-07 12:12:17 +02:00
### Archive a Feature Toggle
2017-06-28 10:17:48 +02:00
`DELETE: http://unleash.host.com/api/admin/features/:toggleName`
2016-09-07 12:12:17 +02:00
2018-11-22 11:20:28 +01:00
Used to archive a feature toggle. A feature toggle can never be totally be deleted, but can be archived. This is a design decision to make sure that a old feature toggle suddenly reappears becuase someone else re-using the same name.
2016-09-07 12:12:17 +02:00
2019-10-24 16:51:29 +02:00
### Enable a Feature Toggle
`POST: http://unleash.host.com/api/admin/features/:featureName/toggle/on`
Used to enable a feature toggle. The :featureName must match an existing Feature Toggle. Returns 200-response if the feature toggle was enabled successfully.
**Body**
None
**Example response:**
```json
{
"name": "Feature.A",
"description": "lorem ipsum..",
2020-08-06 11:18:52 +02:00
"type": "release",
2019-10-24 16:51:29 +02:00
"enabled": true,
"strategies": [
{
"name": "default",
"parameters": {}
}
],
2021-01-04 10:29:33 +01:00
"variants": [],
"tags": []
2019-10-24 16:51:29 +02:00
}
```
### Disable a Feature Toggle
`POST: http://unleash.host.com/api/admin/features/:featureName/toggle/off`
Used to disable a feature toggle. The :featureName must match an existing Feature Toggle. Returns 200-response if the feature toggle was disabled successfully.
**Body**
None
**Example response:**
```json
{
"name": "Feature.A",
"description": "lorem ipsum..",
2020-08-06 11:18:52 +02:00
"type": "release",
2019-10-24 16:51:29 +02:00
"enabled": false,
2020-08-07 10:46:35 +02:00
"stale": false,
"strategies": [
{
"name": "default",
"parameters": {}
}
],
2021-01-04 10:29:33 +01:00
"variants": [],
"tags": []
2020-08-07 10:46:35 +02:00
}
```
### Mark a Feature Toggle as "stale"
`POST: http://unleash.host.com/api/admin/features/:featureName/stale/on`
Used to mark a feature toggle as stale (deprecated). The :featureName must match an existing Feature Toggle. Returns 200-response if the feature toggle was enabled successfully.
**Body**
None
**Example response:**
```json
{
"name": "Feature.A",
"description": "lorem ipsum..",
"type": "release",
"enabled": true,
"stale": true,
"strategies": [
{
"name": "default",
"parameters": {}
}
],
2021-01-04 10:29:33 +01:00
"variants": [],
"tags": []
2020-08-07 10:46:35 +02:00
}
```
### Mark a Feature Toggle as "active"
`POST: http://unleash.host.com/api/admin/features/:featureName/stale/off`
Used to mark a feature toggle active (remove stale marking). The :featureName must match an existing Feature Toggle. Returns 200-response if the feature toggle was disabled successfully.
**Body**
None
**Example response:**
```json
{
"name": "Feature.A",
"description": "lorem ipsum..",
"type": "release",
"enabled": false,
"stale": false,
2019-10-24 16:51:29 +02:00
"strategies": [
{
"name": "default",
"parameters": {}
}
],
2021-01-04 10:29:33 +01:00
"variants": [],
"tags": []
2019-10-24 16:51:29 +02:00
}
```
2016-09-07 12:12:17 +02:00
## Archive
### Fetch archived toggles
2017-06-28 10:17:48 +02:00
`GET http://unleash.host.com/api/admin/archive/features`
2016-09-07 12:12:17 +02:00
Used to fetch list of archived feature toggles
**Example response:**
2018-11-22 11:20:28 +01:00
2016-09-07 12:12:17 +02:00
```json
{
"version": 1,
"features": [
{
"name": "Feature.A",
"description": "lorem ipsum",
2020-08-06 11:18:52 +02:00
"type": "release",
2016-09-07 12:12:17 +02:00
"enabled": false,
2020-08-07 10:46:35 +02:00
"stale": false,
2016-09-07 12:12:17 +02:00
"strategies": [
{
"name": "default",
"parameters": {}
}
],
2018-01-30 15:57:12 +01:00
"variants": [],
2021-01-04 10:29:33 +01:00
"tags": [],
2016-09-07 12:12:17 +02:00
"strategy": "default",
"parameters": {}
}
]
}
```
### Revive feature toggle
2017-06-28 10:17:48 +02:00
`POST http://unleash.host.com/api/admin/archive/revive`
2016-09-07 12:12:17 +02:00
**Body:**
2018-11-22 11:20:28 +01:00
```json
2016-09-07 12:12:17 +02:00
{
"name": "Feature.A"
}
```
2018-11-22 11:20:28 +01:00
Used to revive a feature toggle.