0

Update a domain

by
Published Oct 17, 2025

Update information about a Domain in Linode's DNS Manager. > --- - __CLI__. ``` linode-cli domains update 1234 \ --retry_sec 7200 \ --ttl_sec 300 ``` [Learn more...](https://techdocs.akamai.com/cloud-computing/docs/getting-started-with-the-linode-cli) - __OAuth scopes__. ``` domains:read_write ``` [Learn more...](https://techdocs.akamai.com/linode-api/reference/get-started#oauth)

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 a domain
7
 * Update information about a Domain in Linode's DNS Manager.
8

9

10
>
11

12
---
13

14

15
- __CLI__.
16

17
    ```
18
    linode-cli domains update 1234 \
19
  --retry_sec 7200 \
20
  --ttl_sec 300
21
    ```
22

23
    [Learn more...](https://techdocs.akamai.com/cloud-computing/docs/getting-started-with-the-linode-cli)
24

25
- __OAuth scopes__.
26

27
    ```
28
    domains:read_write
29
    ```
30

31
    [Learn more...](https://techdocs.akamai.com/linode-api/reference/get-started#oauth)
32
 */
33
export async function main(
34
  auth: Linode,
35
  apiVersion: "v4" | "v4beta",
36
  domainId: string,
37
  body: {
38
    axfr_ips?: string[];
39
    description?: string;
40
    domain?: string;
41
    expire_sec?: number;
42
    group?: string;
43
    id?: number;
44
    master_ips?: string[];
45
    refresh_sec?: number;
46
    retry_sec?: number;
47
    soa_email?: string;
48
    status?: "disabled" | "active";
49
    tags?: string[];
50
    ttl_sec?: number;
51
    type?: "master" | "slave";
52
  },
53
) {
54
  const url = new URL(
55
    `https://api.linode.com/${apiVersion}/domains/${domainId}`,
56
  );
57

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