Create a New CRM Entity crm.item.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 the "add" access permission for the CRM entity
This method is a universal approach for creating objects in CRM. It allows you to create various types of objects, such as deals, contacts, companies, and others.
To create an object, you need to pass the appropriate parameters, including the object type and its information: title, description, contact details, and other specifics.
Upon successful execution of the request, a new object is created.
This method provides a flexible opportunity to automate the process of creating objects and integrate CRM with other systems.
When creating an entity, a standard series of checks, modifications, and automatic actions are performed:
- access permissions are checked
- required fields are validated
- dependent required fields based on stages are validated
- field values are checked for correctness
- default values are assigned to fields
- automation rules are triggered after saving
Next, we will take a closer look at how to use this method and what parameters need to be passed.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
entityTypeId* |
Identifier of the system or custom type whose element we want to create. Numeric values for system types (Lead — 1, Deal — 2, Contact — 3, Company — 4, Invoice — 31, etc.) are listed in the CRM object types reference. The identifier of the smart process can be obtained using the crm.type.list method. |
|
fields* |
Object format.
where
Each CRM entity type has its own set of fields. This means that the set of fields for creating a Lead does not have to match the set of fields for creating a Contact or SPA. The list of available fields for each entity type is described below. An incorrect field in |
|
useOriginalUfNames |
Parameter to control the format of custom field names in the request and response.
Default is |
Parameter fields
Required parameters are marked with *
CRM object identifier entityTypeId: 1
|
Name |
Description |
|
title |
Title of the entity. By default, it is generated using the template
For example, for a lead with |
|
honorific |
String identifier for the lead's address (e.g., The list of available addresses can be obtained using Default is |
|
name |
First name. Default is |
|
secondName |
Middle name. Default is |
|
lastName |
Last name. Default is |
|
birthdate |
Date of birth. Default is |
|
companyTitle |
Company name. Default is |
|
sourceId |
String identifier for the source. For example, The list of available sources can be obtained using Default is the first available source |
|
sourceDescription |
Additional information about the source. Default is |
|
stageId |
String identifier for the stage of the entity. For example, The list of available stages can be obtained using Default is the first available stage |
|
statusDescription |
Additional information about the stage. Default is |
|
post |
Position. Default is |
|
currencyId |
Identifier of the currency for the entity. Default is the default currency |
|
isManualOpportunity |
Mode for calculating the amount. Possible values:
Default is |
|
opportunity |
Amount. Default is |
|
opened |
Whether the entity is available to everyone. Possible values:
Default is |
|
comments |
Comment. Default is |
|
assignedById |
Identifier of the user responsible for the entity. Default is the identifier of the user calling the method |
|
companyId |
Identifier of the company linked to the entity. The list of companies can be obtained using the Default is |
|
contactId |
Identifier of the contact linked to the entity. The list of contacts can be obtained using the Default is |
|
contactIds |
List of identifiers of contacts linked to the entity. The list of contacts can be obtained using the Default is |
|
originatorId |
External source. Default is |
|
originId |
Identifier of the entity in the external source. Default is |
|
webformId |
Identifier of the CRM Form. Default is |
|
observers |
Array of identifiers of users who will be observers in the entity. Default is |
|
utmSource |
Advertising system. For example: Google Ads, Bing Ads, etc. Default is |
|
utmMedium |
Type of traffic. Possible values:
Default is |
|
utmCampaign |
Identifier of the advertising campaign. Default is |
|
utmContent |
Content of the campaign. For example, for contextual ads. Default is |
|
utmTerm |
Search condition of the campaign. For example, keywords for contextual advertising. Default is |
|
ufCrm... |
Custom field. Read about custom fields in the section Custom Fields in CRM: Overview of Methods Values of multiple fields are passed as an array. To upload a file, the value of the custom field must be an array where the first element is the file name and the second is the content of the file encoded in base64. |
|
parentId... |
Parent field. An element of another type of CRM object that is linked to this element. Each such field has the code |
|
fm |
Array of multifields. More about multifields can be read in the section crm_multifield Structure of a multifield:
Example:
Default is |
CRM object identifier entityTypeId: 2
|
Name |
Description |
|
title |
Title of the entity. By default, it is generated using the template
|
|
typeId |
String identifier for the entity type. For example, for a deal: The list of available entity types can be obtained using Default is the first available entity type |
|
categoryId |
Identifier of the direction (funnel) of the deal. Default is |
|
stageId |
String identifier for the stage of the entity. For example, The list of available stages can be obtained using
Default is the first available stage relative to the funnel |
|
isRecurring |
Whether the deal is recurring. Possible values:
Default is |
|
probability |
Probability %. Default is |
|
currencyId |
Identifier of the currency for the entity. Default is the default currency |
|
isManualOpportunity |
Mode for calculating the amount. Possible values:
Default is |
|
opportunity |
Amount. Default is |
|
taxValue |
Tax amount. Default is |
|
companyId |
Identifier of the company linked to the entity. The list of companies can be obtained using the Default is |
|
contactId |
Identifier of the contact linked to the entity. The list of contacts can be obtained using the Default is |
|
contactIds |
List of identifiers of contacts linked to the entity. The list of contacts can be obtained using the Default is |
|
quoteId |
Identifier of the estimate that will be linked to the deal |
|
begindate |
Start date of the entity. Default is the creation date |
|
closedate |
End date of the entity. Default is the creation date of the entity + 7 days |
|
opened |
Whether the entity is available to everyone. Possible values:
Default is |
|
comments |
Comment. Default is |
|
assignedById |
Identifier of the user responsible for the entity. Default is the identifier of the user calling the method |
|
sourceId |
String identifier for the source. For example, The list of available sources can be obtained using Default is the first available source |
|
sourceDescription |
Additional information about the source. Default is |
|
leadId |
Identifier of the lead based on which the entity is created. Default is |
|
additionalInfo |
Additional information. Default is |
|
originatorId |
External source. Default is |
|
originId |
Identifier of the entity in the external source. Default is |
|
observers |
Array of identifiers of users who will be observers in the entity. Default is |
|
locationId |
Identifier of the location. Service field. Default is |
|
utmSource |
Advertising system. Google Ads, Bing Ads, etc. Default is |
|
utmMedium |
Type of traffic. Possible values:
Default is |
|
utmCampaign |
Identifier of the advertising campaign. Default is |
|
utmContent |
Content of the campaign. For example, for contextual ads. Default is |
|
utmTerm |
Search condition of the campaign. For example, keywords for contextual advertising. Default is |
|
ufCrm... |
Custom field. See the section Custom Fields in CRM: Overview of Methods
|
|
parentId... |
Parent field. An element of another type of CRM object that is linked to this element. Each such field has the code |
CRM object identifier entityTypeId: 3
|
Name |
Description |
|
honorific |
String identifier for the contact's address. For example, The list of available addresses can be obtained using Default is |
|
name |
First name. Default is |
|
secondName |
Middle name. Default is |
|
lastName |
Last name. Default is |
|
photo |
Photo. Default is |
|
birthdate |
Date of birth. Default is |
|
typeId |
String identifier for the entity type. For example, for a deal: The list of available entity types can be obtained using Default is the first available entity type |
|
sourceId |
String identifier for the source. For example, The list of available sources can be obtained using Default is the first available source |
|
sourceDescription |
Additional information about the source. Default is |
|
post |
Position. Default is |
|
comments |
Comment. Default is |
|
opened |
Whether the entity is available to everyone. Possible values:
Default is |
|
export |
Whether the contact is included in the export. Default is |
|
assignedById |
Identifier of the user responsible for the entity. Default is the identifier of the user calling the method |
|
companyId |
Identifier of the company linked to the entity. The list of companies can be obtained using the Default is |
|
companyIds |
Array of identifiers of companies that will be linked to the entity |
|
leadId |
Identifier of the lead based on which the entity is created. Default is |
|
originatorId |
External source. Default is |
|
originId |
Identifier of the entity in the external source. Default is |
|
originVersion |
Version of the original. Default is |
|
observers |
Array of identifiers of users who will be observers in the entity. Default is |
|
utmSource |
Advertising system. Google Ads, Bing Ads, etc. Default is |
|
utmMedium |
Type of traffic. Possible values:
Default is |
|
utmCampaign |
Identifier of the advertising campaign. Default is |
|
utmContent |
Content of the campaign. For example, for contextual ads. Default is |
|
utmTerm |
Search condition of the campaign. For example, keywords for contextual advertising. Default is |
|
ufCrm... |
Custom field. See the section Custom Fields in CRM: Overview of Methods
|
|
parentId... |
Parent field. An element of another type of CRM object that is linked to this element. Each such field has the code |
|
fm |
Array of multifields. More about multifields can be read in the section crm_multifield Structure of a multifield:
Example:
Default is |
CRM object identifier entityTypeId: 4
|
Name |
Description |
|
title |
Title of the entity. By default, it is generated using the template
For example, for a company with |
|
typeId |
String identifier for the entity type. For example, for a deal: The list of available entity types can be obtained using Default is the first available entity type |
|
logo |
Logo. Default is |
|
bankingDetails |
Banking details. Default is |
|
industry |
String identifier for the industry type. For example, The list of available industry types can be obtained using the Default is the first available industry type |
|
employees |
String identifier for the number of employees. The value is taken from the available list, for example, The list of available employee counts can be obtained using the Default is the first available employee count |
|
currencyId |
Identifier of the currency for the entity. Default is the default currency |
|
revenue |
Annual revenue. Default is |
|
opened |
Whether the entity is available to everyone. Possible values:
Default is |
|
comments |
Comment. Default is |
|
isMyCompany |
Whether the company is my company. Default is |
|
assignedById |
Identifier of the user responsible for the entity. Default is the identifier of the user calling the method |
|
contactIds |
List of identifiers of contacts linked to the entity. The list of contacts can be obtained using the Default is |
|
leadId |
Identifier of the lead based on which the entity is created. Default is |
|
originatorId |
External source. Default is |
|
originId |
Identifier of the entity in the external source. Default is |
|
originVersion |
Version of the original. Default is |
|
observers |
Array of identifiers of users who will be observers in the entity. Default is |
|
utmSource |
Advertising system. Google Ads, Bing Ads, etc. Default is |
|
utmMedium |
Type of traffic. Possible values:
Default is |
|
utmCampaign |
Identifier of the advertising campaign. Default is |
|
utmContent |
Content of the campaign. For example, for contextual ads. Default is |
|
utmTerm |
Search condition of the campaign. For example, keywords for contextual advertising. Default is |
|
ufCrm... |
Custom field. See the section Custom Fields in CRM: Overview of Methods
|
|
parentId... |
Parent field. An element of another type of CRM object that is linked to this element. Each such field has the code |
|
fm |
Array of multifields. More about multifields can be read in the section crm_multifield Structure of a multifield:
Example:
Default is |
CRM object identifier entityTypeId: 7
|
Name |
Description |
|
title |
Title of the entity. By default, it is generated using the template
For example, for an estimate with |
|
assignedById |
Identifier of the user responsible for the entity. Default is the identifier of the user calling the method |
|
opened |
Whether the entity is available to everyone. Possible values:
Default is |
|
content |
Content. Default is |
|
terms |
Terms. Default is |
|
comments |
Comment. Default is |
|
dealId |
Identifier of the linked deal. Default is |
|
leadId |
Identifier of the lead based on which the entity is created. Default is |
|
storageTypeId |
Identifier of the storage type. Possible values:
Default:
|
|
storageElementIds |
Array of files. Default is |
|
webformId |
Identifier of the CRM Form. Default is |
|
companyId |
Identifier of the company linked to the entity. The list of companies can be obtained using the Default is |
|
contactId |
Identifier of the contact linked to the entity. The list of contacts can be obtained using the Default is |
|
contactIds |
List of identifiers of contacts linked to the entity. The list of contacts can be obtained using the Default is |
|
locationId |
Identifier of the location. Service field. Default is |
|
currencyId |
Identifier of the currency for the entity. Default is the default currency |
|
isManualOpportunity |
Mode for calculating the amount.
Default is |
|
opportunity |
Amount. Default is |
|
taxValue |
Tax amount. Default is |
|
stageId |
String identifier for the stage of the entity. For example, The list of available stages can be obtained using Default is the first available stage |
|
begindate |
Start date of the entity. Default is the creation date of the entity |
|
closedate |
End date of the entity. Default is the creation date of the entity + 7 days |
|
actualDate |
Valid until. Default is the creation date of the entity + 7 days |
|
mycompanyId |
Identifier of my company. Default is the identifier of the first available "my" company |
|
utmSource |
Advertising system. Google Ads, Bing Ads, etc. Default is |
|
utmMedium |
Type of traffic.
Default is |
|
utmCampaign |
Identifier of the advertising campaign. Default is |
|
utmContent |
Content of the campaign. For example, for contextual ads. Default is |
|
utmTerm |
Search condition of the campaign. For example, keywords for contextual advertising. Default is |
|
ufCrm... |
Custom field. See the section Custom Fields in CRM: Overview of Methods.
|
|
parentId... |
Parent field. An element of another type of CRM object that is linked to this element. Each such field has the code |
CRM object identifier entityTypeId: 31
|
Name |
Description |
|
title |
Title of the entity. By default, it is generated using the template
For example, for an invoice with |
|
xmlId |
External code. Default is |
|
assignedById |
Identifier of the user responsible for the entity. Default is the identifier of the user calling the method |
|
opened |
Whether the entity is available to everyone. Possible values:
Default is |
|
webformId |
Identifier of the CRM Form. Default is |
|
begindate |
Start date of the entity. Default is the creation date of the entity |
|
closedate |
End date of the entity. Default is the creation date of the entity + 7 days |
|
companyId |
Identifier of the company linked to the entity. The list of companies can be obtained using the Default is |
|
contactId |
Identifier of the contact linked to the entity. The list of contacts can be obtained using the Default is |
|
contactIds |
List of identifiers of contacts linked to the entity. The list of contacts can be obtained using the Default is |
|
observers |
Array of identifiers of users who will be observers in the entity. Default is |
|
stageId |
String identifier for the stage of the entity. For example, The list of available stages can be obtained using Default is the first available stage |
|
sourceId |
String identifier for the source. For example, The list of available sources can be obtained using Default is the first available source |
|
sourceDescription |
Additional information about the source. Default is |
|
currencyId |
Identifier of the currency for the entity. Default is the default currency |
|
isManualOpportunity |
Mode for calculating the amount. Possible values:
Default is |
|
opportunity |
Amount. Default is |
|
taxValue |
Tax amount. Default is |
|
mycompanyId |
Identifier of my company. Default is the identifier of the first available "my" company |
|
comments |
Comment. Default is |
|
locationId |
Identifier of the location. Service field. Default is |
|
ufCrm... |
Custom field. See the section Custom Fields in CRM: Overview of Methods.
|
|
parentId... |
Parent field. An element of another type of CRM object that is linked to this element. Each such field has the code |
CRM object identifier entityTypeId: can be obtained using the crm.type.list method or created using the crm.type.add method.
|
Name |
Description |
|
title |
Title of the entity. By default, it is generated using the template
For example, for the smart process "HR" with |
|
xmlId |
External code. Default is |
|
assignedById |
Identifier of the user responsible for the entity. Default is the identifier of the user calling the method |
|
opened |
Whether the entity is available to everyone.
Default is |
|
webformId |
Identifier of the CRM Form. Default is |
|
begindate |
Start date of the entity. Available only if the Default is the creation date of the entity |
|
closedate |
End date of the entity. Available only if the Default is the creation date of the entity + 7 days |
|
companyId |
Identifier of the company linked to the entity. The list of companies can be obtained using the Available only if the Default is |
|
contactId |
Identifier of the contact linked to the entity. The list of contacts can be obtained using the Available only if the Default is |
|
contactIds |
List of identifiers of contacts linked to the entity. The list of contacts can be obtained using the Available only if the Default is |
|
observers |
Array of identifiers of users who will be observers in the entity. Available only if the Default is |
|
categoryId |
Identifier of the funnel of the smart process entity. The list of available funnels can be obtained using the |
|
stageId |
String identifier for the stage of the entity. For example, The list of available stages can be obtained using
More about funnels (directions). Available only if the Default is the first available stage relative to the funnel |
|
sourceId |
String identifier for the source. (for example, The list of available sources can be obtained using Available only if the Default is the first available source |
|
sourceDescription |
Additional information about the source. Available only if the Default is |
|
currencyId |
Identifier of the currency for the entity. Available only if the Default is the default currency |
|
isManualOpportunity |
Mode for calculating the amount. Possible values:
Available only if the Default is |
|
opportunity |
Amount. Available only if the Default is |
|
taxValue |
Tax amount. Available only if the Default is |
|
mycompanyId |
Identifier of my company. Available only if the Default is the identifier of the first available "my" company |
|
ufCrm... |
Custom field. See the section Custom Fields in CRM: Overview of Methods.
|
|
parentId... |
Parent field. An element of another type of CRM object that is linked to this element. Each such field has the code |
Smart Process Settings
You can read more about managing smart process settings in Smart Processes: Overview of Methods
Code Examples
How to Use Examples in Documentation
-
Example of creating a deal
cURL (Webhook)cURL (OAuth)JSPHPPHP (B24PhpSdk)curl -X POST \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{"entityTypeId":2,"fields":{"title":"New deal (specifically for the REST methods example)","typeId":"SERVICE","categoryId":9,"stageId":"C9:UC_KN8KFI","isReccurring":"Y","probability":50,"currencyId":"USD","isManualOpportunity":"Y","opportunity":999.99,"taxValue":99.9,"companyId":5,"contactId":4,"contactIds":[4,5],"quoteId":7,"begindate":"formatDate(monthAgo)","closedate":"formatDate(twelveDaysInAdvance)","opened":"N","comments":"commentsExample","assignedById":6,"sourceId":"WEB","sourceDescription":"There should be additional description about the source","leadId":102,"additionalInfo":"There should be additional information","observers":[2,3],"utmSource":"google","utmMedium":"CPC","ufCrm_1721244707107":1111.1,"parentId1220":2}}' \ https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.item.addcurl -X POST \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{"entityTypeId":2,"fields":{"title":"New deal (specifically for the REST methods example)","typeId":"SERVICE","categoryId":9,"stageId":"C9:UC_KN8KFI","isReccurring":"Y","probability":50,"currencyId":"USD","isManualOpportunity":"Y","opportunity":999.99,"taxValue":99.9,"companyId":5,"contactId":4,"contactIds":[4,5],"quoteId":7,"begindate":"formatDate(monthAgo)","closedate":"formatDate(twelveDaysInAdvance)","opened":"N","comments":"commentsExample","assignedById":6,"sourceId":"WEB","sourceDescription":"There should be additional description about the source","leadId":102,"additionalInfo":"There should be additional information","observers":[2,3],"utmSource":"google","utmMedium":"CPC","ufCrm_1721244707107":1111.1,"parentId1220":2},"auth":"**put_access_token_here**"}' \ https://**put_your_bitrix24_address**/rest/crm.item.addconst formatDate = (date) => { return date.toISOString().slice(0, 10); }; const day = 60 * 60 * 24 * 1000; const now = new Date(); const twelveDaysInAdvance = new Date(now.getTime() + 12 * day); const monthAgo = new Date(now.getTime() - 30 * day); const commentsExample = ` Example comment inside the deal [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] `; BX24.callMethod( 'crm.item.add', { entityTypeId: 2, fields: { title: "New deal (specifically for the REST methods example)", typeId: "SERVICE", categoryId: 9, stageId: "C9:UC_KN8KFI", isReccurring: "Y", probability: 50, currencyId: "USD", isManualOpportunity: "Y", opportunity: 999.99, taxValue: 99.9, companyId: 5, contactId: 4, contactIds: [4, 5], quoteId: 7, begindate: formatDate(monthAgo), closedate: formatDate(twelveDaysInAdvance), opened: "N", comments: commentsExample, assignedById: 6, sourceId: "WEB", sourceDescription: "There should be additional description about the source", leadId: 102, additionalInfo: "There should be additional information", observers: [2, 3], utmSource: "google", utmMedium: "CPC", ufCrm_1721244707107: 1111.1, parentId1220: 2, }, }, (result) => { result.error() ? console.error(result.error()) : console.info(result.data()) ; } );require_once('crest.php'); $result = CRest::call( 'crm.item.add', [ 'entityTypeId' => 2, 'fields' => [ 'title' => "New deal (specifically for the REST methods example)", 'typeId' => "SERVICE", 'categoryId' => 9, 'stageId' => "C9:UC_KN8KFI", 'isReccurring' => "Y", 'probability' => 50, 'currencyId' => "USD", 'isManualOpportunity' => "Y", 'opportunity' => 999.99, 'taxValue' => 99.9, 'companyId' => 5, 'contactId' => 4, 'contactIds' => [4, 5], 'quoteId' => 7, 'begindate' => formatDate(monthAgo), 'closedate' => formatDate(twelveDaysInAdvance), 'opened' => "N", 'comments' => $commentsExample, 'assignedById' => 6, 'sourceId' => "WEB", 'sourceDescription' => "There should be additional description about the source", 'leadId' => 102, 'additionalInfo' => "There should be additional information", 'observers' => [2, 3], 'utmSource' => "google", 'utmMedium' => "CPC", 'ufCrm_1721244707107' => 1111.1, 'parentId1220' => 2, ], ] ); echo '<PRE>'; print_r($result); echo '</PRE>';try { $entityTypeId = 1; // Example entity type ID $fields = [ 'title' => 'New Item', 'createdTime' => (new DateTime())->format(DateTime::ATOM), 'updatedTime' => (new DateTime())->format(DateTime::ATOM), 'begindate' => (new DateTime())->format(DateTime::ATOM), 'closedate' => (new DateTime())->format(DateTime::ATOM), // Add other necessary fields as required ]; $result = $serviceBuilder ->getCRMScope() ->item() ->add($entityTypeId, $fields); print("ID: " . $result->item()->id . PHP_EOL); print("Title: " . $result->item()->title . PHP_EOL); print("Created By: " . $result->item()->createdBy . PHP_EOL); print("Updated By: " . $result->item()->updatedBy . PHP_EOL); print("Created Time: " . $result->item()->createdTime->format(DateTime::ATOM) . PHP_EOL); print("Updated Time: " . $result->item()->updatedTime->format(DateTime::ATOM) . PHP_EOL); } catch (Throwable $e) { print("Error: " . $e->getMessage() . PHP_EOL); } -
Example of creating an SPA item with a set of custom fields
Custom fields involved in the example
{ "ufCrm44_1721812760630": { "type": "string", "isRequired": false, "isReadOnly": false, "isImmutable": false, "isMultiple": false, "isDynamic": true, "title": "Custom field (string)", "listLabel": "Custom field (string)", "formLabel": "Custom field (string)", "filterLabel": "Custom field (string)", "settings": { "SIZE": 20, "ROWS": 1, "REGEXP": "", "MIN_LENGTH": 0, "MAX_LENGTH": 0, "DEFAULT_VALUE": "" }, "upperName": "UF_CRM_44_1721812760630" }, "ufCrm44_1721812814433": { "type": "enumeration", "isRequired": false, "isReadOnly": false, "isImmutable": false, "isMultiple": false, "isDynamic": true, "items": [ { "ID": "79", "VALUE": "List item #1" }, { "ID": "80", "VALUE": "List item #2" }, { "ID": "81", "VALUE": "List item #3" }, { "ID": "82", "VALUE": "List item #4" } ], "title": "Custom field (list)", "listLabel": "Custom field (list)", "formLabel": "Custom field (list)", "filterLabel": "Custom field (list)", "settings": { "DISPLAY": "LIST", "LIST_HEIGHT": 1, "CAPTION_NO_VALUE": "", "SHOW_NO_VALUE": "Y" }, "upperName": "UF_CRM_44_1721812814433" }, "ufCrm44_1721812853419": { "type": "date", "isRequired": false, "isReadOnly": false, "isImmutable": false, "isMultiple": false, "isDynamic": true, "title": "Custom field (date)", "listLabel": "Custom field (date)", "formLabel": "Custom field (date)", "filterLabel": "Custom field (date)", "settings": { "DEFAULT_VALUE": { "TYPE": "NONE", "VALUE": "" } }, "upperName": "UF_CRM_44_1721812853419" }, "ufCrm44_1721812885588": { "type": "url", "isRequired": false, "isReadOnly": false, "isImmutable": false, "isMultiple": true, "isDynamic": true, "title": "Multiple custom field (link)", "listLabel": "Multiple custom field (link)", "formLabel": "Multiple custom field (link)", "filterLabel": "Multiple custom field (link)", "settings": { "POPUP": "Y", "SIZE": 20, "MIN_LENGTH": 0, "MAX_LENGTH": 0, "DEFAULT_VALUE": "", "ROWS": 1 }, "upperName": "UF_CRM_44_1721812885588" }, "ufCrm44_1721812898903": { "type": "file", "isRequired": false, "isReadOnly": false, "isImmutable": false, "isMultiple": false, "isDynamic": true, "title": "Custom field (file)", "listLabel": "Custom field (file)", "formLabel": "Custom field (file)", "filterLabel": "Custom field (file)", "settings": { "SIZE": 20, "LIST_WIDTH": 0, "LIST_HEIGHT": 0, "MAX_SHOW_SIZE": 0, "MAX_ALLOWED_SIZE": 0, "EXTENSIONS": [], "TARGET_BLANK": "Y" }, "upperName": "UF_CRM_44_1721812898903" }, "ufCrm44_1721812915476": { "type": "money", "isRequired": false, "isReadOnly": false, "isImmutable": false, "isMultiple": false, "isDynamic": true, "title": "Custom field (money)", "listLabel": "Custom field (money)", "formLabel": "Custom field (money)", "filterLabel": "Custom field (money)", "settings": { "DEFAULT_VALUE": "" }, "upperName": "UF_CRM_44_1721812915476" }, "ufCrm44_1721812935209": { "type": "boolean", "isRequired": false, "isReadOnly": false, "isImmutable": false, "isMultiple": false, "isDynamic": true, "title": "Custom field (Yes/No)", "listLabel": "Custom field (Yes/No)", "formLabel": "Custom field (Yes/No)", "filterLabel": "Custom field (Yes/No)", "settings": { "DEFAULT_VALUE": 0, "DISPLAY": "CHECKBOX", "LABEL": [ "", "" ], "LABEL_CHECKBOX": { "en": "Custom field (Yes/No)", "de": "Custom field (Yes/No)", "th": "Custom field (Yes/No)", "la": "Custom field (Yes/No)", "tc": "Custom field (Yes/No)", "sc": "Custom field (Yes/No)", "br": "Custom field (Yes/No)", "ar": "Custom field (Yes/No)", "fr": "Custom field (Yes/No)", "vn": "Custom field (Yes/No)", "pl": "Custom field (Yes/No)", "tr": "Custom field (Yes/No)", "ja": "Custom field (Yes/No)", "it": "Custom field (Yes/No)", "ms": "Custom field (Yes/No)", "id": "Custom field (Yes/No)" } }, "upperName": "UF_CRM_44_1721812935209" }, "ufCrm44_1721812948498": { "type": "double", "isRequired": false, "isReadOnly": false, "isImmutable": false, "isMultiple": false, "isDynamic": true, "title": "Custom field (number)", "listLabel": "Custom field (number)", "formLabel": "Custom field (number)", "filterLabel": "Custom field (number)", "settings": { "PRECISION": 2, "SIZE": 20, "MIN_VALUE": 0, "MAX_VALUE": 0, "DEFAULT_VALUE": null }, "upperName": "UF_CRM_44_1721812948498" } }cURL (Webhook)cURL (OAuth)JSPHPcurl -X POST \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{ "entityTypeId": 1302, "fields": { "ufCrm44_1721812760630": "String for custom field of type String", "ufCrm44_1721812814433": 81, "ufCrm44_1721812853419": "'"$(date '+%Y-%m-%d')"'", "ufCrm44_1721812885588": [ "example.com", "second-example.com" ], "ufCrm44_1721812898903": [ "green_pixel.png", "iVBORw0KGgoAAAANSUhEUgAAAIAAAAAMCAYAAACqTLVoAAAALklEQVR42u3SAQEAAAQDsEsuOj3YMqwy6fBWCSCAAAIgAAIgAAIgAAIgAAJw3QLOrRH1U/gU4gAAAABJRU5ErkJggg==" ], "ufCrm44_1721812915476": "300|USD", "ufCrm44_1721812935209": "Y", "ufCrm44_1721812948498": 9999.9 } }' \ https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.item.addcurl -X POST \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{ "entityTypeId": 1302, "fields": { "ufCrm44_1721812760630": "String for custom field of type String", "ufCrm44_1721812814433": 81, "ufCrm44_1721812853419": "'"$(date '+%Y-%m-%d')"'", "ufCrm44_1721812885588": [ "example.com", "second-example.com" ], "ufCrm44_1721812898903": [ "green_pixel.png", "iVBORw0KGgoAAAANSUhEUgAAAIAAAAAMCAYAAACqTLVoAAAALklEQVR42u3SAQEAAAQDsEsuOj3YMqwy6fBWCSCAAAIgAAIgAAIgAAIgAAJw3QLOrRH1U/gU4gAAAABJRU5ErkJggg==" ], "ufCrm44_1721812915476": "300|USD", "ufCrm44_1721812935209": "Y", "ufCrm44_1721812948498": 9999.9 }, "auth": "**put_access_token_here**" }' \ https://**put_your_bitrix24_address**/rest/crm.item.addconst greenPixelInBase64 = "iVBORw0KGgoAAAANSUhEUgAAAIAAAAAMCAYAAACqTLVoAAAALklEQVR42u3SAQEAAAQDsEsuOj3YMqwy6fBWCSCAAAIgAAIgAAIgAAIgAAJw3QLOrRH1U/gU4gAAAABJRU5ErkJggg=="; BX24.callMethod( 'crm.item.add', { entityTypeId: 1302, fields: { ufCrm44_1721812760630: "String for custom field of type String", ufCrm44_1721812814433: 81, ufCrm44_1721812853419: (new Date()).toISOString().slice(0, 10), ufCrm44_1721812885588: [ "example.com", "second-example.com", ], ufCrm44_1721812898903: [ "green_pixel.png", greenPixelInBase64, ], ufCrm44_1721812915476: "300|USD", ufCrm44_1721812935209: "Y", ufCrm44_1721812948498: 9999.9, }, }, (result) => { result.error() ? console.error(result.error()) : console.info(result.data()) ; } );require_once('crest.php'); $result = CRest::call( 'crm.item.add', [ 'entityTypeId' => 1302, 'fields' => [ 'ufCrm44_1721812760630' => "String for custom field of type String", 'ufCrm44_1721812814433' => 81, 'ufCrm44_1721812853419' => date('Y-m-d'), 'ufCrm44_1721812885588' => [ "example.com", "second-example.com", ], 'ufCrm44_1721812898903' => [ "green_pixel.png", "iVBORw0KGgoAAAANSUhEUgAAAIAAAAAMCAYAAACqTLVoAAAALklEQVR42u3SAQEAAAQDsEsuOj3YMqwy6fBWCSCAAAIgAAIgAAIgAAIgAAJw3QLOrRH1U/gU4gAAAABJRU5ErkJggg==", ], 'ufCrm44_1721812915476' => "300|USD", 'ufCrm44_1721812935209' => "Y", 'ufCrm44_1721812948498' => 9999.9, ], ] ); echo '<PRE>'; print_r($result); echo '</PRE>';
Response Handling
HTTP Status: 200
Note
Disabled fields always return null.
{
"result": {
"item": {
"id": 342,
"createdTime": "2024-07-18T14:00:14+02:00",
"dateCreateShort": null,
"updatedTime": "2024-07-18T14:00:14+02:00",
"dateModifyShort": null,
"createdBy": 1,
"updatedBy": 1,
"assignedById": 6,
"opened": "N",
"leadId": 102,
"companyId": 5,
"contactId": 4,
"quoteId": 7,
"title": "New deal (specifically for the REST methods example)",
"productId": null,
"categoryId": 9,
"stageId": "C9:UC_KN8KFI",
"stageSemanticId": "P",
"isNew": "N",
"isRecurring": "N",
"isReturnCustomer": "N",
"isRepeatedApproach": "Y",
"closed": "N",
"typeId": "SERVICE",
"opportunity": 999.99,
"isManualOpportunity": "Y",
"taxValue": 0,
"currencyId": "USD",
"probability": 50,
"comments": "\nExample comment inside the deal\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",
"begindate": "2024-06-18T02:00:00+02:00",
"begindateShort": null,
"closedate": "2024-07-30T02:00:00+02:00",
"closedateShort": null,
"eventDate": null,
"eventDateShort": null,
"eventId": null,
"eventDescription": null,
"locationId": null,
"webformId": null,
"sourceId": "WEB",
"sourceDescription": "There should be additional description about the source",
"originatorId": null,
"originId": null,
"additionalInfo": "There should be additional information",
"searchContent": null,
"orderStage": null,
"movedBy": 1,
"movedTime": "2024-07-18T14:00:14+02:00",
"lastActivityBy": 1,
"lastActivityTime": "2024-07-18T14:00:14+02:00",
"isWork": null,
"isWon": null,
"isLose": null,
"receivedAmount": null,
"lostAmount": null,
"hasProducts": null,
"ufCrm_1721244707107": 1111.1,
"parentId1220": 2,
"utmSource": "google",
"utmMedium": "CPC",
"utmCampaign": null,
"utmContent": null,
"utmTerm": null,
"observers": [
2,
3
],
"contactIds": [
4,
5
],
"entityTypeId": 2
}
},
"time": {
"start": 1721304013.245896,
"finish": 1721304015.555471,
"duration": 2.309574842453003,
"processing": 1.8328988552093506,
"date_start": "2024-07-18T14:00:13+02:00",
"date_finish": "2024-07-18T14:00:15+02:00",
"operating": 1.8328571319580078
}
}
By default, custom field names are passed and returned in camelCase, for example ufCrm2_1639669411830.
When passing the parameter useOriginalUfNames with the value Y, custom fields will be returned with their original names, for example UF_CRM_2_1639669411830.
Returned Data
|
Name |
Description |
|
result |
Root element of the response, contains a single key |
|
item |
Information about the created item, field description |
|
time |
Information about the request execution time |
Error Handling
HTTP Status: 400, 403
{
"error": "NOT_FOUND",
"error_description": "Smart process 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 Error Codes
|
Status |
Code |
Description |
Value |
|
|
|
Action allowed only for intranet users |
User is not an intranet user |
|
|
|
Smart process not found |
Occurs when an invalid |
|
|
|
Access denied |
User does not have permission to add items of type |
|
|
|
Invalid value for field " |
Incorrect value passed for field |
|
|
|
Expected iterable value for multiple field, but got |
One of the multiple fields received a value of type |
|
|
|
You cannot create a new item due to your plan restrictions |
Plan restrictions do not allow creating SPA items |
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 CRM Item
- Get Element by Id crm.item.get
- Get a List of CRM Items: crm.item.list
- Delete CRM Item: crm.item.delete
- Retrieve Fields of CRM Item
- CRM Object Fields
- How to Create a Vendor in CRM