0

Update a status

by
Published Oct 17, 2025

Update a status on an status 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 status
7
 * Update a status on an status 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: "lists" | "objects",
14
  identifier: string,
15
  attribute: string,
16
  status: string,
17
  body: {
18
    data: {
19
      title?: string;
20
      celebration_enabled?: false | true;
21
      target_time_in_status?: string;
22
      is_archived?: false | true;
23
    };
24
  },
25
) {
26
  const url = new URL(
27
    `https://api.attio.com/v2/${target}/${identifier}/attributes/${attribute}/statuses/${status}`,
28
  );
29

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