Get Lead by Id crm.lead.get
Choose a tool for developing with an AI agent:
- use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
- use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation
Scope:
crmWho can execute the method: a user with read access permission for the requested lead
DEPRECATED
The development of this method has been halted. Please use crm.item.get.
The method crm.lead.get returns a lead by its identifier.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
id* |
The identifier of the lead. 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
// This snippet is an ES module: top-level await requires type="module" or a bundler.
// $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
import { Text } from '@bitrix24/b24jssdk'
import type { B24Frame, ISODate } from '@bitrix24/b24jssdk'
declare const $b24: B24Frame
type CrmLeadMultifield = {
ID: string
VALUE_TYPE: string
VALUE: string
TYPE_ID: string
}
// Shape of the payload returned in result (a representative subset of the documented lead fields)
type CrmLead = {
ID: string
TITLE: string
NAME: string | null
LAST_NAME: string | null
STATUS_ID: string
SOURCE_ID: string
CURRENCY_ID: string
OPPORTUNITY: string
ASSIGNED_BY_ID: string
OPENED: string
DATE_CREATE: ISODate | null
DATE_MODIFY: ISODate | null
PHONE?: CrmLeadMultifield[]
}
try {
const response = await $b24.actions.v2.call.make<CrmLead>({
method: 'crm.lead.get',
params: {
id: 123,
},
requestId: Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
} else {
const result = response.getData()!.result
console.info('Lead title:', result.TITLE, 'status:', result.STATUS_ID)
}
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
<script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
<script>
async function getLead() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'crm.lead.get',
params: {
id: 123,
},
requestId: B24Js.Text.getUuidRfc4122()
})
// The payload is available only on a successful response
if (!response.isSuccess) {
console.error(response.getErrorMessages().join('; '))
return
}
const result = response.getData().result
console.info('Lead title:', result.TITLE, 'status:', result.STATUS_ID)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', getLead)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.crm.lead.get(
bitrix_id=1201,
).response
result = bitrix_response.result
print(result)
except BitrixAPIError as error:
print(
"Bitrix API error",
f"error: {error.error}",
f"error_description: {error.error_description}",
sep="\n",
)
except BitrixSDKException as error:
print(f"Bitrix SDK error: {error.message}")
except Exception as error:
print(f"Unexpected 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>';
// client and ctx are already created — see the Go SDK section
res, err := client.Core().Call(ctx, "crm.lead.get", b24.Params{
"id": 123,
}, b24.WithIdempotent())
if err != nil {
return fmt.Errorf("crm.lead.get: %w", err)
}
var item struct {
ID b24.ID `json:"ID"`
Title string `json:"TITLE"`
Name string `json:"NAME"`
IsReturnCustomer string `json:"IS_RETURN_CUSTOMER"`
Birthdate string `json:"BIRTHDATE"`
SourceID b24.ID `json:"SOURCE_ID"`
}
if err := json.Unmarshal(res.Result, &item); err != nil {
return fmt.Errorf("parse response: %w", err)
}
fmt.Println(item.ID, item.Title)
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": "EUR",
"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 |
The 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 are 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 |
Identifier of the currency |
|
OPPORTUNITY |
Estimated amount |
|
IS_MANUAL_OPPORTUNITY |
Indicator of manual calculation of the amount. Allowed values are Y or N |
|
HAS_PHONE |
Indicator of the phone field being filled. Allowed values are Y or N |
|
HAS_EMAIL |
Indicator of the email field being filled. Allowed values are Y or N |
|
HAS_IMOL |
Indicator of the presence of an attached open line. Allowed values are 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 are 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 internal purposes |
|
UTM_SOURCE |
Advertising system. Google Ads, Bing Ads, etc. |
|
UTM_MEDIUM |
Type of traffic. CPC (ads), CPM (banners) |
|
UTM_CAMPAIGN |
Identifier 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 CRM activity in the lead) |
|
LAST_ACTIVITY_TIME |
Time of the last activity |
|
UF_... |
Custom fields. For example, Depending on the portal 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 consists of digits, Latin letters, and underscores. It may arrive empty — in that case only |
|
error_description |
Error message for the developer. Do not show it to the end user without processing |
Possible Errors
|
Error Message |
Description |
|
|
The |
|
|
A lead with the specified |
|
|
The user does not have permission to read the lead |
Statuses and System Error Codes
HTTP Status: 4xx, 5xx
The errors described below are returned by the REST API itself, not by the logic of a specific method. They can arrive in response to any method.
|
Status |
Code |
Description |
|
|
|
An internal server error has occurred. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support |
|
|
|
The server returned an unexpected response. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
The method is blocked because the request resource intensity limit has been exceeded. The block is lifted automatically once the accumulated execution time of the method no longer exceeds the limit |
|
|
|
The request contains no authorization data: neither an access token nor a webhook code was passed |
|
|
|
Methods are called over the HTTPS protocol only |
|
|
|
The REST API is blocked due to overload. This is a manual individual block. To have it lifted, contact Bitrix24 technical support |
|
|
|
REST API access is not active for this account. In Bitrix24 Cloud, check the current plan or trial status: Vibe+ plans include REST API access, while Essentials plans do not. A webhook receives a different error message — |
|
|
|
No active webhook with the specified user identifier and secret code was found |
|
|
|
No method with this name was found. The name is misspelled, the method does not exist in the REST API, or it is unavailable without the required scope |
|
|
|
The request requires broader permissions than the token has: for a webhook these are the permissions granted to it, for an application it is the scope. For an application, the error message ends with |
|
|
|
The access token has expired |
|
|
|
The application is installed, but the Bitrix24 administrator has granted access to it only to specific users |
|
|
|
The public part of the site is closed. To open it on an on-premise installation, disable the "Temporary closure of the public part of the site" option. Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site |