> 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.

# Update change request state

PUT https://app.unleash-instance.example.com/api/admin/projects/{projectId}/change-requests/{id}/state

**Enterprise feature**

This endpoint will update the state of a change request if the business rules allow it. The state can be one of the following: Draft, In review, Approved, Cancelled, Applied. In order to be approved, the change request must have at least one change and the number of approvals must be greater than or equal to the number of approvals required for the environment.

Once a change request has been approved, it can be applied. Once a change request has been applied, it cannot be changed. Once a change request has been cancelled, it cannot be changed. Any change to a change request in the state of Approved will result in the state being set to In Review and the number of approvals will be reset.

Reference: https://docs.getunleash.io/api/update-change-request-state

## 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

- `projectId` (string, required)
- `id` (string, required)

## Response

### 200

changeRequestSchema

- `object or object`
  - object
    - `id` (double, required) — This change requests's ID.
    - `environment` (string, required) — The environment in which the changes should be applied.
    - `minApprovals` (double, required) — The minimum number of approvals required before this change request can be applied.
    - `project` (string, required) — The project this change request belongs to.
    - `features` (list of object, required) — The list of features and their changes that relate to this change request.
      - `name` (string, required) — The name of the feature
      - `changes` (list of object, required) — List of changes inside change request. This list may be empty when listing all change requests for a project.
        - `id` (double, required) — The ID of this change.
        - `action` (string, required) — The kind of action that the change contains information about.
        - `conflict` (string, optional) — A description of the conflict caused by this change. Only present if there are any conflicts.
        - `payload` (string or boolean or map from string to any or double or list of object, optional) — The data required to perform this action.
        - `createdBy` (object, optional) — The user who created this change.
          - `username` (string, optional, nullable) — The user's username.
          - `imageUrl` (string, optional, nullable) — The URL where the user's image can be found.
        - `createdAt` (string, optional) — When this change was suggested
        - `scheduleConflicts` (object, optional) — Information about scheduled change requests that would casue conflicts with this change if applied.
          - `changeRequests` (list of object, required) — The list of scheduled change requests that would cause conflict with this change.
            - `id` (double, required) — The ID of the change request.
            - `title` (string, optional) — The title of the change request, if any. Only present if there is a title.
      - `conflict` (string, optional) — A string describing the conflicts related to this change. Only present if there are any conflicts on the feature level.
      - `defaultChange` (object, optional) — A description of a default change that will be applied with the change request to prevent invalid states. Default changes are changes that are applied in addition to explicit user-specified changes when a change request is applied. Any default changes are applied in the background and are not a real part of the change request.
        - `action` (string, required) — The kind of action this is.
        - `payload` (object, required) — The necessary data to perform this change.
    - `segments` (list of object, required) — The list of segments and their changes that relate to this change request.
      - `id` (double, required) — The ID of this change.
      - `action` (string, required) — The kind of action that the change contains information about.
      - `payload` (string or boolean or map from string to any or double or list of object, required) — The data required to perform this action.
      - `name` (string, required) — The current name of the segment
      - `conflict` (string, optional) — A description of the conflict caused by this change. Only present if there are any conflicts.
      - `createdBy` (object, optional) — The user who created this change.
        - `username` (string, optional, nullable) — The user's username.
        - `imageUrl` (string, optional, nullable) — The URL where the user's image can be found.
      - `createdAt` (string, optional) — When this change was suggested
      - `scheduleConflicts` (object, optional) — Information about scheduled change requests that would casue conflicts with this change if applied.
        - `changeRequests` (list of object, required) — The list of scheduled change requests that would cause conflict with this change.
          - `id` (double, required) — The ID of the change request.
          - `title` (string, optional) — The title of the change request, if any. Only present if there is a title.
    - `createdBy` (object, required) — The user who created this change request.
      - `username` (string, optional, nullable)
      - `imageUrl` (string, optional, nullable) — The URL of the user's profile image.
    - `createdAt` (string, required) — When this change request was created.
    - `stateTimestamps` (map from string to string, required) — A mapping of each state this change request has entered to the most recent time when it entered that state. If a change request has entered the same state multiple times, only the most recent timestamp will be included.
    - `state` (enum, required) — The current state of the change request.
      - Allowed values: `Draft`, `In review`, `Approved`, `Applied`, `Cancelled`, `Rejected`
    - `title` (string, optional) — A title describing the change request's content.
    - `approvals` (list of object, optional) — A list of approvals that this change request has received.
      - `createdBy` (object, required) — Information about the user who gave this approval.
        - `id` (double, optional) — The ID of the user who gave this approval.
        - `username` (string, optional) — The approving user's username.
        - `imageUrl` (string, optional) — The URL where the user's image can be found.
      - `createdAt` (string, required) — When the approval was given.
    - `rejections` (list of object, optional) — A list of rejections that this change request has received.
      - `createdBy` (object, required) — Information about the user who gave this approval.
        - `id` (double, optional) — The ID of the user who gave this approval.
        - `username` (string, optional) — The approving user's username.
        - `imageUrl` (string, optional) — The URL where the user's image can be found.
      - `createdAt` (string, required) — When the approval was given.
    - `comments` (list of object, optional) — All comments that have been made on this change request.
      - `text` (string, required) — The content of the comment.
      - `createdBy` (object, required) — Information about the user who posted the comment
        - `username` (string, optional, nullable) — The user's username.
        - `imageUrl` (string, optional, nullable) — The URL where the user's image can be found.
      - `createdAt` (string, required) — When the comment was made.
      - `id` (double, optional) — The comment's ID. Unique per change request.
  - object
    - `id` (double, required) — This change requests's ID.
    - `environment` (string, required) — The environment in which the changes should be applied.
    - `minApprovals` (double, required) — The minimum number of approvals required before this change request can be applied.
    - `project` (string, required) — The project this change request belongs to.
    - `features` (list of object, required) — The list of features and their changes that relate to this change request.
      - `name` (string, required) — The name of the feature
      - `changes` (list of object, required) — List of changes inside change request. This list may be empty when listing all change requests for a project.
        - `id` (double, required) — The ID of this change.
        - `action` (string, required) — The kind of action that the change contains information about.
        - `conflict` (string, optional) — A description of the conflict caused by this change. Only present if there are any conflicts.
        - `payload` (string or boolean or map from string to any or double or list of object, optional) — The data required to perform this action.
        - `createdBy` (object, optional) — The user who created this change.
          - `username` (string, optional, nullable) — The user's username.
          - `imageUrl` (string, optional, nullable) — The URL where the user's image can be found.
        - `createdAt` (string, optional) — When this change was suggested
        - `scheduleConflicts` (object, optional) — Information about scheduled change requests that would casue conflicts with this change if applied.
          - `changeRequests` (list of object, required) — The list of scheduled change requests that would cause conflict with this change.
            - `id` (double, required) — The ID of the change request.
            - `title` (string, optional) — The title of the change request, if any. Only present if there is a title.
      - `conflict` (string, optional) — A string describing the conflicts related to this change. Only present if there are any conflicts on the feature level.
      - `defaultChange` (object, optional) — A description of a default change that will be applied with the change request to prevent invalid states. Default changes are changes that are applied in addition to explicit user-specified changes when a change request is applied. Any default changes are applied in the background and are not a real part of the change request.
        - `action` (string, required) — The kind of action this is.
        - `payload` (object, required) — The necessary data to perform this change.
    - `segments` (list of object, required) — The list of segments and their changes that relate to this change request.
      - `id` (double, required) — The ID of this change.
      - `action` (string, required) — The kind of action that the change contains information about.
      - `payload` (string or boolean or map from string to any or double or list of object, required) — The data required to perform this action.
      - `name` (string, required) — The current name of the segment
      - `conflict` (string, optional) — A description of the conflict caused by this change. Only present if there are any conflicts.
      - `createdBy` (object, optional) — The user who created this change.
        - `username` (string, optional, nullable) — The user's username.
        - `imageUrl` (string, optional, nullable) — The URL where the user's image can be found.
      - `createdAt` (string, optional) — When this change was suggested
      - `scheduleConflicts` (object, optional) — Information about scheduled change requests that would casue conflicts with this change if applied.
        - `changeRequests` (list of object, required) — The list of scheduled change requests that would cause conflict with this change.
          - `id` (double, required) — The ID of the change request.
          - `title` (string, optional) — The title of the change request, if any. Only present if there is a title.
    - `createdBy` (object, required) — The user who created this change request.
      - `username` (string, optional, nullable)
      - `imageUrl` (string, optional, nullable) — The URL of the user's profile image.
    - `createdAt` (string, required) — When this change request was created.
    - `stateTimestamps` (map from string to string, required) — A mapping of each state this change request has entered to the most recent time when it entered that state. If a change request has entered the same state multiple times, only the most recent timestamp will be included.
    - `state` (enum, required) — The current state of the change request.
      - Allowed values: `Scheduled`
    - `schedule` (object or object or object, required) — A schedule for a change request's application. The schedule can either be pending, failed, or suspended. The schedule will always contain the state of the schedule and the last scheduled time, but other data varies between the different states.
      - object
        - `scheduledAt` (string, required) — When this change request will be applied.
        - `status` (enum, required) — The status of the schedule.
          - Allowed values: `pending`
      - object
        - `scheduledAt` (string, required) — When Unleash last attempted to apply this change request.
        - `status` (enum, required) — The status of the schedule.
          - Allowed values: `failed`
        - `reason` (string, required) — The reason the scheduled failed to apply.
        - `failureReason` (string, optional, nullable, deprecated) — The reason the scheduled failed to apply. Deprecated in favor of the `reason` property.
      - object
        - `scheduledAt` (string, required) — When Unleash would have attempted to apply this change request if the schedule was not suspended.
        - `status` (enum, required) — The status of the schedule.
          - Allowed values: `suspended`
        - `reason` (string, required) — Why the schedule was suspended.
    - `title` (string, optional) — A title describing the change request's content.
    - `approvals` (list of object, optional) — A list of approvals that this change request has received.
      - `createdBy` (object, required) — Information about the user who gave this approval.
        - `id` (double, optional) — The ID of the user who gave this approval.
        - `username` (string, optional) — The approving user's username.
        - `imageUrl` (string, optional) — The URL where the user's image can be found.
      - `createdAt` (string, required) — When the approval was given.
    - `rejections` (list of object, optional) — A list of rejections that this change request has received.
      - `createdBy` (object, required) — Information about the user who gave this approval.
        - `id` (double, optional) — The ID of the user who gave this approval.
        - `username` (string, optional) — The approving user's username.
        - `imageUrl` (string, optional) — The URL where the user's image can be found.
      - `createdAt` (string, required) — When the approval was given.
    - `comments` (list of object, optional) — All comments that have been made on this change request.
      - `text` (string, required) — The content of the comment.
      - `createdBy` (object, required) — Information about the user who posted the comment
        - `username` (string, optional, nullable) — The user's username.
        - `imageUrl` (string, optional, nullable) — The URL where the user's image can be found.
      - `createdAt` (string, required) — When the comment was made.
      - `id` (double, optional) — The comment's ID. Unique per change request.

