0

Update card item

by
Published Oct 17, 2025

Updates a 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 card item
7
 * Updates a 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
      assigneeId?: string;
16
      description?: string;
17
      dueDate?: string;
18
      title?: string;
19
    };
20
    style?: { cardTheme?: string };
21
    position?: { x?: number; y?: number };
22
    geometry?: { height?: number; rotation?: number; width?: number };
23
    parent?: { id?: string };
24
  },
25
) {
26
  const url = new URL(
27
    `https://api.miro.com//v2/boards/${board_id}/cards/${item_id}`,
28
  );
29

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