0

Retrieve statuses of release thresholds alpha

by
Published Oct 17, 2025

**`[WARNING]`**: This API is an experimental Alpha feature and is subject to change! List all derived statuses of releases that fall within the provided start/end datetimes. Constructs a response key'd off \{`release_version`\}-\{`project_slug`\} that lists thresholds with their status for *specified* projects. Each returned enriched threshold will contain the full serialized `release_threshold` instance as well as it's derived health statuses.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Retrieve statuses of release thresholds alpha
4
 * **`[WARNING]`**: This API is an experimental Alpha feature and is subject to change!
5

6
List all derived statuses of releases that fall within the provided start/end datetimes.
7

8
Constructs a response key'd off \{`release_version`\}-\{`project_slug`\} that lists thresholds with their status for *specified* projects.
9
Each returned enriched threshold will contain the full serialized `release_threshold` instance as well as it's derived health statuses.
10
 */
11
export async function main(
12
	auth: RT.Sentry,
13
	start: string | undefined,
14
	end: string | undefined,
15
	environment?: string | undefined,
16
	projectSlug?: string | undefined,
17
	release?: string | undefined
18
) {
19
	const url = new URL(
20
		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/release-threshold-statuses/`
21
	)
22
	for (const [k, v] of [
23
		['start', start],
24
		['end', end],
25
		['environment', environment],
26
		['projectSlug', projectSlug],
27
		['release', release]
28
	]) {
29
		if (v !== undefined && v !== '') {
30
			url.searchParams.append(k, v)
31
		}
32
	}
33
	const response = await fetch(url, {
34
		method: 'GET',
35
		headers: {
36
			Authorization: 'Bearer ' + auth.token
37
		},
38
		body: undefined
39
	})
40
	if (!response.ok) {
41
		const text = await response.text()
42
		throw new Error(`${response.status} ${text}`)
43
	}
44
	return await response.json()
45
}
46