0

Update Goal

by
Published Oct 17, 2025

Rename a Goal, set the due date, replace the description, add or remove owners, and set the Goal color.

Script clickup Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Clickup = {
3
  token: string;
4
};
5
/**
6
 * Update Goal
7
 * Rename a Goal, set the due date, replace the description, add or remove owners, and set the Goal color.
8
 */
9
export async function main(
10
  auth: Clickup,
11
  goal_id: string,
12
  body: {
13
    name: string;
14
    due_date: number;
15
    description: string;
16
    rem_owners: number[];
17
    add_owners: number[];
18
    color: string;
19
  },
20
) {
21
  const url = new URL(`https://api.clickup.com/api/v2/goal/${goal_id}`);
22

23
  const response = await fetch(url, {
24
    method: "PUT",
25
    headers: {
26
      "Content-Type": "application/json",
27
      Authorization: auth.token,
28
    },
29
    body: JSON.stringify(body),
30
  });
31
  if (!response.ok) {
32
    const text = await response.text();
33
    throw new Error(`${response.status} ${text}`);
34
  }
35
  return await response.json();
36
}
37