0

Update tag

by
Published Oct 17, 2025

Updates a tag based on the data properties provided in the request body.

Script miro Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Miro = {
3
  token: string;
4
};
5
/**
6
 * Update tag
7
 * Updates a tag based on the data properties provided in the request body.
8
 */
9
export async function main(
10
  auth: Miro,
11
  board_id: string,
12
  tag_id: string,
13
  body: {
14
    fillColor?:
15
      | "red"
16
      | "light_green"
17
      | "cyan"
18
      | "yellow"
19
      | "magenta"
20
      | "green"
21
      | "blue"
22
      | "gray"
23
      | "violet"
24
      | "dark_green"
25
      | "dark_blue"
26
      | "black";
27
    title?: string;
28
  },
29
) {
30
  const url = new URL(
31
    `https://api.miro.com//v2/boards/${board_id}/tags/${tag_id}`,
32
  );
33

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