0

Remove Profiles Warehouse from Space

by
Published Oct 17, 2025

Deletes an existing Profiles Warehouse. • When called, this endpoint may generate the `Profiles Sync Warehouse Deleted` event in the audit trail.

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
 * Remove Profiles Warehouse from Space
8
 * Deletes an existing Profiles Warehouse.
9

10

11

12
• When called, this endpoint may generate the `Profiles Sync Warehouse Deleted` event in the audit trail.
13
      
14
 */
15
export async function main(
16
  auth: Segment,
17
  spaceId: string,
18
  warehouseId: string,
19
) {
20
  const url = new URL(
21
    `${auth.baseUrl}/spaces/${spaceId}/profiles-warehouses/${warehouseId}`,
22
  );
23

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