0

Update an organization members roles

by
Published Oct 17, 2025

Update a member's [organization-level](https://docs.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Update an organization members roles
4
 * Update a member's [organization-level](https://docs.
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}/members/${member_id}/`
9
	)
10

11
	const response = await fetch(url, {
12
		method: 'PUT',
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
export interface Body {
34
	/**
35
	 * The organization role of the member. The options are:
36
	 *
37
	 * * `billing` - Can manage payment and compliance details.
38
	 * * `member` - Can view and act on events, as well as view most other data within the organization.
39
	 * * `manager` - Has full management access to all teams and projects. Can also manage
40
	 *         the organization's membership.
41
	 * * `owner` - Has unrestricted access to the organization, its data, and its
42
	 *         settings. Can add, modify, and delete projects and members, as well as
43
	 *         make billing and plan changes.
44
	 * * `admin` - Can edit global integrations, manage projects, and add/remove teams.
45
	 *         They automatically assume the Team Admin role for teams they join.
46
	 *         Note: This role can no longer be assigned in Business and Enterprise plans. Use `TeamRoles` instead.
47
	 *
48
	 */
49
	orgRole?: 'billing' | 'member' | 'manager' | 'owner' | 'admin'
50
	/**
51
	 *
52
	 * Configures the team role of the member. The two roles are:
53
	 * - `contributor` - Can view and act on issues. Depending on organization settings, they can also add team members.
54
	 * - `admin` - Has full management access to their team's membership and projects.
55
	 * ```json
56
	 * {
57
	 *     "teamRoles": [
58
	 *         {
59
	 *             "teamSlug": "ancient-gabelers",
60
	 *             "role": "admin"
61
	 *         },
62
	 *         {
63
	 *             "teamSlug": "powerful-abolitionist",
64
	 *             "role": "contributor"
65
	 *         }
66
	 *     ]
67
	 * }
68
	 * ```
69
	 *
70
	 */
71
	teamRoles?: {
72
		[k: string]: unknown
73
	}[]
74
	[k: string]: unknown
75
}
76