0

Disable spike protection

by
Published Oct 17, 2025

Disables Spike Protection feature for some of the projects within the organization.

Script sentry Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Disable spike protection
4
 * Disables Spike Protection feature for some of the projects within the organization.
5
 */
6
export async function main(auth: RT.Sentry, body: Body) {
7
	const url = new URL(
8
		`https://${auth.region}.sentry.io/api/0/organizations/${auth.organizationSlug}/spike-protections/`
9
	)
10

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

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

33
/**
34
 * Django Rest Framework serializer for incoming Spike Protection API payloads
35
 */
36
export interface Body {
37
	/**
38
	 * Slugs of projects to disable Spike Protection for. Set to `$all` to disable Spike Protection for all the projects in the organization.
39
	 */
40
	projects: string[]
41
	[k: string]: unknown
42
}
43