0

List a teams members

by
Published Oct 17, 2025

List all members on a team. The response will not include members with pending invites.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * List a teams members
4
 * List all members on a team.
5

6
The response will not include members with pending invites.
7
 */
8
export async function main(auth: RT.Sentry, team_id_or_slug: string, cursor?: string | undefined) {
9
	const url = new URL(
10
		`https://${auth.region}.sentry.io/api/0/teams/${auth.organizationSlug}/${team_id_or_slug}/members/`
11
	)
12
	for (const [k, v] of [['cursor', cursor]]) {
13
		if (v !== undefined && v !== '') {
14
			url.searchParams.append(k, v)
15
		}
16
	}
17
	const response = await fetch(url, {
18
		method: 'GET',
19
		headers: {
20
			Authorization: 'Bearer ' + auth.token
21
		},
22
		body: undefined
23
	})
24
	if (!response.ok) {
25
		const text = await response.text()
26
		throw new Error(`${response.status} ${text}`)
27
	}
28
	return await response.json()
29
}
30