Client Notes
The four endpoints that read, add, update and delete the internal notes attached to a client.
Overview
A note is an internal line attached to the client record. The client never sees it on any screen; only operators working in the panel read it.
A note can be pinned. Pinned notes sit at the top of the list and the rest run newest to oldest.
Reference
Listing Notes
Returns the client's notes. The order is fixed: pinned first, then newest to oldest.
curl 'https://panel.example.com/api/v1/admin/clients/42/notes' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.example.com/api/v1/admin/clients/42/notes', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/clients/42/notes');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Clients()->GetClientNotes(['id' => 42]);
foreach ($response['data'] as $note) {
if ($note['pinned']) {
$highlight[] = $note['content'];
}
}Adding a Note
Adds a note to the client. The owner of the calling key is recorded as the author.
false.201. Same shape as the list schema.curl -X POST 'https://panel.example.com/api/v1/admin/clients/42/notes' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"content":"Clean payment history, priority client","pinned":true}'const res = await fetch('https://panel.example.com/api/v1/admin/clients/42/notes', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({"content":"Clean payment history, priority client","pinned":true}),
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/clients/42/notes');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'content' => 'Clean payment history, priority client',
'pinned' => true,
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Clients()->CreateClientNote([
'id' => 42,
'content' => 'Clean payment history, priority client',
'pinned' => true,
]);Updating a Note
Changes the note text or its pinned state. You have to send at least one field.
curl -X PATCH 'https://panel.example.com/api/v1/admin/clients/42/notes/a1b2c3' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"pinned":false}'const res = await fetch('https://panel.example.com/api/v1/admin/clients/42/notes/a1b2c3', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ pinned: false }),
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/clients/42/notes/a1b2c3');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['pinned' => false]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Unpinning goes through this endpoint too; there is no separate action.
$response = Api::Clients()->UpdateClientNote([
'id' => 42,
'note_id' => 'a1b2c3',
'pinned' => false,
]);Deleting a Note
Deletes the note.
curl -X DELETE 'https://panel.example.com/api/v1/admin/clients/42/notes/a1b2c3' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.example.com/api/v1/admin/clients/42/notes/a1b2c3', {
method: 'DELETE',
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.example.com/api/v1/admin/clients/42/notes/a1b2c3');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Clients()->DeleteClientNote([
'id' => 42,
'note_id' => 'a1b2c3',
]);Pitfalls
Unlike the other resources, id here is a string (a1b2c3). Code that casts it to a number will not find the record.
In the panel pinning looks like its own action; in the API pinned is a field like any other and goes through the update endpoint.
Related Articles
Thanks for your feedback!
Our support team is here around the clock for anything you can't find above.