Skip to main content
PUT
/
medical
/
v1
/
cohort
/
{id}
Update Cohort
curl --request PUT \
  --url https://api.sandbox.metriport.com/medical/v1/cohort/{id} \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "name": "<string>",
  "color": "<string>",
  "description": "<string>",
  "settings": {
    "monitoring": {
      "hie": {
        "enabled": true,
        "frequency": "<string>"
      },
      "adt": {
        "enabled": true
      },
      "pharmacy": {
        "notifications": true,
        "schedule": {
          "enabled": true,
          "frequency": "<string>"
        }
      },
      "laboratory": {
        "notifications": true,
        "schedule": {
          "enabled": true,
          "frequency": "<string>"
        }
      }
    }
  }
}'
import { MetriportMedicalApi } from "@metriport/api-sdk";

const metriport = new MetriportMedicalApi("YOUR_API_KEY");

const cohort = await metriport.updateCohort(
  "00000000-0000-0000-0000-000000000000",
  {
    name: "High Risk",
    description: "Patients that need frequent and robust monitoring.",
    "settings": {
      "monitoring": {
        "hie": {
          "enabled": true,
          "frequency": "weekly"
        },
        "adt": {
          "enabled": true
        },
        "pharmacy": {
          "notifications": true,
          "schedule": {
            "enabled": false,
            "frequency": "monthly"
          }
        },
        "laboratory": {
          "notifications": true,
          "schedule": {
            "enabled": false,
            "frequency": "monthly"
          }
        }
      }
    }
  }
);
For more information, see the guide about Cohorts

Path Params

id
string
required
The ID of the cohort to update.

Headers

If-Match
string
The ETag value for optimistic concurrency control. If provided, the update will only succeed if the current ETag matches this value.

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
name
string
The name of the cohort. The name must be unique within your organization.
color
string
The color associated with the cohort. Must be one of: red, green, blue, yellow, purple, orange, pink, brown, gray, black, white. Defaults to white on creation if no color is given.
description
string
A description of the cohort and its purpose.
settings
object
Configuration settings for the cohort.

Examples

Partial update example:
{
  "name": "Updated Cohort Name",
  "settings": {
    "monitoring": {
      "adt": {
        "enabled": true
      },
      "pharmacy": {
        "notifications": false,
        "schedule": {
          "enabled": false,
          "frequency": "monthly"
        }
      }
    }
  }
}
In this example, only name, adt, and pharmacy settings are updated. The hie and laboratory settings remain unchanged. Clearing fields example:
{
  "settings": {
    "monitoring": {
      "adt": {
        "enabled": false
      },
      "pharmacy": {
        "notifications": false,
        "schedule": {
          "enabled": false,
          "frequency": "monthly"
        }
      }
    }
  }
}
This disables the adt and pharmacy monitoring settings while leaving other settings intact.

Response

id
string
required
The unique identifier for the cohort (UUID format, e.g., 00000000-0000-0000-0000-000000000000).
eTag
string
required
The entity tag for optimistic concurrency control.
name
string
required
The unique name of the cohort within your organization.
description
string
required
The description of the cohort.
color
string
required
The color associated with the cohort.
settings
object
required
Configuration settings for the cohort.
size
number
required
The number of patients assigned to this cohort.
import { MetriportMedicalApi } from "@metriport/api-sdk";

const metriport = new MetriportMedicalApi("YOUR_API_KEY");

const cohort = await metriport.updateCohort(
  "00000000-0000-0000-0000-000000000000",
  {
    name: "High Risk",
    description: "Patients that need frequent and robust monitoring.",
    "settings": {
      "monitoring": {
        "hie": {
          "enabled": true,
          "frequency": "weekly"
        },
        "adt": {
          "enabled": true
        },
        "pharmacy": {
          "notifications": true,
          "schedule": {
            "enabled": false,
            "frequency": "monthly"
          }
        },
        "laboratory": {
          "notifications": true,
          "schedule": {
            "enabled": false,
            "frequency": "monthly"
          }
        }
      }
    }
  }
);
{
  "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,
        "schedule": {
          "enabled": false,
          "frequency": "monthly"
        }
      }
    }
  },
  "size": 0
}