0

Delete Dependency

by
Published Oct 17, 2025

Remove the dependency relationship between two or more tasks.

Script clickup Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Clickup = {
3
  token: string;
4
};
5
/**
6
 * Delete Dependency
7
 * Remove the dependency relationship between two or more tasks.
8
 */
9
export async function main(
10
  auth: Clickup,
11
  task_id: string,
12
  depends_on: string | undefined,
13
  dependency_of: string | undefined,
14
  custom_task_ids: string | undefined,
15
  team_id: string | undefined,
16
) {
17
  const url = new URL(
18
    `https://api.clickup.com/api/v2/task/${task_id}/dependency`,
19
  );
20
  for (const [k, v] of [
21
    ["depends_on", depends_on],
22
    ["dependency_of", dependency_of],
23
    ["custom_task_ids", custom_task_ids],
24
    ["team_id", team_id],
25
  ]) {
26
    if (v !== undefined && v !== "" && k !== undefined) {
27
      url.searchParams.append(k, v);
28
    }
29
  }
30
  const response = await fetch(url, {
31
    method: "DELETE",
32
    headers: {
33
      Authorization: auth.token,
34
    },
35
    body: undefined,
36
  });
37
  if (!response.ok) {
38
    const text = await response.text();
39
    throw new Error(`${response.status} ${text}`);
40
  }
41
  return await response.json();
42
}
43