Update Cohort
curl --request PATCH \
--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>"
}
'import requests
url = "https://api.sandbox.metriport.com/medical/v1/cohort/{id}"
payload = {
"name": "<string>",
"color": "<string>",
"description": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', color: '<string>', description: '<string>'})
};
fetch('https://api.sandbox.metriport.com/medical/v1/cohort/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.metriport.com/medical/v1/cohort/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'color' => '<string>',
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.metriport.com/medical/v1/cohort/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.sandbox.metriport.com/medical/v1/cohort/{id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.metriport.com/medical/v1/cohort/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyimport { 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."
}
);
Cohort
Update Cohort
Updates the details of an existing cohort (name, description, color).
PATCH
/
medical
/
v1
/
cohort
/
{id}
Update Cohort
curl --request PATCH \
--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>"
}
'import requests
url = "https://api.sandbox.metriport.com/medical/v1/cohort/{id}"
payload = {
"name": "<string>",
"color": "<string>",
"description": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', color: '<string>', description: '<string>'})
};
fetch('https://api.sandbox.metriport.com/medical/v1/cohort/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.metriport.com/medical/v1/cohort/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'color' => '<string>',
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.metriport.com/medical/v1/cohort/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.sandbox.metriport.com/medical/v1/cohort/{id}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.metriport.com/medical/v1/cohort/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyimport { 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."
}
);
For more information, see the guide about Cohorts
In this example, only the
This removes the description and leaves the rest of the details the same.
Path Params
string
required
The ID of the cohort to update.
Headers
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
string
The name of the cohort. The name must be unique within your organization.
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.string
A description of the cohort and its purpose.
Examples
Partial update example:{
"name": "Updated Cohort Name"
}
name field is updated. All other fields remain unchanged.
Clearing fields example:
{
"description": ""
}
Response
string
required
The unique identifier for the cohort (UUID format, e.g.,
00000000-0000-0000-0000-000000000000).string
required
The entity tag for optimistic concurrency control.
string
required
The unique name of the cohort within your organization.
string
required
The description of the cohort.
string
required
The color associated with the cohort.
object
required
Configuration settings for the cohort.
Show Settings properties
Show Settings properties
object
Hide monitoring object properties
Hide monitoring object properties
object
HIE-based document monitoring - subscribes patients to HIE-based
document monitoring (non-ADT) / medical record refresh based on the cadence.
Show hie object properties
Show hie object properties
boolean
Enable or disable scheduled data pulls for HIE monitoring. Defaults to disabled.
When disabled, no scheduled pulls will occur regardless of the frequency setting.
string
How often scheduled data pulls should occur, can be one of
weekly or biweekly or monthly. Defaults to monthly.See scheduled queries
for timing details.
HIE monitoring is coming soon! While this feature is not yet live, you can configure
your HIE monitoring settings now. These settings will automatically take effect when the feature launches.
object
ADT (Admission, Discharge, Transfer) monitoring - subscribes patients to ADT notifications
based on their primary address.
Show adt object properties
Show adt object properties
boolean
Enable or disable ADT monitoring notifications. Defaults to disabled.
object
Pharmacy / medication history monitoring - enables retail fill data monitoring where available.
Show pharmacy object properties
Show pharmacy object properties
boolean
Enable/disable pharmacy monitoring notifications. Defaults to disabled.
object
Enable pharmacy data pulls at scheduled dates.
Show schedule object properties
Show schedule object properties
boolean
Enable or disable scheduled data pulls for pharmacy monitoring. When disabled, no
scheduled pulls will occur regardless of the frequency setting. Defaults to disabled.
string
How often scheduled data pulls should occur, can be one of
weekly or biweekly or monthly. Defaults to monthly.See scheduled queries
for timing details.
Pharmacy monitoring is coming soon! While this feature is not yet live, you can configure
your Pharmacy monitoring settings now. These settings will automatically take effect when the feature launches.
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(
{
id: "00000000-0000-0000-0000-000000000000",
name: "High Risk",
description: "Patients that need frequent and robust monitoring."
}
);
{
"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
}
⌘I

