0

Delete Klass

by
Published Oct 17, 2025

Deletes a Klass based on the unique Klass ID. ### Note > You cannot delete a Klass if KObjects (custom objects) exist for the Klass in your Kustomer organization. Any one of the following roles is required for this endpoint: |Legacy Role|Equivalent Permission Set Role| |-----|--------| |org.admin.klass.write|org.permission.klass.delete|

Script kustomer Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Kustomer = {
3
  apiKey: string;
4
};
5
/**
6
 * Delete Klass
7
 * Deletes a Klass based on the unique Klass ID.
8

9
### Note
10
> You cannot delete a Klass if KObjects (custom objects) exist for the Klass in your Kustomer organization.
11

12
Any one of the following roles is required for this endpoint:
13

14
|Legacy Role|Equivalent Permission Set Role|
15
|-----|--------|
16
|org.admin.klass.write|org.permission.klass.delete|
17
 */
18
export async function main(auth: Kustomer, id: string) {
19
  const url = new URL(`https://api.kustomerapp.com/v1/klasses/${id}`);
20

21
  const response = await fetch(url, {
22
    method: "DELETE",
23
    headers: {
24
      Authorization: "Bearer " + auth.apiKey,
25
    },
26
    body: undefined,
27
  });
28
  if (!response.ok) {
29
    const text = await response.text();
30
    throw new Error(`${response.status} ${text}`);
31
  }
32
  return await response.text();
33
}
34