Skip to main content

Batch evaluate an Unleash context against a set of environments and projects.

POST 

<your-unleash-url>/api/admin/playground/advanced

Use the provided context, environments, and projects to evaluate toggles on this Unleash instance. You can use comma-separated values to provide multiple values to each context field. Returns a combinatorial list of all toggles that match the parameters and what they evaluate to. The response also contains the input parameters that were provided.

Request

Bodyrequired

advancedPlaygroundRequestSchema

    environmentsstring[]required

    The environments to evaluate toggles in.

    Possible values: >= 1

    Example: ["development","production"]
    projects object

    A list of projects to check for toggles in.

    oneOf
  • Array [
  • string
  • ]
  • context objectrequired

    The Unleash context as modeled in client SDKs

    appNamestringrequired

    The name of the application.

    Possible values: non-empty

    Example: My cool application.
    currentTimedate-time

    A DateTime (or similar) data class instance or a string in an RFC3339-compatible format. Defaults to the current time if not set by the user.

    Example: 2022-07-05T12:56:41+02:00
    environmentstringdeprecated

    The environment the app is running in.

    properties object

    Additional Unleash context properties

    property name*string
    remoteAddressstring

    The app's IP address

    Example: 192.168.1.1
    sessionIdstring

    An identifier for the current session

    Example: b65e7b23-fec0-4814-a129-0e9861ef18fc
    userIdstring

    An identifier for the current user

    Example: username@provider.com
    property name*any

    The Unleash context as modeled in client SDKs

Responses

advancedPlaygroundResponseSchema