## Examples

**Response**

```json
{
  "approvals": [
    {
      "createdAt": "2022-12-12T12:13:24.218Z",
      "createdBy": {
        "id": 33,
        "imageUrl": "string",
        "username": "unleash-user"
      }
    }
  ],
  "comments": [
    {
      "createdAt": "2022-12-12T12:13:24.218Z",
      "createdBy": {
        "imageUrl": "string",
        "username": "unleash-user"
      },
      "id": 33,
      "text": "This is a comment"
    }
  ],
  "createdAt": "2023-07-31T13:33:02Z",
  "createdBy": {
    "imageUrl": "string",
    "username": "Hunter"
  },
  "environment": "development",
  "features": [
    {
      "changes": [
        {
          "action": "updateStrategy",
          "conflict": "Strategy has been deleted",
          "createdAt": "2023-07-31T13:22:03+02:00",
          "createdBy": {
            "imageUrl": "string",
            "username": "string"
          },
          "id": 33,
          "payload": {},
          "scheduleConflicts": {
            "changeRequests": [
              {
                "id": 1.1,
                "title": "string"
              }
            ]
          }
        }
      ],
      "conflict": "Feature has been archived",
      "defaultChange": {
        "action": "addStrategy",
        "payload": {
          "constraints": [
            {
              "caseInsensitive": false,
              "contextName": "userId",
              "inverted": false,
              "operator": "STR_CONTAINS",
              "values": [
                "ux"
              ]
            }
          ],
          "disabled": false,
          "name": "flexibleRollout",
          "parameters": {
            "groupId": "my-feature",
            "rollout": "100",
            "stickiness": "default"
          },
          "segments": [],
          "title": ""
        }
      },
      "name": "my-feature"
    }
  ],
  "id": 3,
  "minApprovals": 2,
  "project": "unleash-project",
  "rejections": [
    {
      "createdAt": "2022-12-12T12:13:24.218Z",
      "createdBy": {
        "id": 33,
        "imageUrl": "string",
        "username": "unleash-user"
      }
    }
  ],
  "segments": [
    {
      "action": "updateStrategy",
      "conflict": "Strategy has been deleted",
      "createdAt": "2023-07-31T13:22:03+02:00",
      "createdBy": {
        "imageUrl": "string",
        "username": "string"
      },
      "id": 33,
      "name": "beta-users",
      "payload": {},
      "scheduleConflicts": {
        "changeRequests": [
          {
            "id": 1.1,
            "title": "string"
          }
        ]
      }
    }
  ],
  "state": "Draft",
  "stateTimestamps": {
    "Approved": "2023-08-02T09:01:00Z",
    "Draft": "2023-07-31T13:33:02Z",
    "In review": "2023-08-01T10:15:30Z"
  },
  "title": "Increasing gradual rollout"
}
```

**SDK Code**

```python
import requests

url = "https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/state"

headers = {"Authorization": "<apiKey>"}

response = requests.put(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/state';
const options = {method: 'PUT', headers: {Authorization: '<apiKey>'}};

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"
	"net/http"
	"io"
)

func main() {

	url := "https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/state"

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("Authorization", "<apiKey>")

	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/projects/projectId/change-requests/id/state")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = '<apiKey>'

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.put("https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/state")
  .header("Authorization", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/state', [
  'headers' => [
    'Authorization' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/state");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.unleash-instance.example.com/api/admin/projects/projectId/change-requests/id/state")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers

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()
```