0

Delete a team from a project

by
Published Oct 17, 2025

Revoke a team's access to a project. Note that Team Admins can only revoke access to teams they are admins of.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Delete a team from a project
4
 * Revoke a team's access to a project.
5

6
Note that Team Admins can only revoke access to teams they are admins of.
7
 */
8
export async function main(auth: RT.Sentry, project_id_or_slug: string, team_id_or_slug: string) {
9
	const url = new URL(
10
		`https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_id_or_slug}/teams/${team_id_or_slug}/`
11
	)
12

13
	const response = await fetch(url, {
14
		method: 'DELETE',
15
		headers: {
16
			Authorization: 'Bearer ' + auth.token
17
		},
18
		body: undefined
19
	})
20
	if (!response.ok) {
21
		const text = await response.text()
22
		throw new Error(`${response.status} ${text}`)
23
	}
24
	return await response.json()
25
}
26