0

Update an inbound data filter

by
Published Oct 17, 2025

Update various inbound data filters for a project.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Update an inbound data filter
4
 * Update various inbound data filters for a project.
5
 */
6
export async function main(
7
	auth: RT.Sentry,
8
	project_id_or_slug: string,
9
	filter_id: string,
10
	body: Body
11
) {
12
	const url = new URL(
13
		`https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_id_or_slug}/filters/${filter_id}/`
14
	)
15

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

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

38
export interface Body {
39
	/**
40
	 * Toggle the browser-extensions, localhost, filtered-transaction, or web-crawlers filter on or off.
41
	 */
42
	active?: boolean
43
	/**
44
	 *
45
	 * Specifies which legacy browser filters should be active. Anything excluded from the list will be
46
	 * disabled. The options are:
47
	 * - `ie` - Internet Explorer Version 11 and lower
48
	 * - `edge` - Edge Version 18 and lower
49
	 * - `safari` - Safari Version 11 and lower
50
	 * - `firefox` - Firefox Version 66 and lower
51
	 * - `chrome` - Chrome Version 62 and lower
52
	 * - `opera` - Opera Version 50 and lower
53
	 * - `android` - Android Version 3 and lower
54
	 * - `opera_mini` - Opera Mini Version 34 and lower
55
	 *
56
	 * Deprecated options:
57
	 * - `ie_pre_9` - Internet Explorer Version 8 and lower
58
	 * - `ie9` - Internet Explorer Version 9
59
	 * - `ie10` - Internet Explorer Version 10
60
	 * - `ie11` - Internet Explorer Version 11
61
	 * - `safari_pre_6` - Safari Version 5 and lower
62
	 * - `opera_pre_15` - Opera Version 14 and lower
63
	 * - `opera_mini_pre_8` - Opera Mini Version 8 and lower
64
	 * - `android_pre_4` - Android Version 3 and lower
65
	 * - `edge_pre_79` - Edge Version 18 and lower (non Chromium based)
66
	 *
67
	 */
68
	subfilters?: (
69
		| 'ie'
70
		| 'edge'
71
		| 'safari'
72
		| 'firefox'
73
		| 'chrome'
74
		| 'opera'
75
		| 'android'
76
		| 'opera_mini'
77
		| 'ie_pre_9'
78
		| 'ie9'
79
		| 'ie10'
80
		| 'ie11'
81
		| 'opera_pre_15'
82
		| 'android_pre_4'
83
		| 'safari_pre_6'
84
		| 'opera_mini_pre_8'
85
		| 'edge_pre_79'
86
	)[]
87
	[k: string]: unknown
88
}
89