0

Get organization members

by
Published Oct 17, 2025

Retrieves organization members based on the organization ID and the cursor, or based on the user emails provided in the request.Required scope organizations:read Rate limiting Level 3 Enterprise only This API is available only for Enterprise plan users. You can only use this endpoint if you have the role of a Company Admin. You can request temporary access to Enterprise APIs using this form.

Script miro Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Miro = {
3
  token: string;
4
};
5
/**
6
 * Get organization members
7
 * Retrieves organization members based on the organization ID and the cursor, or based on the user emails provided in the request.Required scope organizations:read Rate limiting Level 3 Enterprise only This API is available only for Enterprise plan users. You can only use this endpoint if you have the role of a Company Admin. You can request temporary access to Enterprise APIs using this form.
8
 */
9
export async function main(
10
  auth: Miro,
11
  org_id: string,
12
  emails: string | undefined,
13
  role:
14
    | "organization_internal_admin"
15
    | "organization_internal_user"
16
    | "organization_external_user"
17
    | "organization_team_guest_user"
18
    | "unknown"
19
    | undefined,
20
  license:
21
    | "full"
22
    | "occasional"
23
    | "free"
24
    | "free_restricted"
25
    | "full_trial"
26
    | "unknown"
27
    | undefined,
28
  active: string | undefined,
29
  cursor: string | undefined,
30
  limit: string | undefined,
31
) {
32
  const url = new URL(`https://api.miro.com//v2/orgs/${org_id}/members`);
33
  for (const [k, v] of [
34
    ["emails", emails],
35
    ["role", role],
36
    ["license", license],
37
    ["active", active],
38
    ["cursor", cursor],
39
    ["limit", limit],
40
  ]) {
41
    if (v !== undefined && v !== "" && k !== undefined) {
42
      url.searchParams.append(k, v);
43
    }
44
  }
45
  const response = await fetch(url, {
46
    method: "GET",
47
    headers: {
48
      Authorization: "Bearer " + auth.token,
49
    },
50
    body: undefined,
51
  });
52
  if (!response.ok) {
53
    const text = await response.text();
54
    throw new Error(`${response.status} ${text}`);
55
  }
56
  return await response.json();
57
}
58