0

Update ownership configuration for a project

by
Published Oct 17, 2025

Updates ownership configurations for a project. Note that only the attributes submitted are modified.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Update ownership configuration for a project
4
 * Updates ownership configurations for a project. Note that only the
5
attributes submitted are modified.
6
 */
7
export async function main(auth: RT.Sentry, project_id_or_slug: string, body: Body) {
8
	const url = new URL(
9
		`https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_id_or_slug}/ownership/`
10
	)
11

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

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

34
export interface Body {
35
	/**
36
	 * Raw input for ownership configuration. See the [Ownership Rules Documentation](/product/issues/ownership-rules/) to learn more.
37
	 */
38
	raw?: string
39
	/**
40
	 * A boolean determining who to assign ownership to when an ownership rule has no match. If set to `True`, all project members are made owners. Otherwise, no owners are set.
41
	 */
42
	fallthrough?: boolean
43
	/**
44
	 * Auto-assignment settings. The available options are:
45
	 * - Auto Assign to Issue Owner
46
	 * - Auto Assign to Suspect Commits
47
	 * - Turn off Auto-Assignment
48
	 */
49
	autoAssignment?: string
50
	/**
51
	 * Set to `True` to sync issue owners with CODEOWNERS updates in a release.
52
	 */
53
	codeownersAutoSync?: boolean
54
	[k: string]: unknown
55
}
56