Schema
    input objectrequired

    The given input used to evaluate the features.

    environmentsstring[]required

    The environments to evaluate toggles in.

    Possible values: >= 1

    Example: ["development","production"]
    projects object

    A list of projects to check for toggles in.

    oneOf
  • Array [
  • string
  • ]
  • context objectrequired

    The Unleash context as modeled in client SDKs

    appNamestringrequired

    The name of the application.

    Possible values: non-empty

    Example: My cool application.
    currentTimedate-time

    A DateTime (or similar) data class instance or a string in an RFC3339-compatible format. Defaults to the current time if not set by the user.

    Example: 2022-07-05T12:56:41+02:00
    environmentstringdeprecated

    The environment the app is running in.

    properties object

    Additional Unleash context properties

    property name*string
    remoteAddressstring

    The app's IP address

    Example: 192.168.1.1
    sessionIdstring

    An identifier for the current session

    Example: b65e7b23-fec0-4814-a129-0e9861ef18fc
    userIdstring

    An identifier for the current user

    Example: username@provider.com
    property name*any

    The Unleash context as modeled in client SDKs

    features object[]required

    The list of features that have been evaluated.

  • Array [
  • namestringrequired

    The feature's name.

    Example: my-feature
    projectIdstringrequired

    The ID of the project that contains this feature.

    Example: my-project
    environments objectrequired

    The lists of features that have been evaluated grouped by environment.

    property name* object[]
  • Array [
  • namestringrequired

    The feature's name.

    Example: my-feature
    environmentstringrequired

    The feature's environment.

    Example: development
    context objectrequired

    The context to use when evaluating flags

    appNamestringrequired

    The name of the application.

    Possible values: non-empty

    Example: My cool application.
    currentTimedate-time

    A DateTime (or similar) data class instance or a string in an RFC3339-compatible format. Defaults to the current time if not set by the user.

    Example: 2022-07-05T12:56:41+02:00
    environmentstringdeprecated

    The environment the app is running in.

    remoteAddressstring

    The app's IP address

    Example: 192.168.1.1
    sessionIdstring

    An identifier for the current session

    Example: b65e7b23-fec0-4814-a129-0e9861ef18fc
    userIdstring

    An identifier for the current user

    Example: username@provider.com
    property name*any

    The context to use when evaluating flags

    projectIdstringrequired

    The ID of the project that contains this feature.

    Example: my-project
    strategies objectrequired

    Feature's applicable strategies and cumulative results of the strategies

    result objectrequired

    The cumulative results of all the feature's strategies. Can be true, false, or unknown. This property will only be unknown if one or more of the strategies can't be fully evaluated and the rest of the strategies all resolve to false.

    anyOf
    boolean
    data object[]required

    The strategies that apply to this feature.

  • Array [
  • namestringrequired

    The strategy's name.

    titlestring

    Description of the feature's purpose.

    Example: Beta rollout
    idstringrequired

    The strategy's id.

    Example: 3AECCF7E-FF82-4174-8287-8EBE06079A50
    result objectrequired

    The strategy's evaluation result. If the strategy is a custom strategy that Unleash can't evaluate, evaluationStatus will be unknown. Otherwise, it will be true or false

    anyOf
    evaluationStatusstringrequired

    Signals that this strategy could not be evaluated. This is most likely because you're using a custom strategy that Unleash doesn't know about. The unevaluated result is also returned if the strategy is disabled.

    Possible values: [incomplete, unevaluated]

    enabled objectrequired

    Whether this strategy resolves to false or if it might resolve to true. Because Unleash can't evaluate the strategy, it can't say for certain whether it will be true, but if you have failing constraints or segments, it can determine that your strategy would be false.

    anyOf
    boolean

    Possible values: [false]

    disabledbooleannullablerequired

    The strategy's status. Disabled strategies are not evaluated

    Example: false
    segments object[]required

    The strategy's segments and their evaluation results.

  • Array [
  • idintegerrequired

    The segment's id.

    namestringrequired

    The name of the segment.

    Example: segment A
    resultbooleanrequired

    Whether this was evaluated as true or false.

    constraints object[]required

    The list of constraints in this segment.

  • Array [
  • contextNamestringrequired

    The name of the context field that this constraint should apply to.

    Example: appName
    operatorstringrequired

    The operator to use when evaluating this constraint. For more information about the various operators, refer to the strategy constraint operator documentation.

    Possible values: [NOT_IN, IN, STR_ENDS_WITH, STR_STARTS_WITH, STR_CONTAINS, NUM_EQ, NUM_GT, NUM_GTE, NUM_LT, NUM_LTE, DATE_AFTER, DATE_BEFORE, SEMVER_EQ, SEMVER_GT, SEMVER_LT]

    Example: IN
    caseInsensitiveboolean

    Whether the operator should be case sensitive or not. Defaults to false (being case sensitive).

    Default value: false
    invertedboolean

    Whether the result should be negated or not. If true, will turn a true result into a false result and vice versa.

    Default value: false
    valuesstring[]

    The context values that should be used for constraint evaluation. Use this property instead of value for properties that accept multiple values.

    Example: ["my-app","my-other-app"]
    valuestring

    The context value that should be used for constraint evaluation. Use this property instead of values for properties that only accept single values.

    Example: my-app
    resultbooleanrequired

    Whether this was evaluated as true or false.

  • ]
  • ]
  • constraints object[]required

    The strategy's constraints and their evaluation results.

  • Array [
  • contextNamestringrequired

    The name of the context field that this constraint should apply to.

    Example: appName
    operatorstringrequired

    The operator to use when evaluating this constraint. For more information about the various operators, refer to the strategy constraint operator documentation.

    Possible values: [NOT_IN, IN, STR_ENDS_WITH, STR_STARTS_WITH, STR_CONTAINS, NUM_EQ, NUM_GT, NUM_GTE, NUM_LT, NUM_LTE, DATE_AFTER, DATE_BEFORE, SEMVER_EQ, SEMVER_GT, SEMVER_LT]

    Example: IN
    caseInsensitiveboolean

    Whether the operator should be case sensitive or not. Defaults to false (being case sensitive).

    Default value: false
    invertedboolean

    Whether the result should be negated or not. If true, will turn a true result into a false result and vice versa.

    Default value: false
    valuesstring[]

    The context values that should be used for constraint evaluation. Use this property instead of value for properties that accept multiple values.

    Example: ["my-app","my-other-app"]
    valuestring

    The context value that should be used for constraint evaluation. Use this property instead of values for properties that only accept single values.

    Example: my-app
    resultbooleanrequired

    Whether this was evaluated as true or false.

  • ]
  • parameters objectrequired

    The strategy's constraints and their evaluation results.

    property name*string
    links objectrequired

    A set of links to actions you can perform on this strategy

    editstringrequired
    Example: /projects/some-project/features/some-feature/strategies/edit?environmentId=some-env&strategyId= 3AECCF7E-FF82-4174-8287-8EBE06079A50
  • ]
  • isEnabledInCurrentEnvironmentbooleanrequired

    Whether the feature is active and would be evaluated in the provided environment in a normal SDK context.

    isEnabledbooleanrequired

    Whether this feature is enabled or not in the current environment. If a feature can't be fully evaluated (that is, strategies.result is unknown), this will be false to align with how client SDKs treat unresolved feature states.

    Example: true
    variant objectnullablerequired

    The feature variant you receive based on the provided context or the disabled variant. If a feature is disabled or doesn't have any variants, you would get the disabled variant. Otherwise, you'll get one of the feature's defined variants.

    namestringrequired

    The variant's name. If there is no variant or if the flag is disabled, this will be disabled

    Example: red-variant
    enabledbooleanrequired

    Whether the variant is enabled or not. If the feature is disabled or if it doesn't have variants, this property will be false

    payload object

    An optional payload attached to the variant.

    typestringrequired

    The format of the payload.

    valuestringrequired

    The payload value stringified.

    Example: {"property": "value"}
    feature_enabledboolean

    Whether the feature is enabled or not. If the feature is disabled, this property will be false

    variants object[]required

    The feature variants.

  • Array [
  • namestringrequired

    The variants name. Is unique for this feature flag

    Example: blue_group
    weightnumberrequired

    The weight is the likelihood of any one user getting this variant. It is a number between 0 and 1000. See the section on variant weights for more information

    Possible values: <= 1000

    weightTypestring

    Set to fix if this variant must have exactly the weight allocated to it. If the type is variable, the weight will adjust so that the total weight of all variants adds up to 1000

    Possible values: [variable, fix]

    Example: variable
    stickinessstring

    Stickiness is how Unleash guarantees that the same user gets the same variant every time

    Example: custom.context.field
    payload object

    Extra data configured for this variant

    typestringrequired

    The type of the value. Commonly used types are string, number, json and csv.

    Possible values: [json, csv, string, number]

    valuestringrequired

    The actual value of payload

    overrides object[]

    Overrides assigning specific variants to specific users. The weighting system automatically assigns users to specific groups for you, but any overrides in this list will take precedence.

  • Array [
  • contextNamestringrequired

    The name of the context field used to determine overrides

    Example: userId
    valuesstring[]required

    Which values that should be overriden

    Example: ["red","blue"]
  • ]
  • ]
  • ]
  • ]
  • warnings object

    Warnings that occurred during evaluation.

    invalidContextPropertiesstring[]

    A list of top-level context properties that were provided as input that are not valid due to being the wrong type.

