0

Update app card item

by
Published Oct 17, 2025

Updates an app card 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 app card item
7
 * Updates an app card 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?: {
15
      description?: string;
16
      fields?: {
17
        fillColor?: string;
18
        iconShape?: "round" | "square";
19
        iconUrl?: string;
20
        textColor?: string;
21
        tooltip?: string;
22
        value?: string;
23
      }[];
24
      status?: "disconnected" | "connected" | "disabled";
25
      title?: string;
26
    };
27
    style?: { fillColor?: string };
28
    position?: { x?: number; y?: number };
29
    geometry?: { height?: number; rotation?: number; width?: number };
30
    parent?: { id?: string };
31
  },
32
) {
33
  const url = new URL(
34
    `https://api.miro.com//v2/boards/${board_id}/app_cards/${item_id}`,
35
  );
36

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