CRM Leads Read¶
API CRM Leads se foloseste pentru a citi lista de lead-uri din CRM
API URL¶
https://[YOUR-PBX-URL]/api/crm-leads
Datele se transmit prin POST sau GET si trebuie sa fie de forma:¶
Array
(
[action] => read
[page] => 1
[filters] => Array
(
[project_id] =>
[crm_type_id] =>
[contact_id] =>
[search] =>
[status] =>
)
[api_hash] => 07112231a9c89f5b108af08608a97b07
)
Parametrul action trebuie sa aiba valoarea read. Parametrul page este implicit 1 si se incrementeaza pana la pagination.max_page (o pagina mai mare decat max_page intoarce tot ultima pagina). Lead-urile sunt ordonate crescator dupa ID, cate 100 pe pagina.
Headere HTTP:¶
Content-Type: application/json Authorization: Bearer <token>
Filtre:¶
- project_id: ID proiect in centrala
- crm_type_id: ID CRM Type in centrala (tipul de lead)
- contact_id: ID-ul contactului din CRM asociat lead-ului
- search: Cautare dupa subiect, nume / email / telefon contact, remote_id sau ID lead
- status: Status lead: pending, prospecting, inprogress, feedback, scheduled, completed, cancelled, lost; open = toate lead-urile care nu sunt completed, cancelled sau lost. Implicit toate.
Orice alt filtru intoarce eroarea Invalid filter.
Exemplu generare parametri:
$params = array(
'action' => 'read',
'page' => 1,
'filters' => array(
'project_id' => null,
'crm_type_id' => null,
'contact_id' => 12,
'search' => null,
'status' => 'open',
)
);
Exemplu generare hash:
$params['api_hash'] = md5(json_encode($params) . 'your_api_key'); // make hash
Exemplu trimitere date:
$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"));
Date trimise JSON:
{
"action": "read",
"page": 1,
"filters": {
"project_id": null,
"crm_type_id": null,
"contact_id": 12,
"search": null,
"status": "open"
},
"api_hash": "07112231a9c89f5b108af08608a97b07"
}
Raspuns¶
In caz de succes:
{
"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 contine campurile custom ale tipului de lead, cu valorile lead-ului.
Sau in caz de eroare:
{
"has_error": true,
"messages": [
"Invalid filter: project_idxx"
],
"pagination": [ ],
"results": [ ]
}
Disponibil si in alte limbi: EN