0

Update frame

by
Published Oct 17, 2025

Updates a frame on a board based on the data, style, or geometry 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 frame
7
 * Updates a frame on a board based on the data, style, or geometry 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
      format?: "custom";
16
      title?: string;
17
      type?: "freeform";
18
      showContent?: false | true;
19
    };
20
    style?: { fillColor?: string };
21
    position?: { x?: number; y?: number };
22
    geometry?: { height?: number; width?: number };
23
  },
24
) {
25
  const url = new URL(
26
    `https://api.miro.com//v2/boards/${board_id}/frames/${item_id}`,
27
  );
28

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