Create a strategy
POST /api/admin/strategies
This endpoint has been deprecated and may be removed in future versions of the API.
Creates a custom strategy type based on the supplied data. Custom strategies are deprecated and should not be used. Prefer using built in strategies with constraints instead.
Request
- application/json
Body
required
createStrategySchema
- name string requiredThe name of the strategy type. Must be unique. 
- title stringThe title of the strategy 
- description stringA description of the strategy type. 
- editable booleanWhether the strategy type is editable or not. Defaults to true.
- deprecated booleanWhether the strategy type is deprecated or not. Defaults to false.
- parameters object[]required- The parameter list lets you pass arguments to your custom activation strategy. These will be made available to your custom strategy implementation. Array [name string required- The name of the parameter type string required- Possible values: [ - string,- percentage,- list,- number,- boolean]description string- A description of this strategy parameter. Use this to indicate to the users what the parameter does. required boolean- Whether this parameter must be configured when using the strategy. Defaults to - false]
- 201
- 401
- 403
- 409
- 415
The resource was successfully created.
Response Headers
- location string- The location of the newly created resource. 
- application/json
- Schema
- Example (from schema)
Schema
- title string nullableAn optional title for the strategy 
- name string requiredThe name (type) of the strategy 
- displayName string nullable requiredA human friendly name for the strategy 
- description string nullable requiredA short description of the strategy 
- editable boolean requiredWhether the strategy can be edited or not. Strategies bundled with Unleash cannot be edited. 
- deprecated boolean required
- parameters object[]required- A list of relevant parameters for each strategy Array [name stringtype stringdescription stringrequired boolean]
{
  "title": "GradualRollout - Prod25",
  "name": "flexibleRollout",
  "displayName": "Gradual Rollout",
  "description": "Gradual rollout to logged in users",
  "editable": true,
  "deprecated": true,
  "parameters": [
    {
      "name": "percentage",
      "type": "percentage",
      "description": "Gradual rollout to logged in users",
      "required": true
    }
  ]
}
Authorization information is missing or invalid. Provide a valid API token as the authorization header, e.g. authorization:*.*.my-admin-token.
- application/json
- Schema
- Example (from schema)
Schema
- id stringThe ID of the error instance 
- name stringThe name of the error kind 
- message stringA description of what went wrong. 
{
  "id": "9c40958a-daac-400e-98fb-3bb438567008",
  "name": "AuthenticationRequired",
  "message": "You must log in to use Unleash. Your request had no authorization header, so we could not authorize you. Try logging in at /auth/simple/login."
}
The provided user credentials are valid, but the user does not have the necessary permissions to perform this operation
- application/json
- Schema
- Example (from schema)
Schema
- id stringThe ID of the error instance 
- name stringThe name of the error kind 
- message stringA description of what went wrong. 
{
  "id": "9c40958a-daac-400e-98fb-3bb438567008",
  "name": "NoAccessError",
  "message": "You need the \"UPDATE_ADDON\" permission to perform this action in the \"development\" environment."
}
The provided resource can not be created or updated because it would conflict with the current state of the resource or with an already existing resource, respectively.
- application/json
- Schema
- Example (from schema)
Schema
- id stringThe ID of the error instance 
- name stringThe name of the error kind 
- message stringA description of what went wrong. 
{
  "id": "9c40958a-daac-400e-98fb-3bb438567008",
  "name": "NameExistsError",
  "message": "There is already a feature called \"my-awesome-feature\"."
}
The operation does not support request payloads of the provided type. Please ensure that you're using one of the listed payload types and that you have specified the right content type in the "content-type" header.
- application/json
- Schema
- Example (from schema)
Schema
- id stringThe ID of the error instance 
- name stringThe name of the error kind 
- message stringA description of what went wrong. 
{
  "id": "9c40958a-daac-400e-98fb-3bb438567008",
  "name": "ContentTypeerror",
  "message": "We do not accept the content-type you provided (application/xml). Try using one of the content-types we do accept instead (application/json) and make sure the body is in the corresponding format."
}