0

Create tag

by
Published Oct 17, 2025

Creates a tag on a board.Required scope boards:write Rate limiting Level 1

Script miro Verified

The script

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

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