0

Remove Guest From Task

by
Published Oct 17, 2025

Revoke a guest's access to a task. \ \ ***Note:** This endpoint is only available to Workspaces on our [Enterprise Plan](https://clickup.com/pricing).*

Script clickup Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Clickup = {
3
  token: string;
4
};
5
/**
6
 * Remove Guest From Task
7
 * Revoke a guest's access to a task. \
8
 \
9
***Note:** This endpoint is only available to Workspaces on our [Enterprise Plan](https://clickup.com/pricing).*
10
 */
11
export async function main(
12
  auth: Clickup,
13
  task_id: string,
14
  guest_id: string,
15
  include_shared: string | undefined,
16
  custom_task_ids: string | undefined,
17
  team_id: string | undefined,
18
) {
19
  const url = new URL(
20
    `https://api.clickup.com/api/v2/task/${task_id}/guest/${guest_id}`,
21
  );
22
  for (const [k, v] of [
23
    ["include_shared", include_shared],
24
    ["custom_task_ids", custom_task_ids],
25
    ["team_id", team_id],
26
  ]) {
27
    if (v !== undefined && v !== "" && k !== undefined) {
28
      url.searchParams.append(k, v);
29
    }
30
  }
31
  const response = await fetch(url, {
32
    method: "DELETE",
33
    headers: {
34
      Authorization: auth.token,
35
    },
36
    body: undefined,
37
  });
38
  if (!response.ok) {
39
    const text = await response.text();
40
    throw new Error(`${response.status} ${text}`);
41
  }
42
  return await response.json();
43
}
44