0

Assert a list entry by parent

by
Published Oct 17, 2025

Use this endpoint to create or update a list entry for a given parent record.

Script attio Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Attio = {
3
  token: string;
4
};
5
/**
6
 * Assert a list entry by parent
7
 * Use this endpoint to create or update a list entry for a given parent record.
8
 */
9
export async function main(
10
  auth: Attio,
11
  list: string,
12
  body: {
13
    data: { parent_record_id: string; parent_object: string; entry_values: {} };
14
  },
15
) {
16
  const url = new URL(`https://api.attio.com/v2/lists/${list}/entries`);
17

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