0

Update project

by
Published Oct 17, 2025

Update a specific project. Only the params included in the operation will update the project.

Script holded Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Holded = {
3
  apiKey: string;
4
};
5
/**
6
 * Update project
7
 * Update a specific project.
8

9
Only the params included in the operation will update the project.
10
 */
11
export async function main(
12
  auth: Holded,
13
  projectId: string,
14
  body: {
15
    name?: string;
16
    desc?: string;
17
    tags?: string[];
18
    contactName?: string;
19
    date?: number;
20
    dueDate?: number;
21
    status?: number;
22
    lists?: { id?: string; key?: string; name?: string; desc?: string }[];
23
    billable?: number;
24
    price?: number;
25
    labels?: { id?: string; name?: string; color?: string }[];
26
  },
27
) {
28
  const url = new URL(
29
    `https://api.holded.com/api/projects/v1/projects/${projectId}`,
30
  );
31

32
  const response = await fetch(url, {
33
    method: "PUT",
34
    headers: {
35
      "Content-Type": "application/json",
36
      key: auth.apiKey,
37
    },
38
    body: JSON.stringify(body),
39
  });
40
  if (!response.ok) {
41
    const text = await response.text();
42
    throw new Error(`${response.status} ${text}`);
43
  }
44
  return await response.json();
45
}
46