Get lead by Id crm.lead.get
Scope:
crmWho can execute the method: a user with read access permission for the requested lead
Method Development Stopped
The method crm.lead.get continues to function, but there is a more relevant alternative crm.item.get.
The method crm.lead.get returns a lead by its identifier.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
id* |
Lead identifier. The identifier can be obtained using the methods crm.lead.list or crm.lead.add |
Code Examples
How to Use Examples in Documentation
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"ID":123}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.lead.get
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"ID":123,"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.lead.get
try
{
const response = await $b24.callMethod(
'crm.lead.get',
{ id: 123 }
);
const result = response.getData().result;
console.info(result);
}
catch( error )
{
console.error(error);
}
try {
$response = $b24Service
->core
->call(
'crm.lead.get',
[
'id' => 123,
]
);
$result = $response
->getResponseData()
->getResult();
if ($result->error()) {
error_log($result->error());
return;
}
echo 'Lead data: ' . print_r($result->data(), true);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error getting lead data: ' . $e->getMessage();
}
BX24.callMethod(
'crm.lead.get',
{ id: 123 },
(result) => {
if(result.error())
{
console.error(result.error());
return;
}
console.info(result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'crm.lead.get',
[
'ID' => 123
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Response Handling
HTTP status: 200
{
"result": {
"ID": "123",
"TITLE": "Lead #1591",
"HONORIFIC": null,
"NAME": "",
"SECOND_NAME": null,
"LAST_NAME": null,
"COMPANY_TITLE": null,
"COMPANY_ID": null,
"CONTACT_ID": null,
"IS_RETURN_CUSTOMER": "N",
"BIRTHDATE": "",
"SOURCE_ID": "1",
"SOURCE_DESCRIPTION": null,
"STATUS_ID": "IN_PROCESS",
"STATUS_DESCRIPTION": null,
"POST": null,
"COMMENTS": null,
"CURRENCY_ID": "USD",
"OPPORTUNITY": "0.00",
"IS_MANUAL_OPPORTUNITY": "N",
"HAS_PHONE": "N",
"HAS_EMAIL": "N",
"HAS_IMOL": "N",
"ASSIGNED_BY_ID": "1",
"CREATED_BY_ID": "1",
"MODIFY_BY_ID": "1",
"DATE_CREATE": "2024-05-23T18:18:25+02:00",
"DATE_MODIFY": "2024-05-23T18:18:25+02:00",
"DATE_CLOSED": "",
"STATUS_SEMANTIC_ID": "P",
"OPENED": "Y",
"ORIGINATOR_ID": null,
"ORIGIN_ID": null,
"MOVED_BY_ID": "1",
"MOVED_TIME": "2024-05-23T18:18:25+02:00",
"ADDRESS": null,
"ADDRESS_2": null,
"ADDRESS_CITY": null,
"ADDRESS_POSTAL_CODE": null,
"ADDRESS_REGION": null,
"ADDRESS_PROVINCE": null,
"ADDRESS_COUNTRY": null,
"ADDRESS_COUNTRY_CODE": null,
"ADDRESS_LOC_ADDR_ID": null,
"UTM_SOURCE": null,
"UTM_MEDIUM": null,
"UTM_CAMPAIGN": null,
"UTM_CONTENT": null,
"UTM_TERM": null,
"LAST_ACTIVITY_BY": "1",
"LAST_ACTIVITY_TIME": "2024-05-23T18:18:25+02:00",
"PHONE": [
{
"ID": "11658",
"VALUE_TYPE": "OTHER",
"VALUE": "+15454777777",
"TYPE_ID": "PHONE"
}
],
"IM": [
{
"ID": "11660",
"VALUE_TYPE": "OPENLINE",
"VALUE": "imol|livechat|1|67|21",
"TYPE_ID": "IM"
}
]
},
"time": {
"start": 1705764932.998683,
"finish": 1705764937.173995,
"duration": 4.1753120422363281,
"processing": 3.3076529502868652,
"date_start": "2024-01-20T18:35:32+02:00",
"date_finish": "2024-01-20T18:35:37+02:00",
"operating_reset_at": 1705765533,
"operating": 3.3076241016387939
}
}
Returned Data
|
Name |
Description |
|
result |
Root element of the response. Contains information about the lead fields. The structure is described below |
|
time |
Information about the request execution time |
Type lead
|
Name |
Description |
|
ID |
Integer identifier of the lead |
|
TITLE |
Title of the lead |
|
HONORIFIC |
Type of address. Status from the directory. A list of possible identifiers can be obtained using the method crm.status.list with the filter |
|
NAME |
Contact's first name |
|
SECOND_NAME |
Contact's middle name |
|
LAST_NAME |
Contact's last name |
|
COMPANY_ID |
Link of the lead to the company |
|
COMPANY_TITLE |
Company name |
|
CONTACT_ID |
Link of the lead to the contact |
|
IS_RETURN_CUSTOMER |
Indicator of a returning lead. Allowed values Y or N |
|
BIRTHDATE |
Date of birth |
|
SOURCE_ID |
Identifier of the source. Status from the directory. A list of possible identifiers can be obtained using the method crm.status.list with the filter |
|
SOURCE_DESCRIPTION |
Description of the source |
|
STATUS_ID |
Identifier of the lead stage. Status from the directory. A list of possible identifiers can be obtained using the method crm.status.list with the filter |
|
STATUS_DESCRIPTION |
Additional information about the stage |
|
POST |
Position |
|
COMMENTS |
Comments |
|
CURRENCY_ID |
Currency identifier |
|
OPPORTUNITY |
Estimated amount |
|
IS_MANUAL_OPPORTUNITY |
Indicator of manual calculation of the amount. Allowed values Y or N |
|
HAS_PHONE |
Indicator of phone field completion. Allowed values Y or N |
|
HAS_EMAIL |
Indicator of email field completion. Allowed values Y or N |
|
HAS_IMOL |
Indicator of the presence of an attached open line. Allowed values Y or N |
|
ASSIGNED_BY_ID |
Identifier of the user responsible for the lead |
|
CREATED_BY_ID |
Identifier of the user who created the lead |
|
MODIFY_BY_ID |
Identifier of the user who last modified the lead |
|
MOVED_BY_ID |
Identifier of the user who moved the item to the current stage |
|
DATE_CREATE |
Creation date |
|
DATE_MODIFY |
Modification date |
|
DATE_CLOSED |
Closing date |
|
STATUS_SEMANTIC_ID |
|
|
OPENED |
Indicator of the lead's availability to everyone. Allowed values Y or N |
|
ORIGINATOR_ID |
Identifier of the data source. Used only for linking to an external source |
|
ORIGIN_ID |
Identifier of the item in the data source. Used only for linking to an external source |
|
MOVED_TIME |
Date of moving the item to the current stage |
|
ADDRESS |
Contact's address |
|
ADDRESS_2 |
Second line of the address. In some countries, it is customary to split the address into 2 parts |
|
ADDRESS_CITY |
City |
|
ADDRESS_POSTAL_CODE |
Postal code |
|
ADDRESS_REGION |
Region |
|
ADDRESS_PROVINCE |
Province |
|
ADDRESS_COUNTRY |
Country |
|
ADDRESS_COUNTRY_CODE |
Country code |
|
ADDRESS_LOC_ADDR_ID |
Used for service purposes |
|
UTM_SOURCE |
Advertising system. Google Ads, Facebook Ads, and others |
|
UTM_MEDIUM |
Type of traffic. CPC (ads), CPM (banners) |
|
UTM_CAMPAIGN |
Designation of the advertising campaign |
|
UTM_CONTENT |
Content of the campaign. For example, for contextual ads |
|
UTM_TERM |
Search term of the campaign. For example, keywords for contextual advertising |
|
LAST_ACTIVITY_BY |
Identifier of the user responsible for the last activity in this lead (e.g., who created a new activity in the lead) |
|
LAST_ACTIVITY_TIME |
Time of the last activity |
|
UF_... |
Custom fields. For example, Depending on the account settings, leads may have a set of custom fields of specific types. To create, modify, or delete custom fields in leads, use the methods crm.lead.userfield.* |
|
PHONE |
Array of phone numbers |
|
Array of messengers |
Error Handling
40x, 50x Error
{
"error": "",
"error_description": "Not found"
}
|
Name |
Description |
|
error |
String error code. It may consist of digits, Latin letters, and underscores |
|
error_description |
Textual description of the error. The description is not intended to be shown to the end user in its raw form |
Possible Errors
|
Error Text |
Description |
|
|
The |
|
|
A lead with the specified |
|
|
The user does not have permission to read the lead |
Statuses and System Error Codes
HTTP Status: 20x, 40x, 50x
The errors described below may occur when calling any method.
|
Status |
Code |
Description |
|
|
|
An internal server error has occurred, please contact the server administrator or Bitrix24 technical support |
|
|
|
An internal server error has occurred, please contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
The current method is not allowed to be called using batch |
|
|
|
The maximum length of parameters passed to the batch method has been exceeded |
|
|
|
Invalid access token or webhook code |
|
|
|
The methods must be called using the HTTPS protocol |
|
|
|
The REST API is blocked due to overload. This is a manual individual block, to remove it you need to contact Bitrix24 technical support |
|
|
|
The REST API is available only on commercial plans |
|
|
|
The user whose access token or webhook was used to call the method lacks permissions |
|
|
|
The manifest is not available |
|
|
|
The request requires higher privileges than those provided by the webhook token |
|
|
|
The provided access token has expired |
|
|
|
The user does not have access to the application. This means that the application is installed, but the account administrator has allowed access to this application only for specific users |
|
|
|
The public part of the site is closed. To open the public part of the site on an on-premise installation, disable the option "Temporary closure of the public part of the site". Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site |