# Get cases

### Description

This service retrieves cases assigned to the authenticated user. Its behavior adapts based on the login type:

* Operator Login: Returns cases assigned to the current operator.
* Operator "Run as Party": Returns cases belonging to that specific party.
* Party Login: Returns cases belonging to that specific party.

> Note: Cases with a type marked as "Not Visible in APP" are automatically excluded from the results.

***

### Request

#### Restrictions

Requires an authenticated user (successful consumer or operator login).

#### Endpoint

```
GET https://<server-url>/api/v4/cases/{case_id}
```

#### Path Parameters

| **Parameter** | **Type** | **Description**                                                                                             |
| ------------- | -------- | ----------------------------------------------------------------------------------------------------------- |
| `case_id`     | Integer  | Optional. The unique ID of a specific case. If omitted, the service returns all cases assigned to the user. |

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

***

### Response

#### ✅ Successful Response: `200 OK`

**Option 1: All Cases (No `case_id` provided)**

Returns a JSON object containing an array of `cases`.

JSON

```
{  
   "cases": [  
      {  
         "id": 1,
         "categoryCode": "cat_1", 
         "typeCode": "type_1", 
         "status": "Open",
         "resolution": "Unresolved",
         "comments": [ ... ],
         "caseData": { "links": [] },
         "attachements": [ ... ],
         "assignedTo": "user@thalamuscorp.com"
      }
   ]
}
```

**Option 2: Specific Case (`case_id` provided)**

Returns the single case object directly.

JSON

```
{  
   "id": 1,
   "categoryCode": "cat_1", 
   "typeCode": "type_1", 
   "status": "Open",
   "resolution": "Unresolved",
   "comments": [
      {  
         "caseInstanceId": 1,
         "description": "First Note"
      }
   ],
   "caseData": { "links": [] },
   "attachements": [
      {
         "id": 1,
         "url": "https://thalamus-files.s3.amazonaws.com/..."
      }
   ],
   "assignedTo": "user@thalamuscorp.com"
}
```

***

### ❌ Unsuccessful Response

#### `400 Bad Request`

| **Error Code** | **Description**                                                                                                               |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `invalidId`    | The `caseInstanceId` does not exist, or the authenticated operator/touchpoint is not authorized to access this specific case. |
