Skip to main content
All requests use a single endpoint: POST /functions/v1/api with resource: "lead-notes".

Access control

All operations require authentication. Access is granted if the user owns the lead (via the lead’s agent) or is an internal admin. Non-owners receive a 403 Forbidden response.

List notes

Retrieves all notes for a specific lead. Pinned notes appear first in the results.
Pinned notes always appear at the top of list results regardless of pagination or creation date. Use the togglePin action or set is_pinned: true on update to pin important notes so they are never buried.
resource
string
required
Must be "lead-notes"
action
string
required
Must be "list"
data
object
required

Response

success
boolean
data
object
const response = await ApiService.invoke<{
  notes: LeadNote[];
  count: number;
}>({
  resource: "lead-notes",
  action: "list",
  data: {
    leadId: 123,
    limit: 20,
    offset: 0,
  },
});

const notes = response?.notes || [];

Get a note

Retrieves a specific note by ID.
resource
string
required
Must be "lead-notes"
action
string
required
Must be "get"
id
string
required
The note UUID.

Response

success
boolean
data
object
const response = await ApiService.invoke<{ note: LeadNote }>({
  resource: "lead-notes",
  action: "get",
  id: "note-uuid-here",
});

Create a note

Creates a new note for a lead.
resource
string
required
Must be "lead-notes"
action
string
required
Must be "create"
data
object
required

Response (status 201)

success
boolean
data
object
const response = await ApiService.invoke<{ note: LeadNote }>(
  {
    resource: "lead-notes",
    action: "create",
    data: {
      leadId: 123,
      content: "Follow up next week",
    },
  },
  201
);

const note = response?.note;

Update a note

Updates an existing note. Only content and is_pinned fields can be modified.
resource
string
required
Must be "lead-notes"
action
string
required
Must be "update"
id
string
required
The note UUID.
data
object
required

Response

success
boolean
data
object
const response = await ApiService.invoke<{ note: LeadNote }>({
  resource: "lead-notes",
  action: "update",
  id: "note-uuid-here",
  data: {
    content: "Updated note content",
    is_pinned: true,
  },
});

Delete a note

Permanently deletes a note.
resource
string
required
Must be "lead-notes"
action
string
required
Must be "delete"
id
string
required
The note UUID.

Response

success
boolean
data
object
const response = await ApiService.invoke<{
  success: boolean;
  message: string;
}>({
  resource: "lead-notes",
  action: "delete",
  id: "note-uuid-here",
});

Toggle pin status

Toggles the pinned status of a note. If the note is pinned it becomes unpinned, and vice versa.
resource
string
required
Must be "lead-notes"
action
string
required
Must be "togglePin"
id
string
required
The note UUID.

Response

success
boolean
data
object
const response = await ApiService.invoke<{ note: LeadNote }>({
  resource: "lead-notes",
  action: "togglePin",
  id: "note-uuid-here",
});

const updatedNote = response?.note;

Get pinned notes

Retrieves all pinned notes for a specific lead.
resource
string
required
Must be "lead-notes"
action
string
required
Must be "pinned"
data
object
required

Response

success
boolean
data
object
const response = await ApiService.invoke<{ notes: LeadNote[] }>({
  resource: "lead-notes",
  action: "pinned",
  data: {
    leadId: 123,
  },
});

const pinnedNotes = response?.notes || [];

Note object

id
string
UUID of the note.
lead_id
number
ID of the lead this note belongs to.
user_id
string | null
ID of the user who created the note.
content
string
The note text.
is_pinned
boolean | null
Whether the note is pinned. Pinned notes sort first in list results.
created_at
string | null
ISO 8601 timestamp.
updated_at
string | null
ISO 8601 timestamp.

Error responses

StatusCodeDescription
400VALIDATION_ERRORMissing required parameters (e.g. leadId)
401UNAUTHORIZEDInvalid or missing authentication token
403FORBIDDENUser does not own the lead
404NOT_FOUNDNote not found
500INTERNAL_ERRORServer error