Create a New Contact crm.contact.add
If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect to the MCP server so that the assistant can utilize the official REST documentation.
Scope:
crmWho can execute the method: any user with "add|import" access permission for contacts
DEPRECATED
The development of this method has been halted. Please use crm.item.add.
The method crm.contact.add creates a new contact.
Method Parameters
|
Name |
Description |
|
fields |
An object in the following format:
where:
The list of available fields is described below. An incorrect field in |
|
params |
An object containing a set of additional parameters. The structure and possible values are described below |
Parameter fields
|
Name |
Description |
|
HONORIFIC |
Salutation. The list of available salutation types can be obtained using the method Default — the first available salutation type |
|
NAME |
First name |
|
SECOND_NAME |
Middle name |
|
LAST_NAME |
Last name |
|
PHOTO |
Photograph |
|
BIRTHDATE |
Date of birth |
|
TYPE_ID |
Contact type. The list of available contact types can be obtained using the method Default — the first available contact type |
|
SOURCE_ID |
Source. The list of available source types can be obtained using the method Default — the first available source type |
|
SOURCE_DESCRIPTION |
Additional information about the source |
|
POST |
Position |
|
COMMENTS |
Comment. Supports BB codes |
|
OPENED |
Is it available to everyone? Possible values:
Default is |
|
EXPORT |
Is the contact included in the export? Possible values:
Default is |
|
ASSIGNED_BY_ID |
Identifier of the user responsible for the item. Default — the identifier of the user calling the method |
|
COMPANY_ID |
Identifier of the main company for the contact. The list of companies can be obtained using the method |
|
COMPANY_IDS |
Array of identifiers of companies associated with the contact. The list of companies can be obtained using the method |
|
UTM_SOURCE |
Advertising system (Google Ads, Microsoft Advertising, etc.) |
|
UTM_MEDIUM |
Traffic type. Possible values:
|
|
UTM_CAMPAIGN |
Advertising campaign designation |
|
UTM_CONTENT |
Campaign content. For example, for contextual ads |
|
UTM_TERM |
Campaign search condition. For example, keywords for contextual advertising |
|
TRACE |
Information for Sales Intelligence |
|
PHONE |
Phone |
|
EMAIL |
|
|
WEB |
Website |
|
Messenger |
|
|
LINK |
Links. Service field |
|
UF_... |
Custom fields. For example, Depending on the portal settings, contacts may have a set of custom fields of defined types. A custom field can be added to a contact using the method crm.contact.userfield.add |
|
PARENT_ID_... |
Relationship fields. If there are smart processes associated with contacts on the portal, there is a field for each such smart process that stores the relationship between that smart process and the contact. The field itself stores the identifier of the element of that smart process. For example, the field |
Fields for connections with external data sources
If the contact is created by an external system, then:
- the field
ORIGINATOR_IDstores the string identifier of that system - the field
ORIGIN_IDstores the string identifier of the contact in that external system - the field
ORIGIN_VERSIONstores the version of the contact data in that external system
|
Name |
Description |
|
ORIGINATOR_ID |
Identifier of the external system that is the source of data about this contact |
|
ORIGIN_ID |
Version of the contact data in the external system. Used to protect data from accidental overwriting by the external system. If the data was imported and not changed in the external system, such data can be edited in CRM without fear that the next export will lead to data overwriting |
|
ORIGIN_VERSION |
Original version |
Import
The fields are available for filling when the parameter IMPORT = 'Y' is passed in the params parameter.
|
Name |
Description |
|
DATE_CREATE |
Creation date. Available when Cannot be earlier than the creation date of the last created contact |
|
DATE_MODIFY |
Modification date. Available when |
|
CREATED_BY_ID |
Created by. Available when |
|
MODIFY_BY_ID |
Modified by. |
Deprecated fields
Address fields in the contact are deprecated and are only used for compatibility mode. To work with the address, use requisites.
|
Name |
Description |
|
ADDRESS |
Address |
|
ADDRESS_2 |
Second line of the address |
|
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 |
Location address identifier |
Parameter params
|
Name |
Description |
|
REGISTER_SONET_EVENT |
Should the event of adding a contact be registered in the live feed? Possible values:
Default is |
|
IMPORT |
Is import mode enabled? Possible values:
To pass the value Default is |
Code Examples
How to Use Examples in Documentation
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"FIELDS":{"HONORIFIC":"HNR_RU_1","NAME":"John","SECOND_NAME":"Doe","LAST_NAME":"Smith","PHOTO":{"fileData":"**put_photo_data_here**"},"BIRTHDATE":"11.11.2001","TYPE_ID":"PARTNER","SOURCE_ID":"WEB","SOURCE_DESCRIPTION":"*Additional information about the source*","POST":"Administrator","COMMENTS":"**put_comment_here**","OPENED":"Y","EXPORT":"N","ASSIGNED_BY_ID":6,"COMPANY_ID":12,"COMPANY_IDS":[12,13,15],"UTM_SOURCE":"google","UTM_MEDIUM":"CPC","UTM_CAMPAIGN":"summer_sale","UTM_CONTENT":"header_banner","UTM_TERM":"discount","PHONE":[{"VALUE":"+1333333555","VALUE_TYPE":"WORK"},{"VALUE":"+15599888666","VALUE_TYPE":"HOME"}],"EMAIL":[{"VALUE":"john.smith@example.mailing","VALUE_TYPE":"MAILING"},{"VALUE":"john.smith@example.work","VALUE_TYPE":"WORK"}],"UF_CRM_1720697698689":"Example value of a custom field with type \"String\"","PARENT_ID_1224":12}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.contact.add
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"FIELDS":{"HONORIFIC":"HNR_RU_1","NAME":"John","SECOND_NAME":"Doe","LAST_NAME":"Smith","PHOTO":{"fileData":"**put_photo_data_here**"},"BIRTHDATE":"11.11.2001","TYPE_ID":"PARTNER","SOURCE_ID":"WEB","SOURCE_DESCRIPTION":"*Additional information about the source*","POST":"Administrator","COMMENTS":"**put_comment_here**","OPENED":"Y","EXPORT":"N","ASSIGNED_BY_ID":6,"COMPANY_ID":12,"COMPANY_IDS":[12,13,15],"UTM_SOURCE":"google","UTM_MEDIUM":"CPC","UTM_CAMPAIGN":"summer_sale","UTM_CONTENT":"header_banner","UTM_TERM":"discount","PHONE":[{"VALUE":"+1333333555","VALUE_TYPE":"WORK"},{"VALUE":"+15599888666","VALUE_TYPE":"HOME"}],"EMAIL":[{"VALUE":"john.smith@example.mailing","VALUE_TYPE":"MAILING"},{"VALUE":"john.smith@example.work","VALUE_TYPE":"WORK"}],"UF_CRM_1720697698689":"Example value of a custom field with type \"String\"","PARENT_ID_1224":12},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.contact.add
try
{
const response = await $b24.callMethod(
'crm.contact.add',
{
fields: {
HONORIFIC: "HNR_RU_1",
NAME: "John",
SECOND_NAME: "Doe",
LAST_NAME: "Smith",
PHOTO: {
fileData: document.getElementById('photo'),
},
BIRTHDATE: '11.11.2001',
TYPE_ID: "PARTNER",
SOURCE_ID: "WEB",
SOURCE_DESCRIPTION: "*Additional information about the source*",
POST: "Administrator",
COMMENTS: `
Example comment within the contact
[B]Bold text[/B]
[I]Italic[/I]
[U]Underlined[/U]
[S]Strikethrough[/S]
[B][I][U][S]Mix[/S][/U][/I][/B]
[LIST]
[*]List item #1
[*]List item #2
[*]List item #3
[/LIST]
[LIST=1]
[*]Numbered list item #1
[*]Numbered list item #2
[*]Numbered list item #3
[/LIST]
`,
OPENED: "Y",
EXPORT: "N",
ASSIGNED_BY_ID: 6,
COMPANY_ID: 12,
COMPANY_IDS: [12, 13, 15],
UTM_SOURCE: "google",
UTM_MEDIUM: "CPC",
UTM_CAMPAIGN: "summer_sale",
UTM_CONTENT: "header_banner",
UTM_TERM: "discount",
PHONE: [
{
VALUE: "+1333333555",
VALUE_TYPE: "WORK",
},
{
VALUE: "+15599888666",
VALUE_TYPE: "HOME",
}
],
EMAIL: [
{
VALUE: "john.smith@example.mailing",
VALUE_TYPE: "MAILING",
},
{
VALUE: "john.smith@example.work",
VALUE_TYPE: "WORK",
}
],
UF_CRM_1720697698689: "Example value of a custom field with type \"String\"",
PARENT_ID_1224: 12,
},
}
);
const result = response.getData().result;
result.error()
? console.error(result.error())
: console.info(result)
;
}
catch( error )
{
console.error(error);
}
try {
$response = $b24Service
->core
->call(
'crm.contact.add',
[
'fields' => [
'HONORIFIC' => 'HNR_RU_1',
'NAME' => 'John',
'SECOND_NAME' => 'Doe',
'LAST_NAME' => 'Smith',
'PHOTO' => [
'fileData' => document.getElementById('photo'),
],
'BIRTHDATE' => '11.11.2001',
'TYPE_ID' => 'PARTNER',
'SOURCE_ID' => 'WEB',
'SOURCE_DESCRIPTION' => '*Additional information about the source*',
'POST' => 'Administrator',
'COMMENTS' => '
Example comment within the contact
[B]Bold text[/B]
[I]Italic[/I]
[U]Underlined[/U]
[S]Strikethrough[/S]
[B][I][U][S]Mix[/S][/U][/I][/B]
[LIST]
[*]List item #1
[*]List item #2
[*]List item #3
[/LIST]
[LIST=1]
[*]Numbered list item #1
[*]Numbered list item #2
[*]Numbered list item #3
[/LIST]
',
'OPENED' => 'Y',
'EXPORT' => 'N',
'ASSIGNED_BY_ID' => 6,
'COMPANY_ID' => 12,
'COMPANY_IDS' => [12, 13, 15],
'UTM_SOURCE' => 'google',
'UTM_MEDIUM' => 'CPC',
'UTM_CAMPAIGN' => 'summer_sale',
'UTM_CONTENT' => 'header_banner',
'UTM_TERM' => 'discount',
'PHONE' => [
[
'VALUE' => '+1333333555',
'VALUE_TYPE' => 'WORK',
],
[
'VALUE' => '+15599888666',
'VALUE_TYPE' => 'HOME',
]
],
'EMAIL' => [
[
'VALUE' => 'john.smith@example.mailing',
'VALUE_TYPE' => 'MAILING',
],
[
'VALUE' => 'john.smith@example.work',
'VALUE_TYPE' => 'WORK',
]
],
'UF_CRM_1720697698689' => 'Example value of a custom field with type "String"',
'PARENT_ID_1224' => 12,
]
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
processData($result);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error adding contact: ' . $e->getMessage();
}
BX24.callMethod(
'crm.contact.add',
{
fields: {
HONORIFIC: "HNR_RU_1",
NAME: "John",
SECOND_NAME: "Doe",
LAST_NAME: "Smith",
PHOTO: {
fileData: document.getElementById('photo'),
},
BIRTHDATE: '11.11.2001',
TYPE_ID: "PARTNER",
SOURCE_ID: "WEB",
SOURCE_DESCRIPTION: "*Additional information about the source*",
POST: "Administrator",
COMMENTS: `
Example comment within the contact
[B]Bold text[/B]
[I]Italic[/I]
[U]Underlined[/U]
[S]Strikethrough[/S]
[B][I][U][S]Mix[/S][/U][/I][/B]
[LIST]
[*]List item #1
[*]List item #2
[*]List item #3
[/LIST]
[LIST=1]
[*]Numbered list item #1
[*]Numbered list item #2
[*]Numbered list item #3
[/LIST]
`,
OPENED: "Y",
EXPORT: "N",
ASSIGNED_BY_ID: 6,
COMPANY_ID: 12,
COMPANY_IDS: [12, 13, 15],
UTM_SOURCE: "google",
UTM_MEDIUM: "CPC",
UTM_CAMPAIGN: "summer_sale",
UTM_CONTENT: "header_banner",
UTM_TERM: "discount",
PHONE: [
{
VALUE: "+1333333555",
VALUE_TYPE: "WORK",
},
{
VALUE: "+15599888666",
VALUE_TYPE: "HOME",
}
],
EMAIL: [
{
VALUE: "john.smith@example.mailing",
VALUE_TYPE: "MAILING",
},
{
VALUE: "john.smith@example.work",
VALUE_TYPE: "WORK",
}
],
UF_CRM_1720697698689: "Example value of a custom field with type \"String\"",
PARENT_ID_1224: 12,
},
},
(result) => {
result.error()
? console.error(result.error())
: console.info(result.data())
;
},
);
require_once('crest.php');
$result = CRest::call(
'crm.contact.add',
[
'fields' => [
'HONORIFIC' => 'HNR_RU_1',
'NAME' => 'John',
'SECOND_NAME' => 'Doe',
'LAST_NAME' => 'Smith',
'PHOTO' => [
'fileData' => document.getElementById('photo'),
],
'BIRTHDATE' => '11.11.2001',
'TYPE_ID' => 'PARTNER',
'SOURCE_ID' => 'WEB',
'SOURCE_DESCRIPTION' => '*Additional information about the source*',
'POST' => 'Administrator',
'COMMENTS' => '
Example comment within the contact
[B]Bold text[/B]
[I]Italic[/I]
[U]Underlined[/U]
[S]Strikethrough[/S]
[B][I][U][S]Mix[/S][/U][/I][/B]
[LIST]
[*]List item #1
[*]List item #2
[*]List item #3
[/LIST]
[LIST=1]
[*]Numbered list item #1
[*]Numbered list item #2
[*]Numbered list item #3
[/LIST]
',
'OPENED' => 'Y',
'EXPORT' => 'N',
'ASSIGNED_BY_ID' => 6,
'COMPANY_ID' => 12,
'COMPANY_IDS' => [12, 13, 15],
'UTM_SOURCE' => 'google',
'UTM_MEDIUM' => 'CPC',
'UTM_CAMPAIGN' => 'summer_sale',
'UTM_CONTENT' => 'header_banner',
'UTM_TERM' => 'discount',
'PHONE' => [
[
'VALUE' => '+1333333555',
'VALUE_TYPE' => 'WORK',
],
[
'VALUE' => '+15599888666',
'VALUE_TYPE' => 'HOME',
]
],
'EMAIL' => [
[
'VALUE' => 'john.smith@example.mailing',
'VALUE_TYPE' => 'MAILING',
],
[
'VALUE' => 'john.smith@example.work',
'VALUE_TYPE' => 'WORK',
]
],
'UF_CRM_1720697698689' => 'Example value of a custom field with type "String"',
'PARENT_ID_1224' => 12,
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Response Handling
HTTP status: 200
{
"result": 46,
"time": {
"start": 1723713732.235658,
"finish": 1723713733.742049,
"duration": 1.5063910484313965,
"processing": 1.1416668891906738,
"date_start": "2024-08-15T11:22:12+02:00",
"date_finish": "2024-08-15T11:22:13+02:00"
}
}
Returned Data
|
Name |
Description |
|
result |
The root element of the response, contains the identifier of the created contact |
|
time |
Information about the request execution time |
Error Handling
HTTP status: 400
{
"error": "",
"error_description": "Parameter 'fields' must be array."
}
|
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 Error Codes
|
Code |
Description |
Value |
|
|
|
The parameter |
|
|
|
The parameter |
|
|
|
The user does not have permission to "Add" or "Import" contacts |
|
|
Disk resource exhausted |
|
|
|
The field |
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 permitted for calls using batch |
|
|
|
The maximum length of parameters passed to the batch method has been exceeded |
|
|
|
Invalid access token or webhook code |
|
|
|
The HTTPS protocol is required for method calls |
|
|
|
The REST API is blocked due to overload. This is a manual individual block; please contact Bitrix24 technical support to lift it |
|
|
|
The REST API is only available on commercial plans |
|
|
|
The user associated with the access token or webhook used to call the method lacks the necessary 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 portal administrator has restricted access to this application to specific users only |
|
|
|
The public part of the site is closed. To open the public part of the site 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
- Update Contact crm.contact.update
- Get Contact by Id crm.contact.get
- Get a List of Contacts crm.contact.list
- Delete Contact crm.contact.delete
- Get Contact Fields crm.contact.fields
- Add Contact via Web Form
- Add a Contact with Details via Web Form
- How to Change or Delete Phone Numbers and Emails