0

DisableEvents

by
Published Oct 17, 2025

Disables events to prevent them from being searchable. All events are disabled by default. You must enable events to make them searchable. Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later.

Script square Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Square = {
3
  token: string;
4
};
5
/**
6
 * DisableEvents
7
 * Disables events to prevent them from being searchable.
8
All events are disabled by default. You must enable events to make them searchable.
9
Disabling events for a specific time period prevents them from being searchable, even if you re-enable them later.
10
 */
11
export async function main(auth: Square) {
12
  const url = new URL(`https://connect.squareup.com/v2/events/disable`);
13

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