0

Update a configuration profile interface

by
Published Oct 17, 2025

Update a `vpc` or `public` configuration profile interface for a specific configuration profile, on a specific Linode.

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 configuration profile interface
7
 * Update a `vpc` or `public` configuration profile interface for a specific configuration profile, on a specific Linode.
8
 */
9
export async function main(
10
  auth: Linode,
11
  apiVersion: "v4" | "v4beta",
12
  linodeId: string,
13
  configId: string,
14
  interfaceId: string,
15
  body: {
16
    ip_ranges?: string[];
17
    ipv4?: { nat_1_1?: string; vpc?: string };
18
    primary?: false | true;
19
  },
20
) {
21
  const url = new URL(
22
    `https://api.linode.com/${apiVersion}/linode/instances/${linodeId}/configs/${configId}/interfaces/${interfaceId}`,
23
  );
24

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