0

Unassign storage policy

by
Published Oct 17, 2025

Delete a storage policy assignment. Deleting a storage policy assignment on a user will have the user inherit the enterprise's default storage policy. There is a rate limit for calling this endpoint of only twice per user in a 24 hour time frame.

Script box Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Box = {
3
  token: string;
4
};
5
/**
6
 * Unassign storage policy
7
 * Delete a storage policy assignment.
8

9
Deleting a storage policy assignment on a user
10
will have the user inherit the enterprise's default
11
storage policy.
12

13
There is a rate limit for calling this endpoint of only
14
twice per user in a 24 hour time frame.
15
 */
16
export async function main(auth: Box, storage_policy_assignment_id: string) {
17
  const url = new URL(
18
    `https://api.box.com/2.0/storage_policy_assignments/${storage_policy_assignment_id}`,
19
  );
20

21
  const response = await fetch(url, {
22
    method: "DELETE",
23
    headers: {
24
      Authorization: "Bearer " + auth.token,
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.json();
33
}
34