0

Create an external team

by
Published Oct 17, 2025

Link a team from an external provider to a Sentry team.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Create an external team
4
 * Link a team from an external provider to a Sentry team.
5
 */
6
export async function main(auth: RT.Sentry, team_id_or_slug: string, body: Body) {
7
	const url = new URL(
8
		`https://${auth.region}.sentry.io/api/0/teams/${auth.organizationSlug}/${team_id_or_slug}/external-teams/`
9
	)
10

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

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

33
/**
34
 * Allows parameters to be defined in snake case, but passed as camel case.
35
 *
36
 * Errors are output in camel case.
37
 */
38
export interface Body {
39
	/**
40
	 * The associated name for the provider.
41
	 */
42
	external_name: string
43
	/**
44
	 * The provider of the external actor.
45
	 *
46
	 * * `github`
47
	 * * `github_enterprise`
48
	 * * `jira_server`
49
	 * * `slack`
50
	 * * `gitlab`
51
	 * * `msteams`
52
	 * * `custom_scm`
53
	 */
54
	provider:
55
		| 'github'
56
		| 'github_enterprise'
57
		| 'jira_server'
58
		| 'slack'
59
		| 'gitlab'
60
		| 'msteams'
61
		| 'custom_scm'
62
	/**
63
	 * The Integration ID.
64
	 */
65
	integration_id: number
66
	/**
67
	 * The associated user ID for provider.
68
	 */
69
	external_id?: string
70
	[k: string]: unknown
71
}
72