0

Retrieve content change logs of board items

by
Published Oct 17, 2025

Retrieves content changes for board items within your organization.

Script miro Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Miro = {
3
  token: string;
4
};
5
/**
6
 * Retrieve content change logs of board items
7
 * Retrieves content changes for board items within your organization.
8
 */
9
export async function main(
10
  auth: Miro,
11
  org_id: string,
12
  board_ids: string | undefined,
13
  emails: string | undefined,
14
  from: string | undefined,
15
  to: string | undefined,
16
  cursor: string | undefined,
17
  limit: string | undefined,
18
  sorting: "asc" | "desc" | undefined,
19
) {
20
  const url = new URL(
21
    `https://api.miro.com//v2/orgs/${org_id}/content-logs/items`,
22
  );
23
  for (const [k, v] of [
24
    ["board_ids", board_ids],
25
    ["emails", emails],
26
    ["from", from],
27
    ["to", to],
28
    ["cursor", cursor],
29
    ["limit", limit],
30
    ["sorting", sorting],
31
  ]) {
32
    if (v !== undefined && v !== "" && k !== undefined) {
33
      url.searchParams.append(k, v);
34
    }
35
  }
36
  const response = await fetch(url, {
37
    method: "GET",
38
    headers: {
39
      Authorization: "Bearer " + auth.token,
40
    },
41
    body: undefined,
42
  });
43
  if (!response.ok) {
44
    const text = await response.text();
45
    throw new Error(`${response.status} ${text}`);
46
  }
47
  return await response.json();
48
}
49