0

Provision a new team

by
Published Oct 17, 2025

Create a new team bound to an organization via a SCIM Groups POST Request. The slug will have a normalization of uppercases/spaces to lowercases and dashes. Note that teams are always created with an empty member set.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Provision a new team
4
 * Create a new team bound to an organization via a SCIM Groups POST
5
Request. The slug will have a normalization of uppercases/spaces to
6
lowercases and dashes.
7

8
Note that teams are always created with an empty member set.
9
 */
10
export async function main(auth: RT.Sentry, body: Body) {
11
	const url = new URL(
12
		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/scim/v2/Groups`
13
	)
14

15
	const response = await fetch(url, {
16
		method: 'POST',
17
		headers: {
18
			'Content-Type': 'application/json',
19
			Authorization: 'Bearer ' + auth.token
20
		},
21
		body: JSON.stringify(body)
22
	})
23
	if (!response.ok) {
24
		const text = await response.text()
25
		throw new Error(`${response.status} ${text}`)
26
	}
27
	return await response.json()
28
}
29

30
/* eslint-disable */
31
/**
32
 * This file was automatically generated by json-schema-to-typescript.
33
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
34
 * and run json-schema-to-typescript to regenerate this file.
35
 */
36

37
export interface Body {
38
	/**
39
	 * The slug of the team that is shown in the UI.
40
	 */
41
	displayName: string
42
	[k: string]: unknown
43
}
44