0

Update an organization

Published Oct 17, 2025

Update various attributes and configurable settings for the given organization.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 389 days ago
1
//native
2
/**
3
 * Update an organization
4
 * Update various attributes and configurable settings for the given organization.
5
 */
6
export async function main(auth: RT.Sentry, body: Body) {
7
	const url = new URL(
8
		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/`
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 new slug for the organization, which needs to be unique.
36
	 */
37
	slug?: string
38
	/**
39
	 * The new name for the organization.
40
	 */
41
	name?: string
42
	/**
43
	 * Specify `true` to opt-in to new features before they're released to the public.
44
	 */
45
	isEarlyAdopter?: boolean
46
	/**
47
	 * Specify `true` to hide AI features from the organization.
48
	 */
49
	hideAiFeatures?: boolean
50
	/**
51
	 * Specify `true` to enable Code Coverage Insights. This feature is only available for organizations on the Team plan and above. Learn more about Codecov [here](/product/codecov/).
52
	 */
53
	codecovAccess?: boolean
54
	/**
55
	 * The default role new members will receive.
56
	 *
57
	 * * `member` - Member
58
	 * * `admin` - Admin
59
	 * * `manager` - Manager
60
	 * * `owner` - Owner
61
	 */
62
	defaultRole?: 'member' | 'admin' | 'manager' | 'owner'
63
	/**
64
	 * Specify `true` to allow organization members to freely join any team.
65
	 */
66
	openMembership?: boolean
67
	/**
68
	 * Specify `true` to allow members to delete events (including the delete & discard action) by granting them the `event:admin` scope.
69
	 */
70
	eventsMemberAdmin?: boolean
71
	/**
72
	 * Specify `true` to allow members to create, edit, and delete alert rules by granting them the `alerts:write` scope.
73
	 */
74
	alertsMemberWrite?: boolean
75
	/**
76
	 * The role required to download event attachments, such as native crash reports or log files.
77
	 *
78
	 * * `member` - Member
79
	 * * `admin` - Admin
80
	 * * `manager` - Manager
81
	 * * `owner` - Owner
82
	 */
83
	attachmentsRole?: 'member' | 'admin' | 'manager' | 'owner'
84
	/**
85
	 * The role required to download debug information files, ProGuard mappings and source maps.
86
	 *
87
	 * * `member` - Member
88
	 * * `admin` - Admin
89
	 * * `manager` - Manager
90
	 * * `owner` - Owner
91
	 */
92
	debugFilesRole?: 'member' | 'admin' | 'manager' | 'owner'
93
	/**
94
	 * The type of display picture for the organization.
95
	 *
96
	 * * `letter_avatar` - Use initials
97
	 * * `upload` - Upload an image
98
	 */
99
	avatarType?: 'letter_avatar' | 'upload'
100
	/**
101
	 * The image to upload as the organization avatar, in base64. Required if `avatarType` is `upload`.
102
	 */
103
	avatar?: string
104
	/**
105
	 * Specify `true` to require and enforce two-factor authentication for all members.
106
	 */
107
	require2FA?: boolean
108
	/**
109
	 * Specify `true` to allow sharing of limited details on issues to anonymous users.
110
	 */
111
	allowSharedIssues?: boolean
112
	/**
113
	 * Specify `true` to enable enhanced privacy controls to limit personally identifiable information (PII) as well as source code in things like notifications.
114
	 */
115
	enhancedPrivacy?: boolean
116
	/**
117
	 * Specify `true` to allow Sentry to scrape missing JavaScript source context when possible.
118
	 */
119
	scrapeJavaScript?: boolean
120
	/**
121
	 * How many native crash reports (such as Minidumps for improved processing and download in issue details) to store per issue.
122
	 *
123
	 * * `0` - Disabled
124
	 * * `1` - 1 per issue
125
	 * * `5` - 5 per issue
126
	 * * `10` - 10 per issue
127
	 * * `20` - 20 per issue
128
	 * * `50` - 50 per issue
129
	 * * `100` - 100 per issue
130
	 * * `-1` - Unlimited
131
	 */
132
	storeCrashReports?: 0 | 1 | 5 | 10 | 20 | 50 | 100 | -1
133
	/**
134
	 * Specify `true` to allow users to request to join your organization.
135
	 */
136
	allowJoinRequests?: boolean
137
	/**
138
	 * Specify `true` to require server-side data scrubbing for all projects.
139
	 */
140
	dataScrubber?: boolean
141
	/**
142
	 * Specify `true` to apply the default scrubbers to prevent things like passwords and credit cards from being stored for all projects.
143
	 */
144
	dataScrubberDefaults?: boolean
145
	/**
146
	 * A list of additional global field names to match against when scrubbing data for all projects.
147
	 */
148
	sensitiveFields?: string[]
149
	/**
150
	 * A list of global field names which data scrubbers should ignore.
151
	 */
152
	safeFields?: string[]
153
	/**
154
	 * Specify `true` to prevent IP addresses from being stored for new events on all projects.
155
	 */
156
	scrubIPAddresses?: boolean
157
	/**
158
	 * Advanced data scrubbing rules that can be configured for each project as a JSON string. The new rules will only apply to new incoming events. For more details on advanced data scrubbing, see our [full documentation](/security-legal-pii/scrubbing/advanced-datascrubbing/).
159
	 *
160
	 * > Warning: Calling this endpoint with this field fully overwrites the advanced data scrubbing rules.
161
	 *
162
	 * Below is an example of a payload for a set of advanced data scrubbing rules for masking credit card numbers from the log message (equivalent to `[Mask] [Credit card numbers] from [$message]` in the Sentry app) and removing a specific key called `foo` (equivalent to `[Remove] [Anything] from [extra.foo]` in the Sentry app):
163
	 * ```json
164
	 * {
165
	 *     relayPiiConfig: "{\"rules":{\"0\":{\"type\":\"creditcard\",\"redaction\":{\"method\":\"mask\"}},\"1\":{\"type\":\"anything\",\"redaction\":{\"method\":\"remove\"}}},\"applications\":{\"$message\":[\"0\"],\"extra.foo\":[\"1\"]}}"
166
	 * }
167
	 * ```
168
	 *
169
	 */
170
	relayPiiConfig?: string
171
	/**
172
	 * A list of local Relays (the name, public key, and description as a JSON) registered for the organization. This feature is only available for organizations on the Business and Enterprise plans. Read more about Relay [here](/product/relay/).
173
	 *
174
	 *                                           Below is an example of a list containing a single local Relay registered for the organization:
175
	 *                                           ```json
176
	 *                                           {
177
	 *                                             trustedRelays: [
178
	 *                                                 {
179
	 *                                                     name: "my-relay",
180
	 *                                                     publicKey: "eiwr9fdruw4erfh892qy4493reyf89ur34wefd90h",
181
	 *                                                     description: "Configuration for my-relay."
182
	 *                                                 }
183
	 *                                             ]
184
	 *                                           }
185
	 *                                           ```
186
	 *
187
	 */
188
	trustedRelays?: {
189
		[k: string]: unknown
190
	}[]
191
	/**
192
	 * Specify `true` to allow Sentry to comment on recent pull requests suspected of causing issues. Requires a GitHub integration.
193
	 */
194
	githubPRBot?: boolean
195
	/**
196
	 * Specify `true` to allow Sentry to comment on open pull requests to show recent error issues for the code being changed. Requires a GitHub integration.
197
	 */
198
	githubOpenPRBot?: boolean
199
	/**
200
	 * Specify `true` to allow Sentry to detect users committing to your GitHub repositories that are not part of your Sentry organization. Requires a GitHub integration.
201
	 */
202
	githubNudgeInvite?: boolean
203
	/**
204
	 * Specify `true` to allow Sentry to comment on recent pull requests suspected of causing issues. Requires a GitLab integration.
205
	 */
206
	gitlabPRBot?: boolean
207
	/**
208
	 * Specify `true` to allow Sentry to comment on open pull requests to show recent error issues for the code being changed. Requires a GitLab integration.
209
	 */
210
	gitlabOpenPRBot?: boolean
211
	/**
212
	 * Specify `true` to allow the Sentry Slack integration to post replies in threads for an Issue Alert notification. Requires a Slack integration.
213
	 */
214
	issueAlertsThreadFlag?: boolean
215
	/**
216
	 * Specify `true` to allow the Sentry Slack integration to post replies in threads for a Metric Alert notification. Requires a Slack integration.
217
	 */
218
	metricAlertsThreadFlag?: boolean
219
	/**
220
	 * Specify `true` to restore an organization that is pending deletion.
221
	 */
222
	cancelDeletion?: boolean
223
	[k: string]: unknown
224
}
225