> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metriport.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Cohort

> Updates the details of an existing cohort (name, description, color).

For more information, see the [guide about Cohorts](/medical-api/handling-data/cohorts)

## Path Params

<ParamField path="id" type="string" required>
  The ID of the cohort to update.
</ParamField>

## Headers

<ParamField header="If-Match" type="string" optional>
  The ETag value for optimistic concurrency control. If
  provided, the update will only succeed if the current ETag
  matches this value.
</ParamField>

## Body

All fields are optional for updates. The API performs partial updates:

* Omitted fields remain unchanged - only include fields you want to modify
* To update a field - simply include the new value

<Snippet file="cohort-update.mdx" />

## Examples

**Partial update example:**

```json theme={null}
{
  "name": "Updated Cohort Name"
}
```

In this example, only the `name` field is updated. All other fields remain unchanged.

**Clearing fields example:**

```json theme={null}
{
  "description": ""
}
```

This removes the description and leaves the rest of the details the same.

## Response

<Snippet file="cohort-response.mdx" />

<ResponseExample>
  ```javascript Metriport SDK theme={null}
  import { MetriportMedicalApi } from "@metriport/api-sdk";

  const metriport = new MetriportMedicalApi("YOUR_API_KEY");

  const cohort = await metriport.updateCohort(
    {
      id: "00000000-0000-0000-0000-000000000000",
      name: "High Risk",
      description: "Patients that need frequent and robust monitoring."
    }
  );
  ```
</ResponseExample>

```json theme={null}
{
  "id": "00000000-0000-0000-0000-000000000000",
  "eTag": "2",
  "name": "High Risk",
  "description": "Patients that need frequent and robust monitoring.",
  "color": "red",
  "settings": {
    "monitoring": {
      "hie": {
        "enabled": true,
        "frequency": "weekly"
      },
      "adt": {
        "enabled": true
      },
      "pharmacy": {
        "notifications": true,
        "schedule": {
          "enabled": false,
          "frequency": "monthly"
        }
      },
      "laboratory": {
        "notifications": true
      }
    }
  },
  "size": 0
}
```
