0

Update your account

by
Published Oct 17, 2025

Updates contact and billing information related to your account.

Script linode Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Linode = {
3
  token: string;
4
};
5
/**
6
 * Update your account
7
 * Updates contact and billing information related to your account.
8
 */
9
export async function main(
10
  auth: Linode,
11
  apiVersion: "v4" | "v4beta",
12
  body: {
13
    active_promotions?: {
14
      credit_monthly_cap?: string;
15
      credit_remaining?: string;
16
      description?: string;
17
      expire_dt?: string;
18
      image_url?: string;
19
      service_type?:
20
        | "all"
21
        | "backup"
22
        | "blockstorage"
23
        | "db_mysql"
24
        | "ip_v4"
25
        | "linode"
26
        | "linode_disk"
27
        | "linode_memory"
28
        | "longview"
29
        | "managed"
30
        | "nodebalancer"
31
        | "objectstorage"
32
        | "placement_group"
33
        | "transfer_tx";
34
      summary?: string;
35
      this_month_credit_remaining?: string;
36
    }[];
37
    active_since?: string;
38
    address_1?: string;
39
    address_2?: string;
40
    balance?: number;
41
    balance_uninvoiced?: number;
42
    billing_source?: "linode" | "akamai";
43
    capabilities?: string[];
44
    city?: string;
45
    company?: string;
46
    country?: string;
47
    credit_card?: { expiry?: string; last_four?: string };
48
    email?: string;
49
    euuid?: string;
50
    first_name?: string;
51
    last_name?: string;
52
    phone?: string;
53
    state?: string;
54
    tax_id?: string;
55
    zip?: string;
56
  },
57
) {
58
  const url = new URL(`https://api.linode.com/${apiVersion}/account`);
59

60
  const response = await fetch(url, {
61
    method: "PUT",
62
    headers: {
63
      "Content-Type": "application/json",
64
      Authorization: "Bearer " + auth.token,
65
    },
66
    body: JSON.stringify(body),
67
  });
68
  if (!response.ok) {
69
    const text = await response.text();
70
    throw new Error(`${response.status} ${text}`);
71
  }
72
  return await response.json();
73
}
74