0

Update connector

by
Published Oct 17, 2025

Updates a connector 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 connector
7
 * Updates a connector 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
  connector_id: string,
13
  body: {
14
    startItem?: {
15
      id?: string;
16
      position?: { x?: string; y?: string };
17
      snapTo?: "auto" | "top" | "right" | "bottom" | "left";
18
    };
19
    endItem?: {
20
      id?: string;
21
      position?: { x?: string; y?: string };
22
      snapTo?: "auto" | "top" | "right" | "bottom" | "left";
23
    };
24
    shape?: "straight" | "elbowed" | "curved";
25
    captions?: {
26
      content: string;
27
      position?: string;
28
      textAlignVertical?: "top" | "bottom" | "middle";
29
    }[];
30
    style?: {
31
      color?: string;
32
      endStrokeCap?:
33
        | "none"
34
        | "stealth"
35
        | "rounded_stealth"
36
        | "diamond"
37
        | "filled_diamond"
38
        | "oval"
39
        | "filled_oval"
40
        | "arrow"
41
        | "triangle"
42
        | "filled_triangle"
43
        | "erd_one"
44
        | "erd_many"
45
        | "erd_only_one"
46
        | "erd_zero_or_one"
47
        | "erd_one_or_many"
48
        | "erd_zero_or_many"
49
        | "unknown";
50
      fontSize?: string;
51
      startStrokeCap?:
52
        | "none"
53
        | "stealth"
54
        | "rounded_stealth"
55
        | "diamond"
56
        | "filled_diamond"
57
        | "oval"
58
        | "filled_oval"
59
        | "arrow"
60
        | "triangle"
61
        | "filled_triangle"
62
        | "erd_one"
63
        | "erd_many"
64
        | "erd_only_one"
65
        | "erd_zero_or_one"
66
        | "erd_one_or_many"
67
        | "erd_zero_or_many"
68
        | "unknown";
69
      strokeColor?: string;
70
      strokeStyle?: "normal" | "dotted" | "dashed";
71
      strokeWidth?: string;
72
      textOrientation?: "horizontal" | "aligned";
73
    };
74
  },
75
) {
76
  const url = new URL(
77
    `https://api.miro.com//v2/boards/${board_id}/connectors/${connector_id}`,
78
  );
79

80
  const response = await fetch(url, {
81
    method: "PATCH",
82
    headers: {
83
      "Content-Type": "application/json",
84
      Authorization: "Bearer " + auth.token,
85
    },
86
    body: JSON.stringify(body),
87
  });
88
  if (!response.ok) {
89
    const text = await response.text();
90
    throw new Error(`${response.status} ${text}`);
91
  }
92
  return await response.json();
93
}
94