Get Contact by Id crm.contact.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: any user with "read" access permission for contacts
DEPRECATED
Development of this method has been halted. Please use crm.item.get.
The method crm.contact.get returns a contact by its identifier.
To retrieve a list of companies associated with the contact, use the method crm.contact.company.items.get.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
id* |
Identifier of the contact. Can be obtained using the methods |
Code Examples
How to Use Examples in Documentation
Get contact with id = 23
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"ID":23}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.contact.get
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"ID":23,"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.contact.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
// Shape of the payload returned in result (match the "response handling" section of the page)
type CrmContactResult = {
ID: string
NAME: string
LAST_NAME: string
TYPE_ID: string
SOURCE_ID: string
COMPANY_ID: string
ASSIGNED_BY_ID: string
OPENED: string
BIRTHDATE: ISODate | null
DATE_CREATE: ISODate | null
DATE_MODIFY: ISODate | null
LAST_ACTIVITY_TIME: ISODate | null
}
try {
const response = await $b24.actions.v2.call.make<CrmContactResult>({
method: 'crm.contact.get',
params: {
id: 23,
},
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('Contact:', result.ID, result.NAME, result.LAST_NAME)
}
} 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 getContact() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'crm.contact.get',
params: {
id: 23,
},
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('Contact:', result.ID, result.NAME, result.LAST_NAME)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', getContact)
</script>
try {
$contactId = 123; // Example contact ID
$contactResult = $serviceBuilder
->getCRMScope()
->contact()
->get($contactId);
$itemResult = $contactResult->contact();
print("ID: " . $itemResult->ID . PHP_EOL);
print("Name: " . $itemResult->NAME . PHP_EOL);
print("Last Name: " . $itemResult->LAST_NAME . PHP_EOL);
print("Birthday: " . $itemResult->BIRTHDATE?->format(DATE_ATOM) . PHP_EOL);
print("Created Date: " . $itemResult->DATE_CREATE->format(DATE_ATOM) . PHP_EOL);
print("Modified Date: " . $itemResult->DATE_MODIFY->format(DATE_ATOM) . PHP_EOL);
} catch (Throwable $e) {
print("Error: " . $e->getMessage() . PHP_EOL);
}
BX24.callMethod(
'crm.contact.get',
{
id: 23,
},
(result) => {
result.error()
? console.error(result.error())
: console.info(result.data())
;
},
);
require_once('crest.php');
$result = CRest::call(
'crm.contact.get',
[
'ID' => 23
]
);
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.contact.get", b24.Params{
"id": 23,
}, b24.WithIdempotent())
if err != nil {
return fmt.Errorf("crm.contact.get: %w", err)
}
var item struct {
ID b24.ID `json:"ID"`
Post string `json:"POST"`
Comments string `json:"COMMENTS"`
Honorific string `json:"HONORIFIC"`
Name string `json:"NAME"`
SecondName string `json:"SECOND_NAME"`
}
if err := json.Unmarshal(res.Result, &item); err != nil {
return fmt.Errorf("parse response: %w", err)
}
fmt.Println(item.ID, item.Post)
Response Handling
HTTP Status: 200
{
"result": {
"ID": "43",
"POST": "Administrator",
"COMMENTS": "\nExample comment within the contact\n\n[B]Bold text[\/B]\n[I]Italic[\/I]\n[U]Underlined[\/U]\n[S]Strikethrough[\/S]\n[B][I][U][S]Mix[\/S][\/U][\/I][\/B]\n\n[LIST]\n[*]List item #1\n[*]List item #2\n[*]List item #3\n[\/LIST]\n\n[LIST=1]\n[*]Numbered list item #1\n[*]Numbered list item #2\n[*]Numbered list item #3\n[\/LIST]\n",
"HONORIFIC": "HNR_RU_1",
"NAME": "John",
"SECOND_NAME": "Doe",
"LAST_NAME": "Smith",
"PHOTO": null,
"LEAD_ID": null,
"TYPE_ID": "PARTNER",
"SOURCE_ID": "WEB",
"SOURCE_DESCRIPTION": "*Additional information about the source*",
"COMPANY_ID": "12",
"BIRTHDATE": "2001-11-11T02:00:00+02:00",
"EXPORT": "N",
"HAS_PHONE": "Y",
"HAS_EMAIL": "Y",
"HAS_IMOL": "N",
"DATE_CREATE": "2024-08-15T10:38:21+02:00",
"DATE_MODIFY": "2024-08-15T10:38:21+02:00",
"ASSIGNED_BY_ID": "6",
"CREATED_BY_ID": "1",
"MODIFY_BY_ID": "1",
"OPENED": "Y",
"ORIGINATOR_ID": null,
"ORIGIN_ID": null,
"ORIGIN_VERSION": null,
"FACE_ID": null,
"LAST_ACTIVITY_TIME": "2024-08-15T10:38:21+02:00",
"ADDRESS": null,
"ADDRESS_2": null,
"ADDRESS_CITY": null,
"ADDRESS_POSTAL_CODE": null,
"ADDRESS_REGION": null,
"ADDRESS_PROVINCE": null,
"ADDRESS_COUNTRY": null,
"ADDRESS_LOC_ADDR_ID": null,
"UTM_SOURCE": "google",
"UTM_MEDIUM": "CPC",
"UTM_CAMPAIGN": "summer_sale",
"UTM_CONTENT": "header_banner",
"UTM_TERM": "discount",
"PARENT_ID_1224": "12",
"LAST_ACTIVITY_BY": "1",
"UF_CRM_1720697698689": "Example value of a custom field with type \u0022String\u0022",
"PHONE": [
{
"ID": "156",
"VALUE_TYPE": "WORK",
"VALUE": "+13333333555",
"TYPE_ID": "PHONE"
},
{
"ID": "157",
"VALUE_TYPE": "HOME",
"VALUE": "+15599888666",
"TYPE_ID": "PHONE"
}
],
"EMAIL": [
{
"ID": "158",
"VALUE_TYPE": "MAILING",
"VALUE": "johnsmith@example.mailing",
"TYPE_ID": "EMAIL"
},
{
"ID": "159",
"VALUE_TYPE": "WORK",
"VALUE": "johnsmith@example.work",
"TYPE_ID": "EMAIL"
}
]
},
"time": {
"start": 1723736139.883652,
"finish": 1723736140.299369,
"duration": 0.41571712493896484,
"processing": 0.14158892631530762,
"date_start": "2024-08-15T17:35:39+02:00",
"date_finish": "2024-08-15T17:35:40+02:00"
}
}
Returned Data
|
Name |
Description |
|
result |
Root element of the response. Contains information about the contact fields. The structure is described below |
|
time |
Object containing information about the request execution time |
contact
|
Name |
Description |
|
ID |
Identifier of the contact |
|
POST |
Position |
|
COMMENTS |
Comment |
|
HONORIFIC |
Salutation |
|
NAME |
First name |
|
SECOND_NAME |
Middle name |
|
LAST_NAME |
Last name |
|
PHOTO |
Photo |
|
LEAD_ID |
Identifier of the lead from which the contact was created |
|
TYPE_ID |
Type of contact |
|
SOURCE_ID |
Source |
|
SOURCE_DESCRIPTION |
Additional information about the source |
|
COMPANY_ID |
Identifier of the main company |
|
BIRTHDATE |
Date of birth |
|
EXPORT |
Whether the contact is included in exports. Possible values:
|
|
HAS_PHONE |
Is a phone number provided. Possible values:
|
|
HAS_EMAIL |
Is an e-mail provided. Possible values:
|
|
HAS_IMOL |
Is an open line provided. Possible values:
|
|
DATE_CREATE |
Creation date |
|
DATE_MODIFY |
Modification date |
|
ASSIGNED_BY_ID |
Responsible person |
|
CREATED_BY_ID |
Created by |
|
MODIFY_BY_ID |
Modified by |
|
OPENED |
Is it available to everyone. Possible values:
|
|
FACE_ID |
Link to faces from the |
|
LAST_ACTIVITY_TIME |
Last activity |
|
LAST_ACTIVITY_BY |
Who performed the last activity in the timeline |
|
UTM_SOURCE |
Advertising system (Google Ads, etc.) |
|
UTM_MEDIUM |
Type of traffic. Possible values:
|
|
UTM_CAMPAIGN |
Identifier of the advertising campaign |
|
UTM_CONTENT |
Content of the campaign. For example, for contextual ads |
|
UTM_TERM |
Search condition of the campaign. For example, keywords for contextual advertising |
|
PHONE |
Phone |
|
EMAIL |
|
|
WEB |
Website |
|
Messenger |
|
|
LINK |
Links. Service field |
Fields for external data source connections
If the contact was created by an external system, then:
- the
ORIGINATOR_IDfield stores the string identifier of that system - the
ORIGIN_IDfield stores the string identifier of the contact in that external system - the
ORIGIN_VERSIONfield stores the version of the contact data in that external system
|
Name |
Description |
|
ORIGINATOR_ID |
External source |
|
ORIGIN_ID |
Identifier of the element in the external source |
|
ORIGIN_VERSION |
Version of the original |
Deprecated Fields
Address fields in the contact are deprecated and are only used for compatibility. To work with addresses, use requisites.
|
Name |
Description |
|
ADDRESS |
Address |
|
ADDRESS_2 |
Second line of the address |
|
ADDRESS_CITY |
City |
|
ADDRESS_POSTAL_CODE |
Postal code |
|
ADDRESS_REGION |
District |
|
ADDRESS_PROVINCE |
Region |
|
ADDRESS_COUNTRY |
Country |
|
ADDRESS_LOC_ADDR_ID |
Identifier of the location address |
Fields of type crm_multifield
Fields of type crm_multifield (PHONE, EMAIL, WEB, IM, LINK) are explicitly returned by this method only if the values of this field are not equal to null.
Error Handling
HTTP Status: 400
{
"error": "",
"error_description": "ID is not defined or invalid."
}
|
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 Error Codes
|
Description |
Value |
|
|
The |
|
|
The user does not have permission to "Read" the contact |
|
|
The contact with the provided |
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 |
Continue Learning
- Create a New Contact crm.contact.add
- Update Contact crm.contact.update
- Get a List of Contacts crm.contact.list
- Delete Contact crm.contact.delete
- Get Contact Fields crm.contact.fields
- How to Change or Delete Phone Numbers and Emails
- Add Calendar Event for Client Management
- How to Send an E-mail to a Client on Behalf of an Employee