0

Delete Transformation

by
Published Oct 17, 2025

Deletes a Transformation. • When called, this endpoint may generate the `Transformation Deleted` event in the audit trail. • In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information.

Script segment Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Segment = {
3
  token: string;
4
  baseUrl: string;
5
};
6
/**
7
 * Delete Transformation
8
 * Deletes a Transformation.
9

10

11

12
• When called, this endpoint may generate the `Transformation Deleted` event in the audit trail.
13

14

15
• In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Please reach out to your customer success manager for more information.
16
 */
17
export async function main(auth: Segment, transformationId: string) {
18
  const url = new URL(
19
    `${auth.baseUrl}/transformations/${transformationId}`,
20
  );
21

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