0

Provision a new organization member

by
Published Oct 17, 2025

Create a new Organization Member via a SCIM Users POST Request. Note that this API does not support setting secondary emails.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Provision a new organization member
4
 * Create a new Organization Member via a SCIM Users POST Request.
5

6
Note that this API does not support setting secondary emails.
7
 */
8
export async function main(auth: RT.Sentry, body: Body) {
9
	const url = new URL(
10
		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/scim/v2/Users`
11
	)
12

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

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

35
export interface Body {
36
	/**
37
	 * The SAML field used for email.
38
	 */
39
	userName: string
40
	/**
41
	 * The organization role of the member. If unspecified, this will be
42
	 *                     set to the organization's default role. The options are:
43
	 *
44
	 * * `billing` - Can manage payment and compliance details.
45
	 * * `member` - Can view and act on events, as well as view most other data within the organization.
46
	 * * `manager` - Has full management access to all teams and projects. Can also manage
47
	 *         the organization's membership.
48
	 * * `admin` - Can edit global integrations, manage projects, and add/remove teams.
49
	 *         They automatically assume the Team Admin role for teams they join.
50
	 *         Note: This role can no longer be assigned in Business and Enterprise plans. Use `TeamRoles` instead.
51
	 *
52
	 */
53
	sentryOrgRole?: 'billing' | 'member' | 'manager' | 'admin'
54
	[k: string]: unknown
55
}
56