0

Delete Workspace Share

by
Published Oct 17, 2025

Deletes the share specified in the URL. **_This operation is only available to system administrators._**

Script smartsheet Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Smartsheet = {
3
  token: string;
4
  baseUrl: string;
5
};
6
/**
7
 * Delete Workspace Share
8
 * Deletes the share specified in the URL.
9

10
**_This operation is only available to system administrators._**
11

12
 */
13
export async function main(
14
  auth: Smartsheet,
15
  workspaceId: string,
16
  shareId: string,
17
) {
18
  const url = new URL(
19
    `${auth.baseUrl}/workspaces/${workspaceId}/shares/${shareId}`,
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