0

Create note

by
Published Oct 17, 2025

Creates a note. Any one of the following roles is required for this endpoint: |Legacy Role|Equivalent Permission Set Role| |-----|--------| |org.user.note.write|org.permission.note.create| ### Rate limit Notes are subject to a rate limit. A single client can create up to 120 notes per minute per customer.

Script kustomer Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Kustomer = {
3
  apiKey: string;
4
};
5
/**
6
 * Create note
7
 * Creates a note.
8

9
Any one of the following roles is required for this endpoint:
10

11
|Legacy Role|Equivalent Permission Set Role|
12
|-----|--------|
13
|org.user.note.write|org.permission.note.create|
14

15
### Rate limit
16
Notes are subject to a rate limit. A single client can create up to 120 notes per minute per customer.
17
 */
18
export async function main(
19
  auth: Kustomer,
20
  body: {
21
    id?: string;
22
    externalId?: string;
23
    body: string;
24
    userMentions?: { user?: string; team?: string }[];
25
    createdAt?: string;
26
    modifiedAt?: string;
27
    createdBy?: string;
28
    modifiedBy?: string;
29
    lang?: string;
30
  },
31
) {
32
  const url = new URL(`https://api.kustomerapp.com/v1/notes`);
33

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