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

# Delete Cohort

> Deletes a cohort if the cohort is empty.

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

<Warning>
  **Prerequisites:** You must remove all patients from a cohort before deleting it. If there
  are still patients in the cohort, the API will return a 400 error.

  Use the [remove patients from cohort endpoint](/medical-api/api-reference/cohort/remove-patients-from-cohort)
  to clear all patients first.
</Warning>

## Path Params

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

## Response

`204` - No Content, upon successful delete.

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

  const metriport = new MetriportMedicalApi("YOUR_API_KEY");

  const cohortId = "00000000-0000-0000-0000-000000000000";
  await metriport.deleteCohort(cohortId);
  ```
</ResponseExample>
