0

Update an organization members attributes

by
Published Oct 17, 2025

Update an organization member's attributes with a SCIM PATCH Request.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Update an organization members attributes
4
 * Update an organization member's attributes with a SCIM PATCH Request.
5
 */
6
export async function main(auth: RT.Sentry, member_id: string, body: Body) {
7
	const url = new URL(
8
		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/scim/v2/Users/${member_id}`
9
	)
10

11
	const response = await fetch(url, {
12
		method: 'PATCH',
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.text()
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
export interface Body {
34
	/**
35
	 * A list of operations to perform. Currently, the only valid operation is setting
36
	 * a member's `active` attribute to false, after which the member will be permanently deleted.
37
	 * ```json
38
	 * {
39
	 *     "Operations": [{
40
	 *         "op": "replace",
41
	 *         "path": "active",
42
	 *         "value": False
43
	 *     }]
44
	 * }
45
	 * ```
46
	 *
47
	 *
48
	 * @maxItems 100
49
	 */
50
	Operations: {
51
		op: string
52
		value: unknown
53
		path?: string
54
		[k: string]: unknown
55
	}[]
56
	[k: string]: unknown
57
}
58