0

List an organizations scim members

by
Published Oct 17, 2025

Returns a paginated list of members bound to a organization with a SCIM Users GET Request.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * List an organizations scim members
4
 * Returns a paginated list of members bound to a organization with a SCIM Users GET Request.
5
 */
6
export async function main(
7
	auth: RT.Sentry,
8
	startIndex?: string | undefined,
9
	count?: string | undefined,
10
	filter?: string | undefined,
11
	excludedAttributes?: string | undefined
12
) {
13
	const url = new URL(
14
		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/scim/v2/Users`
15
	)
16
	for (const [k, v] of [
17
		['startIndex', startIndex],
18
		['count', count],
19
		['filter', filter],
20
		['excludedAttributes', excludedAttributes]
21
	]) {
22
		if (v !== undefined && v !== '') {
23
			url.searchParams.append(k, v)
24
		}
25
	}
26
	const response = await fetch(url, {
27
		method: 'GET',
28
		headers: {
29
			Authorization: 'Bearer ' + auth.token
30
		},
31
		body: undefined
32
	})
33
	if (!response.ok) {
34
		const text = await response.text()
35
		throw new Error(`${response.status} ${text}`)
36
	}
37
	return await response.json()
38
}
39