CRM Leads Read¶
CRM Leads API is used to read the list of leads from the CRM
API URL¶
https://[YOUR-PBX-URL]/api/crm-leads
Data is sent via POST or GET and must be in the form:¶
Array
(
[action] => read
[page] => 1
[filters] => Array
(
[project_id] =>
[crm_type_id] =>
[contact_id] =>
[search] =>
[status] =>
)
[api_hash] => 07112231a9c89f5b108af08608a97b07
)
The action parameter must have the value read. The page parameter defaults to 1 and must be incremented up to pagination.max_page (a page greater than max_page returns the last page again). Leads are sorted ascending by ID, 100 per page.
HTTP headers:¶
Content-Type: application/json Authorization: Bearer <token>
Filters:¶
- project_id: project ID in PBX
- crm_type_id: CRM Type ID in PBX (lead type)
- contact_id: ID of the CRM contact linked to the lead
- search: search by subject, contact name / email / phone, remote_id or lead ID
- status: lead status: pending, prospecting, inprogress, feedback, scheduled, completed, cancelled, lost; open = all leads that are not completed, cancelled or lost. Defaults to all.
Any other filter returns the Invalid filter error.
Parameters example:
$params = array(
'action' => 'read',
'page' => 1,
'filters' => array(
'project_id' => null,
'crm_type_id' => null,
'contact_id' => 12,
'search' => null,
'status' => 'open',
)
);
Hash example:
$params['api_hash'] = md5(json_encode($params) . 'your_api_key'); // make hash
Sending data example:
$url = 'https://[YOUR-PBX-URL]/api/crm-leads';
$token = 'your_api_token';
echo curlPost($url, json_encode($params), array("Authorization: Bearer {$token}", "Content-Type: application/json"));
JSON data sent:
{
"action": "read",
"page": 1,
"filters": {
"project_id": null,
"crm_type_id": null,
"contact_id": 12,
"search": null,
"status": "open"
},
"api_hash": "07112231a9c89f5b108af08608a97b07"
}
Response¶
On success:
{
"has_error": false,
"messages": [ ],
"pagination": {
"row_count": 1,
"page_size": 100,
"current_page": 1,
"max_page": 1,
"first_displayed_page": 1,
"last_displayed_page": 1
},
"results": [
{
"id": "35",
"project_id": "1",
"crm_type_id": "4",
"contact_id": "12",
"subject": "Oferta abonament",
"contact_name": "John Doe",
"contact_email": "john.doe@example.com",
"contact_telephone": "0712345678",
"created": "2026-11-02 10:15:00",
"updated": "2026-11-03 09:20:00",
"closed_on": null,
"due_date": "2026-11-10",
"comments": null,
"added_by": "2",
"assigned_user_id": "3",
"value": "1200.00",
"currency": "RON",
"source": "api",
"remote_id": "LEAD-1234",
"status": "inprogress",
"date_created": "2026-11-02",
"date_updated": "2026-11-03",
"contact_crm_type_id": "1",
"assigned_contact_name": "John Doe",
"assigned_contact_email": "john.doe@example.com",
"assigned_contact_telephones": [
"0712345678"
],
"added_by_name": "Admin",
"assigned_user_name": "Jane Doe",
"assigned_user_email": "jane.doe@example.com",
"project_name": "While1",
"custom_fields": [ ]
}
]
}
custom_fields contains the custom fields of the lead type, with the lead's values.
On error:
{
"has_error": true,
"messages": [
"Invalid filter: project_idxx"
],
"pagination": [ ],
"results": [ ]
}
Available in other languages: RO