Import One Record crm.item.import
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 "import" access permission for the CRM object
A universal method for importing objects into the CRM.
You can read about the differences between the import logic and the standard addition of items in the article Data Import into CRM: Overview of Methods.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
entityTypeId* |
Identifier of the system or custom type for which the entity needs to be created. Numerical values for system types (Lead — 1, Deal — 2, Contact — 3, Company — 4, Invoice — 31, etc.) are provided in the CRM object types reference. The identifier for the SPA can be obtained using the crm.type.list method. |
|
fields* |
An object in the following format:
For multi-fields, such as
Each CRM object 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 type of object is described below. An incorrect field in You can also find out the set of fields using the universal method crm.item.fields or methods for specific CRM objects: |
|
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 |
Name of the entity. By default, it is generated using the template
For example, for a lead with |
|
honorific |
String identifier for the lead's salutation (e.g., The list of available salutations can be obtained using By default — |
|
name |
First name. By default — |
|
secondName |
Middle name. By default — |
|
lastName |
Last name. By default — |
|
birthdate |
Date of birth. By default — |
|
companyTitle |
Company name. By default — |
|
sourceId |
String identifier for the source. For example, The list of available sources can be obtained using By default, it takes the value of the first available source |
|
sourceDescription |
Additional information about the source. By default — |
|
stageId |
String identifier for the stage of the element. For example, The list of available stages can be obtained using By default, it takes the value of the first available stage |
|
statusDescription |
Additional information about the stage. By default — |
|
post |
Position. By default — |
|
currencyId |
Identifier for the currency of the element. By default, it takes the default currency |
|
isManualOpportunity |
Calculation mode for the amount. Possible values:
By default — |
|
opportunity |
Amount. By default — |
|
opened |
Is the element available to everyone? Possible values:
By default — |
|
comments |
Comment. By default — |
|
assignedById |
Identifier of the person responsible for the element. By default, this is the identifier of the user who calls the method |
|
companyId |
Identifier of the company linked to the element. The list of companies can be obtained using the By default — |
|
contactId |
Identifier of the contact linked to the element. The list of contacts can be obtained using the By default — |
|
contactIds |
List of identifiers of contacts linked to the element. The list of contacts can be obtained using the By default — |
|
originatorId |
External source. By default — |
|
originId |
Identifier of the element in the external source. By default — |
|
webformId |
Identifier of the CRM Form. By default — |
|
observers |
Array of user identifiers who will be observers of the element. By default — |
|
utmSource |
Advertising system. For example: Google-Adwords By default — |
|
utmMedium |
Type of traffic. Possible values:
By default — |
|
utmCampaign |
Identifier of the advertising campaign. By default — |
|
utmContent |
Content of the campaign. For example, for contextual ads. By default — |
|
utmTerm |
Search term for the campaign. For example, keywords for contextual advertising. By default equals |
|
ufCrm... |
User-defined field. For information on user-defined fields, see 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 user-defined field must be an array where the first element is the file name and the second is the base64 encoded content of the file. |
|
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: 2
|
Name |
Description |
|
title |
Name of the element. By default, it is generated using the template
|
|
typeId |
String identifier for the type of entity. For example, for a deal: The list of available entity types can be obtained using By default — the first available entity type |
|
categoryId |
Identifier of the direction (funnel) of the deal. By default — |
|
stageId |
String identifier for the stage of the element. For example, The list of available stages can be obtained using
By default — the first available stage relative to the funnel |
|
isRecurring |
Is the deal recurring? Possible values:
By default — |
|
probability |
Probability %. By default — |
|
currencyId |
Identifier for the currency of the element. By default — the default currency |
|
isManualOpportunity |
Calculation mode for the amount. Possible values:
By default — |
|
opportunity |
Amount. By default — |
|
taxValue |
Tax amount. By default — |
|
companyId |
Identifier of the company linked to the element. The list of companies can be obtained using the By default — |
|
contactId |
Identifier of the contact linked to the element. The list of contacts can be obtained using the By default — |
|
contactIds |
List of identifiers of contacts linked to the element. The list of contacts can be obtained using the By default — |
|
quoteId |
Identifier of the estimate that will be linked to the deal |
|
begindate |
Start date of the element. By default — creation date |
|
closedate |
End date of the element. By default — creation date + 7 days |
|
opened |
Is the element available to everyone? Possible values:
By default — |
|
comments |
Comment. By default — |
|
assignedById |
Identifier of the person responsible for the element. By default — the identifier of the user who calls the method |
|
sourceId |
String identifier for the source. For example, The list of available sources can be obtained using By default — the first available source |
|
sourceDescription |
Additional information about the source. By default — |
|
leadId |
Identifier of the lead based on which the element is created. By default — |
|
additionalInfo |
Additional information. By default — |
|
originatorId |
External source. By default — |
|
originId |
Identifier of the element in the external source. By default — |
|
observers |
Array of user identifiers who will be observers of the element. By default — |
|
locationId |
Identifier of the location. Service field. By default — |
|
utmSource |
Advertising system. For example: Google-Adwords By default — |
|
utmMedium |
Type of traffic. Possible values:
By default — |
|
utmCampaign |
Identifier of the advertising campaign. By default — |
|
utmContent |
Content of the campaign. For example, for contextual ads. By default — |
|
utmTerm |
Search term for the campaign. For example, keywords for contextual advertising. By default — |
|
ufCrm... |
User-defined 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 salutation. For example, The list of available salutations can be obtained using By default — |
|
name |
First name. By default — |
|
secondName |
Middle name. By default — |
|
lastName |
Last name. By default — |
|
photo |
Photo. By default — |
|
birthdate |
Date of birth. By default — |
|
typeId |
String identifier for the type of entity. For example, for a deal: The list of available entity types can be obtained using By default — the first available entity type |
|
sourceId |
String identifier for the source. For example, The list of available sources can be obtained using By default — the first available source |
|
sourceDescription |
Additional information about the source. By default — |
|
post |
Position. By default — |
|
comments |
Comment. By default — |
|
opened |
Is the element available to everyone? Possible values:
By default — |
|
export |
Is the contact included in the export? By default — |
|
assignedById |
Identifier of the person responsible for the element. By default — the identifier of the user who calls the method |
|
companyId |
Identifier of the company linked to the element. The list of companies can be obtained using the By default — |
|
companyIds |
Array of identifiers of companies that will be linked to the element |
|
leadId |
Identifier of the lead based on which the element is created. By default — |
|
originatorId |
External source. By default — |
|
originId |
Identifier of the element in the external source. By default — |
|
originVersion |
Version of the original. By default — |
|
observers |
Array of user identifiers who will be observers of the element. By default — |
|
utmSource |
Advertising system. For example: Google-Adwords By default — |
|
utmMedium |
Type of traffic. Possible values:
By default — |
|
utmCampaign |
Identifier of the advertising campaign. By default — |
|
utmContent |
Content of the campaign. For example, for contextual ads. By default — |
|
utmTerm |
Search term for the campaign. For example, keywords for contextual advertising. By default — |
|
ufCrm... |
User-defined 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: 4
|
Name |
Description |
|
title |
Name of the element. By default, it is generated using the template
For example, for a company with |
|
typeId |
String identifier for the type of entity. For example, for a deal: The list of available entity types can be obtained using By default — the first available entity type |
|
logo |
Logo. By default — |
|
bankingDetails |
Banking details. By default — |
|
industry |
String identifier for the type of industry. For example, The list of available industry types can be obtained using the By default — 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 By default — the first available employee count type |
|
currencyId |
Identifier for the currency of the element. By default — the default currency |
|
revenue |
Annual revenue. By default — |
|
opened |
Is the element available to everyone? Possible values:
By default — |
|
comments |
Comment. By default — |
|
isMyCompany |
Is the company my company? By default — |
|
assignedById |
Identifier of the person responsible for the element. By default — the identifier of the user who calls the method |
|
contactIds |
List of identifiers of contacts linked to the element. The list of contacts can be obtained using the By default — |
|
leadId |
Identifier of the lead based on which the element is created. By default — |
|
originatorId |
External source. By default — |
|
originId |
Identifier of the element in the external source. By default — |
|
originVersion |
Version of the original. By default — |
|
observers |
Array of user identifiers who will be observers of the element. By default — |
|
utmSource |
Advertising system. For example: Google-Adwords By default — |
|
utmMedium |
Type of traffic. Possible values:
By default — |
|
utmCampaign |
Identifier of the advertising campaign. By default — |
|
utmContent |
Content of the campaign. For example, for contextual ads. By default — |
|
utmTerm |
Search term for the campaign. For example, keywords for contextual advertising. By default — |
|
ufCrm... |
User-defined 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: 7
|
Name |
Description |
|
title |
Name of the element. By default, it is generated using the template
For example, for an estimate with |
|
assignedById |
Identifier of the person responsible for the element. By default — the identifier of the user who calls the method |
|
opened |
Is the element available to everyone? Possible values:
By default — |
|
content |
Content. By default — |
|
terms |
Terms. By default — |
|
comments |
Comment. By default — |
|
dealId |
Identifier of the linked deal. By default — |
|
leadId |
Identifier of the lead based on which the element is created. By default — |
|
storageTypeId |
Identifier of the storage type. Possible values:
By default:
|
|
storageElementIds |
Array of files. By default — |
|
webformId |
Identifier of the CRM Form. By default — |
|
companyId |
Identifier of the company linked to the element. The list of companies can be obtained using the By default — |
|
contactId |
Identifier of the contact linked to the element. The list of contacts can be obtained using the By default — |
|
contactIds |
List of identifiers of contacts linked to the element. The list of contacts can be obtained using the By default — |
|
locationId |
Identifier of the location. Service field. By default — |
|
currencyId |
Identifier for the currency of the element. By default — the default currency |
|
isManualOpportunity |
Calculation mode for the amount.
By default — |
|
opportunity |
Amount. By default — |
|
taxValue |
Tax amount. By default — |
|
stageId |
String identifier for the stage of the element. For example, The list of available stages can be obtained using By default — the first available stage |
|
begindate |
Start date of the element. By default — creation date of the element |
|
closedate |
End date of the element. By default — creation date + 7 days |
|
actualDate |
Valid until. By default — creation date + 7 days |
|
mycompanyId |
Identifier of my company. By default — identifier of the first available "my" company |
|
utmSource |
Advertising system. For example: Google-Adwords By default — |
|
utmMedium |
Type of traffic.
By default — |
|
utmCampaign |
Identifier of the advertising campaign. By default — |
|
utmContent |
Content of the campaign. For example, for contextual ads. By default — |
|
utmTerm |
Search term for the campaign. For example, keywords for contextual advertising. By default — |
|
ufCrm... |
User-defined 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 |
Name of the element. By default, it is generated using the template
For example, for an invoice with |
|
xmlId |
External code. By default — |
|
assignedById |
Identifier of the person responsible for the element. By default — the identifier of the user who calls the method |
|
opened |
Is the element available to everyone? Possible values:
By default — |
|
webformId |
Identifier of the CRM Form. By default — |
|
begindate |
Start date of the element. By default — creation date |
|
closedate |
End date of the element. By default — creation date + 7 days |
|
companyId |
Identifier of the company linked to the element. The list of companies can be obtained using the By default — |
|
contactId |
Identifier of the contact linked to the element. The list of contacts can be obtained using the By default — |
|
contactIds |
List of identifiers of contacts linked to the element. The list of contacts can be obtained using the By default — |
|
observers |
Array of user identifiers who will be observers of the element. By default — |
|
stageId |
String identifier for the stage of the element. For example, The list of available stages can be obtained using By default — the first available stage |
|
sourceId |
String identifier for the source. For example, The list of available sources can be obtained using By default — the first available source |
|
sourceDescription |
Additional information about the source. By default — |
|
currencyId |
Identifier for the currency of the element. By default — the default currency |
|
isManualOpportunity |
Calculation mode for the amount. Possible values:
By default — |
|
opportunity |
Amount. By default — |
|
taxValue |
Tax amount. By default — |
|
mycompanyId |
Identifier of my company. By default — identifier of the first available "my" company |
|
comments |
Comment. By default — |
|
locationId |
Identifier of the location. Service field. By default — |
|
ufCrm... |
User-defined 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 |
Name of the element. By default, it is generated using the template
For example, for the SPA element "HR" with |
|
xmlId |
External code. By default — |
|
assignedById |
Identifier of the person responsible for the element. By default — the identifier of the user who calls the method |
|
opened |
Is the element available to everyone?
By default — |
|
webformId |
Identifier of the CRM Form. By default — |
|
begindate |
Start date of the element. Available only if the By default — creation date of the element |
|
closedate |
End date of the element. Available only if the By default — creation date + 7 days |
|
companyId |
Identifier of the company linked to the element. The list of companies can be obtained using the Available only if the By default — |
|
contactId |
Identifier of the contact linked to the element. The list of contacts can be obtained using the Available only if the By default — |
|
contactIds |
List of identifiers of contacts linked to the element. The list of contacts can be obtained using the Available only if the By default — |
|
observers |
Array of user identifiers who will be observers of the element. Available only if the By default — |
|
categoryId |
Identifier of the funnel of the SPA element. The list of available funnels can be obtained using |
|
stageId |
String identifier for the stage of the element. For example, The list of available stages can be obtained using
Learn more about funnels (directions). Available only if the By default — the first available stage relative to the funnel |
|
sourceId |
String identifier for the source. (e.g., The list of available sources can be obtained using Available only if the By default — the first available source |
|
sourceDescription |
Additional information about the source. Available only if the By default — |
|
currencyId |
Identifier for the currency of the element. Available only if the By default — the default currency |
|
isManualOpportunity |
Calculation mode for the amount. Possible values:
Available only if the By default — |
|
opportunity |
Amount. Available only if the By default — |
|
taxValue |
Tax amount. Available only if the By default — |
|
mycompanyId |
Identifier of my company. Available only if the By default — Identifier of the first available "my" company |
|
ufCrm... |
User-defined 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 |
SPA Settings
For more information on managing SPA settings, you can read in Smart Processes: Overview of Methods and Events
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 base64 encoded content of the file.
Code Examples
How to Use Examples in Documentation
-
How to Import a Deal
cURL (Webhook)cURL (OAuth)PythonBX24.jsPHP CRestcurl -X POST \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{"entityTypeId":2,"fields":{"title":"New deal (specifically for REST method examples)","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 an 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.importcurl -X POST \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{"entityTypeId":2,"fields":{"title":"New deal (specifically for REST method examples)","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 an 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.importfrom b24pysdk.errors import BitrixAPIError, BitrixSDKException try: bitrix_response = client.crm.item.import_( entity_type_id=2, fields={ "title": "New deal (specifically for REST method examples)", "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 an 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, }, ).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}")const 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 within 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.import', { entityTypeId: 2, fields: { title: "New deal (specifically for REST method examples)", 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 an 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.import', [ 'entityTypeId' => 2, 'fields' => [ 'title' => "New deal (specifically for REST method examples)", '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 an 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>'; -
How to Create 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)", "ru": "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)BX24.jsPythonPHP CRestcurl -X POST \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{ "entityTypeId": 1302, "fields": { "ufCrm44_1721812760630": "String for a string-type custom field", "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.importcurl -X POST \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{ "entityTypeId": 1302, "fields": { "ufCrm44_1721812760630": "String for a string-type custom field", "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.importconst greenPixelInBase64 = "iVBORw0KGgoAAAANSUhEUgAAAIAAAAAMCAYAAACqTLVoAAAALklEQVR42u3SAQEAAAQDsEsuOj3YMqwy6fBWCSCAAAIgAAIgAAIgAAIgAAJw3QLOrRH1U/gU4gAAAABJRU5ErkJggg=="; BX24.callMethod( 'crm.item.import', { entityTypeId: 1302, fields: { ufCrm44_1721812760630: "String for a string-type custom field", ufCrm44_1721812814433: 81, ufCrm44_1721812853419: (new Date()).toISOString().slice(0, 10), ufCrm44_1721812885588: [ "example.com", "second-example.com", ], ufCrm44_1721812898903: [ "green_pixel.png", greenpixelBase64, ], ufCrm44_1721812915476: "300|USD", ufCrm44_1721812935209: "Y", ufCrm44_1721812948498: 9999.9, }, }, (result) => { result.error() ? console.error(result.error()) : console.info(result.data()) ; } );from b24pysdk.errors import BitrixAPIError, BitrixSDKException try: bitrix_response = client.crm.item.import_( entity_type_id=1302, fields={ "ufCrm44_1721812760630": "String for a string-type custom field", "ufCrm44_1721812814433": 81, "ufCrm44_1721812853419": "2024-08-21", "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, }, ).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}")require_once('crest.php'); $result = CRest::call( 'crm.item.import', [ 'entityTypeId' => 1302, 'fields' => [ 'ufCrm44_1721812760630' => "String for a string-type custom field", '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
The method will return an item array with the identifier of the created item in case of success, or an error message.
HTTP status: 200
{
"result": {
"item": {
"id": 4
}
},
"time": {
"start": 1722940215.145257,
"finish": 1722940217.94124,
"duration": 2.795983076095581,
"processing": 2.4315829277038574,
"date_start": "2024-08-06T10:30:15+00:00",
"date_finish": "2024-08-06T10:30:17+00:00",
"operating": 2.4314892292022705
}
}
Returned Data
|
Name |
Description |
|
result |
The root element of the response. Contains a single key — |
|
item |
Information about the created element. Contains a single key — |
|
id |
Identifier of the created entity |
|
time |
Information about the request execution time |
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.
Error Handling
HTTP status: 401, 400, 403
{
"error": "NOT_FOUND",
"error_description": "Smart process 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 Error Codes
|
Status |
Code |
Description |
Value |
|
|
|
SPA not found |
Occurs when an invalid |
|
|
|
Access denied |
User does not have permission to add items of type |
|
|
|
Invalid value for field " |
An incorrect value for the field For system fields of type |
|
|
|
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 |
|
|
|
Invalid authorization data for the request |
Incorrect |
|
|
|
This action is allowed only for intranet users |
User is not an intranet user |
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 |