> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.getunleash.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.getunleash.io/_mcp/server.

# Evaluate an Unleash context against a change request preview.

POST https://app.unleash-instance.example.com/api/admin/playground/change-request/{id}
Content-Type: application/json

**Enterprise feature**

Use the provided `context` to evaluate toggles on this Unleash instance with a change request applied in preview mode. 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.

Reference: https://docs.getunleash.io/api/get-change-request-playground

## Authentication

- `Authorization` header (required) — API key needed to access this API
- `Authorization` header (bearer token, required) — API key needed to access this API, in Bearer token format

## Request

### Path parameters

- `id` (string, required)

### Body (application/json)

- `context` (object, required) — The Unleash context as modeled in client SDKs
  - `appName` (string, required) — The name of the application.
  - `currentTime` (string, optional) — 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.
  - `properties` (map from string to string, optional) — Additional Unleash context properties
  - `remoteAddress` (string, optional) — The app's IP address
  - `sessionId` (string, optional) — An identifier for the current session
  - `userId` (string, optional) — An identifier for the current user
  - `environment` (string, optional, deprecated) — The environment the app is running in.

## Response

### 200

advancedPlaygroundResponseSchema

- `input` (object, required) — The given input used to evaluate the features.
  - `environments` (list of string, required) — The environments to evaluate toggles in.
  - `context` (object, required) — The Unleash context as modeled in client SDKs
    - `appName` (string, required) — The name of the application.
    - `currentTime` (string, optional) — 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.
    - `properties` (map from string to string, optional) — Additional Unleash context properties
    - `remoteAddress` (string, optional) — The app's IP address
    - `sessionId` (string, optional) — An identifier for the current session
    - `userId` (string, optional) — An identifier for the current user
    - `environment` (string, optional, deprecated) — The environment the app is running in.
  - `projects` (list of string or enum, optional) — A list of projects to check for toggles in.
