0

Account Update Details

by
Published Oct 17, 2025
Script deep_infra Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Deepinfra = {
3
  token: string;
4
};
5
/**
6
 * Account Update Details
7
 *
8
 */
9
export async function main(
10
  auth: Deepinfra,
11
  body: {
12
    name?: string;
13
    email?: string;
14
    is_business_account?: false | true;
15
    company?: string;
16
    website?: string;
17
    display_name?: string;
18
  },
19
) {
20
  const url = new URL(`https://api.deepinfra.com/v1/me`);
21

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