Notes
Use this endpoint to manipulate and obtain details on Contact Notes in Mautic.
Permissions
The Notes API uses the lead:notes permission set, which is separate from the lead:leads - Contact on UI - permission set. However, lead:notes permissions don’t grant access to the associated Contact: any operation involving a Contact still requires the appropriate lead:leads permission.
For the standalone /notes endpoints, Mautic evaluates viewown/viewother, editown/editother, and deleteown/deleteother against the User who created the Note, not the owner of the associated Contact. The Note’s createdBy field determines ownership.
Permission |
Description |
|---|---|
|
View Notes created by the authenticated User |
|
View Notes created by other Users |
|
Edit Notes created by the authenticated User |
|
Edit Notes created by other Users |
|
Create new Notes |
|
Delete Notes created by the authenticated User |
|
Delete Notes created by other Users |
|
Full access to all Note operations |
Using the Mautic API library
You can interact with this API using the Mautic API Library as below, or the various HTTP endpoints described in this document.
<?php
use Mautic\MauticApi;
use Mautic\Auth\ApiAuth;
// ...
$initAuth = new ApiAuth();
$auth = $initAuth->newAuth($settings);
$apiUrl = "https://example.com";
$api = new MauticApi();
$noteApi = $api->newApi("notes", $auth, $apiUrl);
Get Note
Retrieves an individual Note.
<?php
//...
$note = $noteApi->get($id);
HTTP request
GET /notes/ID
Required permissions: lead:notes:viewown or lead:notes:viewother
Response
Returns
200 OKwhen the request successfully retrieves the Note.
{
"note": {
"id": 1,
"text": "<p>Discussed product demo requirements. Follow-up scheduled for next week.</p>",
"type": "general",
"dateTime": "2015-07-23T13:14:00-05:00",
"lead": {
"id": 47
},
"dateAdded": "2015-07-23T13:14:00-05:00",
"createdBy": 1,
"createdByUser": "Joe Smith"
}
}
Properties
Name |
Type |
Description |
|---|---|---|
|
integer |
ID of the Note |
|
string |
Body content of the Note - supports HTML |
|
string |
Type of Note: |
|
datetime |
Date and time associated with the Note |
|
object |
The Contact associated with this Note |
|
datetime |
Note creation date and time |
|
integer |
ID of the User who created the Note |
|
string |
Name of the User who created the Note |
List Notes
Retrieves a list of Notes.
<?php
//...
$notes = $noteApi->getList($searchFilter, $start, $limit, $orderBy, $orderByDir);
HTTP request
GET /notes
Required permissions: lead:notes:viewown or lead:notes:viewother
Query parameters
Name |
Description |
|---|---|
|
String or search command to filter entities by |
|
Starting row for the entities returned - defaults to |
|
Limit number of entities to return - defaults to the system configuration for pagination |
|
Column to sort by. Any column in the response is valid. Note: convert |
|
Sort direction - |
Response
Returns
200 OKwhen the request successfully retrieves the Notes list.
{
"total": 2,
"notes": [
{
"id": 1,
"text": "<p>Discussed product demo requirements. Follow-up scheduled for next week.</p>",
"type": "general",
"dateTime": "2015-07-23T13:14:00-05:00",
"lead": {
"id": 47
}
},
// ...
]
}
Create Note
Creates a new Note for a Contact.
<?php
$data = [
'lead' => 47,
'text' => 'Note content here',
'type' => 'general',
];
$note = $noteApi->create($data);
HTTP request
POST /notes/new
Required permissions: lead:notes:create
Note
In addition to lead:notes:create, the User must have permission to view the associated Contact - lead:leads:viewown or lead:leads:viewother. Mautic checks view access against the Contact owner before creating the Note.
POST parameters
Name |
Required |
Description |
|---|---|---|
|
Yes |
ID of the Contact to associate the Note with |
|
Yes |
Body content of the Note - supports HTML |
|
No |
Type of Note: |
|
No |
Date and time associated with the Note - auto-set to current time if not provided |
Response
Returns
201 Createdwhen the Note is successfully created.
The response is a JSON object similar to Get Note.
Edit Note
Edits a Note. This operation supports PUT or PATCH depending on the desired behavior:
PUT: full replacement. The request creates a new Note if the ID is missing. If the ID exists, the request clears all existing data and replaces it with the provided values.PATCH: partial update. The request only updates field values based on the request data. The request fails when the Note ID doesn’t exist.
<?php
$id = 1;
$data = [
'text' => 'Updated note content',
'type' => 'call',
];
// Using PATCH - update specific fields only
$note = $noteApi->edit($id, $data);
// Using PUT - create or completely replace
$note = $noteApi->edit($id, $data, true);
HTTP request
PUT /notes/ID/edit: updates an existing Note or creates a new one when the ID doesn’t exist.PATCH /notes/ID/edit: updates an existing Note. The request fails when the ID doesn’t exist.
Required permissions: lead:notes:editown or lead:notes:editother
POST parameters
Accepts the same parameters as those described in Create Note. All parameters are optional.
Response
PUT: returns200 OKwhen the request successfully updates the Note or201 Createdwhen the request creates a Note.PATCH: returns200 OKwhen the request successfully updates the Note or404 Not Founderror when the Note ID doesn’t exist.
The response is a JSON object similar to Get Note.
Delete Note
Deletes a Note.
<?php
$note = $noteApi->delete($id);
HTTP request
DELETE /notes/ID/delete
Required permissions: lead:notes:deleteown or lead:notes:deleteother
Response
Returns
200 OKwhen the Note is successfully deleted.
The response is a JSON object containing the data of the deleted Note, similar to Get Note.
{
"note": {
"id": 1,
"text": "<p>Discussed product demo requirements. Follow-up scheduled for next week.</p>",
"type": "general",
"dateTime": "2015-07-23T13:14:00-05:00",
"lead": {
"id": 47
},
"dateAdded": "2015-07-23T13:14:00-05:00",
"createdBy": 1,
"createdByUser": "Joe Smith"
}
}
Properties
Refer to Note properties.