0

Update a select option

by
Published Oct 17, 2025

Updates a select option on an attribute on either an object or a list. Required scopes: `object_configuration:read-write`.

Script attio Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Attio = {
3
  token: string;
4
};
5
/**
6
 * Update a select option
7
 * Updates a select option on an attribute on either an object or a list.
8

9
Required scopes: `object_configuration:read-write`.
10
 */
11
export async function main(
12
  auth: Attio,
13
  target: "objects" | "lists",
14
  identifier: string,
15
  attribute: string,
16
  option: string,
17
  body: { data: { title?: string; is_archived?: false | true } },
18
) {
19
  const url = new URL(
20
    `https://api.attio.com/v2/${target}/${identifier}/attributes/${attribute}/options/${option}`,
21
  );
22

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