0

Delete User Account

by
Published Apr 8, 2025

Initiates the deletion process for the currently authenticated User, by sending a deletion confirmation email. The email contains a link that the user needs to visit in order to proceed with the deletion process.

Script vercel Verified

The script

Submitted by hugo697 Bun
Verified 428 days ago
1
//native
2
type Vercel = {
3
  token: string;
4
};
5
/**
6
 * Delete User Account
7
 * Initiates the deletion process for the currently authenticated User, by sending a deletion confirmation email. The email contains a link that the user needs to visit in order to proceed with the deletion process.
8
 */
9
export async function main(
10
  auth: Vercel,
11
  body: { reasons?: { slug: string; description: string }[] },
12
) {
13
  const url = new URL(`https://api.vercel.com/v1/user`);
14

15
  const response = await fetch(url, {
16
    method: "DELETE",
17
    headers: {
18
      "Content-Type": "application/json",
19
      Authorization: "Bearer " + auth.token,
20
    },
21
    body: JSON.stringify(body),
22
  });
23
  if (!response.ok) {
24
    const text = await response.text();
25
    throw new Error(`${response.status} ${text}`);
26
  }
27
  return await response.json();
28
}
29