# Change case status

### Description

This service allows an operator to update the status of a specific case (e.g., moving it from "Open" to "Resolved"). This is specifically used for managing the workflow transitions of a case instance.

***

### Request

#### Restrictions

* Authentication: Requires a successful login as an operator.
* State Logic: A status change cannot be performed if the case is already in a "Closed" state.

#### Endpoint

```
PUT https://<server-url>/api/v4/cases/{caseInstanceId}/transitions
```

#### Path Parameters

| **Parameter**    | **Type** | **Description**                                   |
| ---------------- | -------- | ------------------------------------------------- |
| `caseInstanceId` | Integer  | The unique ID of the case instance to transition. |

#### Parameters

| **Parameter**  | **Location**   | **Description**                                                                    |
| -------------- | -------------- | ---------------------------------------------------------------------------------- |
| `touchpoint`   | Query / Header | The identifier for the touchpoint. Use `Thalamus-Touchpoint` for the header.       |
| `token`        | Query / Header | The authentication token for the API session. Use `Thalamus-Token` for the header. |
| `Content-Type` | Header         | Must be `application/json`.                                                        |

#### Request Body

| **Field**    | **Type** | **Description**                                                                             |
| ------------ | -------- | ------------------------------------------------------------------------------------------- |
| `statusName` | String   | Required. The name of the new status to apply (e.g., "resolved", "closed", "in\_progress"). |

Example Body:

```
{ 
    "statusName": "resolved"  
}
```

***

### Response

#### ✅ Successful Response: `201 Created`

The transition was successful. The response returns the session `context` and the updated `case` object reflecting the new status.

JSON

```
{  
   "context": {  
      "simpleProfile": {  
         "firstname": "test",
         "email": "test@test.com"
      }
   },
   "case": {  
      "id": 10,
      "categoryCode": "Reclamo", 
      "typeCode": "Telefonico", 
      "status": "resolved",
      "resolution": "Tecnica"
   }
}
```

***

### ❌ Unsuccessful Response

#### `400 Bad Request`

| **Error Code**         | **Description**                                                                                            |
| ---------------------- | ---------------------------------------------------------------------------------------------------------- |
| `invalidId`            | The `caseInstanceId` is invalid, or the authenticated operator/touchpoint is not authorized for this case. |
| `invalid`              | The provided `statusName` is not a valid status for this case type.                                        |
| `statusIsAlreadyClose` | The transition failed because the case is already closed and its status can no longer be changed.          |