Authorization: Authorization

name: Authorizationtype: apiKeyin: headerdescription: API key needed to access this API
curl -L '<your-unleash-url>/api/admin/playground/advanced' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <Authorization>' \
--data-raw '{
"environments": [
"development",
"production"
],
"projects": [
"my-project"
],
"context": {
"appName": "My cool application.",
"currentTime": "2022-07-05T12:56:41+02:00",
"properties": {
"customContextField": "this is one!",
"otherCustomField": "3"
},
"remoteAddress": "192.168.1.1",
"sessionId": "b65e7b23-fec0-4814-a129-0e9861ef18fc",
"userId": "username@provider.com"
}
}'
Request Collapse all
Base URL
<your-unleash-url>
Auth
Body required
{
  "environments": [
    "development",
    "production"
  ],
  "projects": [
    "my-project"
  ],
  "context": {
    "appName": "My cool application.",
    "currentTime": "2022-07-05T12:56:41+02:00",
    "properties": {
      "customContextField": "this is one!",
      "otherCustomField": "3"
    },
    "remoteAddress": "192.168.1.1",
    "sessionId": "b65e7b23-fec0-4814-a129-0e9861ef18fc",
    "userId": "username@provider.com"
  }
}
ResponseClear

Click the Send API Request button above and see the response here!