0

Update sticky note item

by
Published Oct 17, 2025

Updates a sticky note item on a board based on the data and style properties provided in the request body.Required scope boards:write Rate limiting Level 2

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 sticky note item
7
 * Updates a sticky note item on a board based on the data and style properties provided in the request body.Required scope boards:write Rate limiting Level 2
8
 */
9
export async function main(
10
  auth: Miro,
11
  board_id: string,
12
  item_id: string,
13
  body: {
14
    data?: { content?: string; shape?: "square" | "rectangle" };
15
    style?: {
16
      fillColor?:
17
        | "gray"
18
        | "light_yellow"
19
        | "yellow"
20
        | "orange"
21
        | "light_green"
22
        | "green"
23
        | "dark_green"
24
        | "cyan"
25
        | "light_pink"
26
        | "pink"
27
        | "violet"
28
        | "red"
29
        | "light_blue"
30
        | "blue"
31
        | "dark_blue"
32
        | "black";
33
      textAlign?: "left" | "right" | "center";
34
      textAlignVertical?: "top" | "middle" | "bottom";
35
    };
36
    position?: { x?: number; y?: number };
37
    geometry?: { height?: number; width?: number };
38
    parent?: { id?: string };
39
  },
40
) {
41
  const url = new URL(
42
    `https://api.miro.com//v2/boards/${board_id}/sticky_notes/${item_id}`,
43
  );
44

45
  const response = await fetch(url, {
46
    method: "PATCH",
47
    headers: {
48
      "Content-Type": "application/json",
49
      Authorization: "Bearer " + auth.token,
50
    },
51
    body: JSON.stringify(body),
52
  });
53
  if (!response.ok) {
54
    const text = await response.text();
55
    throw new Error(`${response.status} ${text}`);
56
  }
57
  return await response.json();
58
}
59