0

Create app card item

by
Published Oct 17, 2025

Adds an app card item to a board.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
 * Create app card item
7
 * Adds an app card item to a board.Required scope boards:write Rate limiting Level 2
8
 */
9
export async function main(
10
  auth: Miro,
11
  board_id: string,
12
  body: {
13
    data?: {
14
      description?: string;
15
      fields?: {
16
        fillColor?: string;
17
        iconShape?: "round" | "square";
18
        iconUrl?: string;
19
        textColor?: string;
20
        tooltip?: string;
21
        value?: string;
22
      }[];
23
      status?: "disconnected" | "connected" | "disabled";
24
      title?: string;
25
    };
26
    style?: { fillColor?: string };
27
    position?: { x?: number; y?: number };
28
    geometry?: { height?: number; rotation?: number; width?: number };
29
    parent?: { id?: string };
30
  },
31
) {
32
  const url = new URL(`https://api.miro.com//v2/boards/${board_id}/app_cards`);
33

34
  const response = await fetch(url, {
35
    method: "POST",
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