---
title: Conclude experiment
slug: feature-experimentation/api/conclude-experiment
docTags: 
createdAt: 2026-09-18T02:55:25.934Z
---

::::CodeDrawer{title="Conclude experiment" isResponseExpanded="true" autoGeneratedAnchorSlug="conclude-experiment" legacyHash="NSOcO5rJx_NlYQrQPjPAu"}
:::CodeblockTabsExamples
```javascript
# ---------------------------------------------------------------------------- #
#                             Conclude experiment.                             #
# ---------------------------------------------------------------------------- # 

PATCH {{flagsUrl}}/projects/{{projectId}}/flags/{{flagKey}}/environments/{{environment}}/ruleset
Content-Type: application/json
Authorization: {{token}}

[
    {
        "op": "replace",
        "path": "/rules/stock_message_test/status",
        "value": "concluded"
    },
    {
        "op": "replace",
        "path": "/rules/stock_message_test/outcome",
        "value": "positive"
    },
    {
        "op": "replace",
        "path": "/rules/stock_message_test/comment",
        "value": "We saw a statistically significant uplift with the \"On Show Amounts Red\" variation!"
    },
    {
        "op": "replace",
        "path": "/rules/stock_message_test/deployed_variation_key",
        "value": "on_show_amounts_red"
    },
    {
        "op": "replace",
        "path": "/rules/stock_message_test/deployed_td_rule_percentage_included",
        "value": 10000
    },
    {
        "op": "replace",
        "path": "/rules/stock_message_test/deployed_td_rule_audience_conditions",
        "value": []
    }
]
```
:::

:::CodeblockTabsResponses
```javascript
{"success":true}
```
:::
::::

Stop your flag and conclude your experiment using the [Update the Ruleset for a Flag in an Environment](https://docs.developers.optimizely.com/feature-experimentation/reference/update_ruleset) API endpoint.

## Prerequisite

Before running this request, you must follow the instructions to configure your [REST API cookbook](https://docs.developers.optimizely.com/feature-experimentation/reference/set-up-visual-basic-to-run-rest-api-calls).

## Create a file

Create a file named `conclude-experiment.rest` and copy and paste the recipe into the file.

## Configure API

`{{flagsUrl}}`, `{{projectId}}`, `{{flagKey}}`, `{{environment}}`, and `{{token}}` are defined in the `settings.json` file. Ensure you have configured your Visual Studio Code project correctly. See [Configure the Visual Studio Code REST Client](https://docs.developers.optimizely.com/feature-experimentation/reference/set-up-visual-basic-to-run-rest-api-calls#configure-the-visual-studio-code-rest-client).

```json
PATCH {{flagsUrl}}/projects/{{projectId}}/flags/{{flagKey}}/environments/{{environment}}/ruleset
Content-Type: application/json
Authorization: {{token}}
```

## Update rule's status

Update the `stock_message_test` rule's status to `concluded`.

- **op (operation)** – This is a replace.
- **path** – A JSON-Pointer to the resource or the resource attribute.
- **value** – Replace to `concluded`.

```json
{
    "op": "replace",
    "path": "/rules/stock_message_test/status",
    "value": "concluded"
},
```

## Update rule's outcome

Update the `stock_message_test` rule's outcome to `positive`.

- **op (operation)** – This is a replace.
- **path** – A JSON-Pointer to the resource or the resource attribute.
- **value** – Replace to `positive`.

```json
{
    "op": "replace",
    "path": "/rules/stock_message_test/outcome",
    "value": "positive"
},
```

## Add a comment to the outcome

Update the `stock_message_test` rule's comment to `We saw a statistically significant uplift with the "On Show Amounts Red" variation!`.

- **op (operation)** – This is a replace.
- **path** – A JSON-Pointer to the resource or the resource attribute.
- **value** – Add outcome message.

The three previous steps correspond to the following in the UI:

```json
{
    "op": "replace",
    "path": "/rules/stock_message_test/comment",
    "value": "We saw a statistically significant uplift with the \"On Show Amounts Red\" variation!"
},
```

## Change deployed variation

Deploy the winning variation by updating the variation key to `on_show_amounts_red`.

- **op (operation)** – This is a replace.
- **path** – A JSON-Pointer to the resource or the resource attribute.
- **value** – Replace to `on_show_amounts_red` variation.

```json
{
    "op": "replace",
    "path": "/rules/stock_message_test/deployed_variation_key",
    "value": "on_show_amounts_red"
},
```

## Change percentage included

Deploy the winning variation to 100% of the audience.

- **op (operation)** – This is a replace.
- **path** – A JSON-Pointer to the resource or the resource attribute.
- **value** – Change percentage included.

```json
{
    "op": "replace",
    "path": "/rules/stock_message_test/deployed_td_rule_percentage_included",
    "value": 10000
},
```

## Change audience

Update the audience to everyone.

- **op (operation)** – This is a replace.
- **path** – A JSON-Pointer to the resource or the resource attribute.
- **value** – Change the audience to empty.

The three previous steps correspond to the following in the UI:

```json
{
    "op": "replace",
    "path": "/rules/stock_message_test/deployed_td_rule_audience_conditions",
    "value": []
}
```

## Send request

Click **Send Request** in Visual Studio Code. See the [REST Client's documentation on usage](https://marketplace.visualstudio.com/items?itemName=humao.rest-client#usage) for information on how to send requests using the REST Client extension.