- `features` (list of object, required) — The list of features that have been evaluated.
  - `name` (string, required) — The feature's name.
  - `projectId` (string, required) — The ID of the project that contains this feature.
  - `environments` (map from string to list of object, required) — The lists of features that have been evaluated grouped by environment.
    - `name` (string, required) — The feature's name.
    - `environment` (string, required) — The feature's environment.
    - `context` (object, required) — The context to use when evaluating flags
      - `appName` (string, required) — The name of the application.
      - `currentTime` (string, optional) — 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.
      - `remoteAddress` (string, optional) — The app's IP address
      - `sessionId` (string, optional) — An identifier for the current session
      - `userId` (string, optional) — An identifier for the current user
      - `environment` (string, optional, deprecated) — The environment the app is running in.
    - `projectId` (string, required) — The ID of the project that contains this feature.
    - `strategies` (object, required) — Feature's applicable strategies and cumulative results of the strategies
      - `result` (boolean or enum, required) — 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`.
      - `data` (list of object, required) — The strategies that apply to this feature.
        - `name` (string, required) — The strategy's name.
        - `id` (string, required) — The strategy's id.
        - `result` (object or object, required) — 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`
          - object
            - `evaluationStatus` (enum, required) — 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.
            - `enabled` (boolean or enum, required) — 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`.
          - object
            - `evaluationStatus` (enum, required) — Signals that this strategy was evaluated successfully.
            - `enabled` (boolean, required) — Whether this strategy evaluates to true or not.
            - `variant` (object, optional, nullable) — 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.
            - `variants` (list of object, optional) — The feature variants.
        - `disabled` (boolean, required, nullable) — The strategy's status. Disabled strategies are not evaluated
        - `segments` (list of object, required) — The strategy's segments and their evaluation results.
          - `id` (integer, required) — The segment's id.
          - `name` (string, required) — The name of the segment.
          - `result` (boolean, required) — Whether this was evaluated as true or false.
          - `constraints` (list of object, required) — The list of constraints in this segment.
            - `contextName` (string, required) — The name of the context field that this constraint should apply to.
            - `operator` (enum, required) — The operator to use when evaluating this constraint. For more information about the various operators, refer to [the strategy constraint operator documentation](https://docs.getunleash.io/concepts/activation-strategies#constraint-operators).
            - `result` (boolean, required) — Whether this was evaluated as true or false.
            - `caseInsensitive` (boolean, optional, default: false) — Whether the operator should be case sensitive or not. Defaults to `false` (being case sensitive).
            - `inverted` (boolean, optional, default: false) — Whether the result should be negated or not. If `true`, will turn a `true` result into a `false` result and vice versa.
            - `values` (list of string, optional) — The context values that should be used for constraint evaluation. Use this property instead of `value` for properties that accept multiple values.
            - `value` (string, optional) — The context value that should be used for constraint evaluation. Use this property instead of `values` for properties that only accept single values.
        - `constraints` (list of object, required) — The strategy's constraints and their evaluation results.
          - `contextName` (string, required) — The name of the context field that this constraint should apply to.
          - `operator` (enum, required) — The operator to use when evaluating this constraint. For more information about the various operators, refer to [the strategy constraint operator documentation](https://docs.getunleash.io/concepts/activation-strategies#constraint-operators).
            - Allowed 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`, `SEMVER_GTE`, `SEMVER_LTE`, `REGEX`
          - `result` (boolean, required) — Whether this was evaluated as true or false.
          - `caseInsensitive` (boolean, optional, default: false) — Whether the operator should be case sensitive or not. Defaults to `false` (being case sensitive).
          - `inverted` (boolean, optional, default: false) — Whether the result should be negated or not. If `true`, will turn a `true` result into a `false` result and vice versa.
          - `values` (list of string, optional) — The context values that should be used for constraint evaluation. Use this property instead of `value` for properties that accept multiple values.
          - `value` (string, optional) — The context value that should be used for constraint evaluation. Use this property instead of `values` for properties that only accept single values.
        - `parameters` (map from string to string, required) — The strategy's constraints and their evaluation results.
        - `links` (object, required) — A set of links to actions you can perform on this strategy
          - `edit` (string, required)
        - `title` (string, optional) — Description of the feature's purpose.
    - `isEnabledInCurrentEnvironment` (boolean, required) — Whether the feature is active and would be evaluated in the provided environment in a normal SDK context.
    - `isEnabled` (boolean, required) — 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.
    - `variant` (object, required, nullable) — 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.
      - `name` (string, required) — The variant's name. If there is no variant or if the flag is disabled, this will be `disabled`
      - `enabled` (boolean, required) — 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, optional) — An optional payload attached to the variant.
        - `type` (string, required) — The format of the payload.
        - `value` (string, required) — The payload value stringified.
      - `feature_enabled` (boolean, optional) — Whether the feature is enabled or not. If the feature is disabled, this property will be `false`
    - `variants` (list of object, required) — The feature variants.
      - `name` (string, required) — The variants name. Is unique for this feature flag
      - `weight` (double, required) — 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](https://docs.getunleash.io/concepts/feature-flag-variants#variant-weight) for more information
      - `weightType` (enum, optional) — 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
        - Allowed values: `variable`, `fix`
      - `stickiness` (string, optional) — [Stickiness](https://docs.getunleash.io/concepts/feature-flag-variants#variant-stickiness) is how Unleash guarantees that the same user gets the same variant every time
      - `payload` (object, optional) — Extra data configured for this variant
        - `type` (enum, required) — The type of the value. Commonly used types are string, number, json and csv.
          - Allowed values: `json`, `csv`, `string`, `number`
        - `value` (string, required) — The actual value of payload
      - `overrides` (list of object, optional) — 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.
        - `contextName` (string, required) — The name of the context field used to determine overrides
        - `values` (list of string, required) — Which values that should be overriden
- `warnings` (object, optional) — Warnings that occurred during evaluation.
  - `invalidContextProperties` (list of string, optional) — A list of top-level context properties that were provided as input that are not valid due to being the wrong type.

## Examples

**Request**

```json
{
  "context": {
    "appName": "My cool application."
  }
}
```

**Response**

```json
{
  "input": {
    "environments": [
      "development",
      "production"
    ],
    "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",
      "environment": "string"
    },
    "projects": [
      "my-project"
    ]
  },
  "features": [
    {
      "name": "my-feature",
      "projectId": "my-project",
      "environments": {}
    }
  ],
  "warnings": {
    "invalidContextProperties": [
      "string"
    ]
  }
}
```

**SDK Code**

```python
import requests

url = "https://app.unleash-instance.example.com/api/admin/playground/change-request/id"

payload = { "context": { "appName": "My cool application." } }
headers = {
    "Authorization": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.unleash-instance.example.com/api/admin/playground/change-request/id';
const options = {
  method: 'POST',
  headers: {Authorization: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"context":{"appName":"My cool application."}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.unleash-instance.example.com/api/admin/playground/change-request/id"

	payload := strings.NewReader("{\n  \"context\": {\n    \"appName\": \"My cool application.\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.unleash-instance.example.com/api/admin/playground/change-request/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"context\": {\n    \"appName\": \"My cool application.\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://app.unleash-instance.example.com/api/admin/playground/change-request/id")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"context\": {\n    \"appName\": \"My cool application.\"\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.unleash-instance.example.com/api/admin/playground/change-request/id', [
  'body' => '{
  "context": {
    "appName": "My cool application."
  }
}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.unleash-instance.example.com/api/admin/playground/change-request/id");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"context\": {\n    \"appName\": \"My cool application.\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["context": ["appName": "My cool application."]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.unleash-instance.example.com/api/admin/playground/change-request/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```