0

Update a project

by
Published Oct 17, 2025

Update various attributes and configurable settings for the given project. Note that solely having the **`project:read`** scope restricts updatable settings to `isBookmarked`, `autofixAutomationTuning`, and `seerScannerAutomation`.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Update a project
4
 * Update various attributes and configurable settings for the given project.
5

6
Note that solely having the **`project:read`** scope restricts updatable settings to
7
`isBookmarked`, `autofixAutomationTuning`, and `seerScannerAutomation`.
8
 */
9
export async function main(auth: RT.Sentry, project_id_or_slug: string, body: Body) {
10
	const url = new URL(
11
		`https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_id_or_slug}/`
12
	)
13

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

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

36
export interface Body {
37
	/**
38
	 * Enables starring the project within the projects tab. Can be updated with **`project:read`** permission.
39
	 */
40
	isBookmarked?: boolean
41
	/**
42
	 * The name for the project
43
	 */
44
	name?: string
45
	/**
46
	 * Uniquely identifies a project and is used for the interface.
47
	 */
48
	slug?: string
49
	/**
50
	 * The platform for the project
51
	 */
52
	platform?: string
53
	/**
54
	 * Custom prefix for emails from this project.
55
	 */
56
	subjectPrefix?: string
57
	/**
58
	 * The email subject to use (excluding the prefix) for individual alerts. Here are the list of variables you can use:
59
	 * - `$title`
60
	 * - `$shortID`
61
	 * - `$projectID`
62
	 * - `$orgID`
63
	 * - `${tag:key}` - such as `${tag:environment}` or `${tag:release}`.
64
	 */
65
	subjectTemplate?: string
66
	/**
67
	 * Automatically resolve an issue if it hasn't been seen for this many hours. Set to `0` to disable auto-resolve.
68
	 */
69
	resolveAge?: number
70
	/**
71
	 * A JSON mapping of context types to lists of strings for their keys.
72
	 * E.g. `{'user': ['id', 'email']}`
73
	 */
74
	highlightContext?: {
75
		[k: string]: unknown
76
	}
77
	/**
78
	 * A list of strings with tag keys to highlight on this project's issues.
79
	 * E.g. `['release', 'environment']`
80
	 */
81
	highlightTags?: string[]
82
	[k: string]: unknown
83
}
84