0

List a projects data filters

by
Published Oct 17, 2025

Retrieve a list of filters for a given project. `active` will be either a boolean or a list for the legacy browser filters.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * List a projects data filters
4
 * Retrieve a list of filters for a given project.
5
`active` will be either a boolean or a list for the legacy browser filters.
6
 */
7
export async function main(auth: RT.Sentry, project_id_or_slug: string) {
8
	const url = new URL(
9
		`https://${auth.region}.sentry.io/api/0/projects/${auth.organizationSlug}/${project_id_or_slug}/filters/`
10
	)
11

12
	const response = await fetch(url, {
13
		method: 'GET',
14
		headers: {
15
			Authorization: 'Bearer ' + auth.token
16
		},
17
		body: undefined
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