0

Create a note

by
Published Oct 17, 2025

Creates a new note for a given record. At present, notes can only be created from plaintext without formatting. Required scopes: `note:read-write`, `object_configuration:read`, `record_permission:read`.

Script attio Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Attio = {
3
  token: string;
4
};
5
/**
6
 * Create a note
7
 * Creates a new note for a given record.
8

9
At present, notes can only be created from plaintext without formatting.
10

11
Required scopes: `note:read-write`, `object_configuration:read`, `record_permission:read`.
12
 */
13
export async function main(
14
  auth: Attio,
15
  body: {
16
    data: {
17
      parent_object: string;
18
      parent_record_id: string;
19
      title: string;
20
      format: "plaintext";
21
      content: string;
22
      created_at?: string;
23
    };
24
  },
25
) {
26
  const url = new URL(`https://api.attio.com/v2/notes`);
27

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