Create a New Company crm.company.add

Scope: crm

Who can execute the method: a user with the "Add|Import" access permission for companies

Method Development Stopped

The method crm.company.add continues to function, but there is a more relevant alternative crm.item.add.

The method crm.company.add creates a new company.

Method Parameters

Required parameters are marked with *

Name
type

Description

fields*
object

Object format:

{
            field_1: value_1,
            field_2: value_2,
            ...,
            field_n: value_n,
        }
        

where:

  • field_n — field name
  • value_n — field value

The list of available fields is described in the method crm.company.fields.

An incorrect field in fields will be ignored.

To find out the list of required fields, execute the method crm.company.fields.

params
object

An object containing a set of additional parameters:

  • REGISTER_SONET_EVENT — register the event of adding a company and send a notification to the responsible person
  • IMPORT — import mode. Possible values:
    • Y — yes
    • N — no

Parameter fields

Name
type

Description

TITLE
string

Company name

COMPANY_TYPE
crm_status

Company type.

The list of available types can be obtained using the method crm.status.list with the filter { ENTITY_ID: "COMPANY_TYPE" }.

Default — the first available company type

INDUSTRY
crm_status

Industry.

The list of available values can be obtained using the method crm.status.list with the filter { ENTITY_ID: "INDUSTRY" }.

Default — the first available industry

EMPLOYEES
crm_status

Number of employees.

The list of available values can be obtained using the method crm.status.list with the filter { ENTITY_ID: "EMPLOYEES" }.

Default — the first available value

CURRENCY_ID
crm_currency

Currency.

The list of available currencies can be obtained using the method crm.currency.list

REVENUE
double

Annual revenue

LOGO
file

Company logo

OPENED
char

Is the company available to everyone? Possible values:

  • Y — yes
  • N — no

Default Y. The default value can be changed in the CRM settings

ASSIGNED_BY_ID
user

Identifier of the user responsible for the element.

Default — the identifier of the user calling the method

COMMENTS
string

Comment

PHONE
crm_multifield[]

Phone

EMAIL
crm_multifield[]

E-mail

WEB
crm_multifield[]

Website

IM
crm_multifield[]

Messenger

UTM_SOURCE
string

Advertising system, e.g., Google Ads

UTM_MEDIUM
string

Traffic type. Possible values:

  • CPC — ads
  • CPM — banners

UTM_CAMPAIGN
string

Advertising campaign designation

UTM_CONTENT
string

Campaign content. For example, for contextual ads

UTM_TERM
string

Campaign search condition. For example, keywords for contextual advertising

IS_MY_COMPANY
char

Is the company "my company"? Possible values:

  • Y — yes
  • N — no

UF_...

Custom fields. For example, UF_CRM_25534736.

Depending on the account settings, companies may have a set of custom fields of specific types.

You can add a custom field to a company using the method crm.company.userfield.add

PARENT_ID_...

Relationship fields.

If there are SPAs related to companies on the account, there is a field for each such SPA that stores the relationship between that SPA and the company. The field itself stores the identifier of the element of that SPA

Fields for connections with external data sources

If the company is created by an external system, then:

  • the field ORIGINATOR_ID stores the string identifier of that system
  • the field ORIGIN_ID stores the string identifier of the company in that external system
  • the field ORIGIN_VERSION stores the version of the company's data in that external system

Name
type

Description

ORIGINATOR_ID
string

Identifier of the external system that is the source of data about this company

ORIGIN_ID
string

Identifier of the company in the external system

ORIGIN_VERSION
string

Version of the data in the external system. Used to protect data from accidental overwriting

Import

These fields are available for filling when the parameter IMPORT = 'Y' is passed in the params parameter.

Name
type

Description

DATE_CREATE
datetime

Creation date

DATE_MODIFY
datetime

Modification date

CREATED_BY_ID
user

Created by

MODIFY_BY_ID
user

Modified by

To add the company's address and banking details, use the methods requisites.

Examples

How to Use Examples in Documentation

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"fields":{"TITLE":"LLC Smith","COMPANY_TYPE":"CUSTOMER","INDUSTRY":"MANUFACTURING","EMPLOYEES":"EMPLOYEES_2","CURRENCY_ID":"USD","REVENUE":3000000,"OPENED":"Y","ASSIGNED_BY_ID":1,"PHONE":[{"VALUE":"555888","VALUE_TYPE":"WORK"}]},"params":{"REGISTER_SONET_EVENT":"Y"}}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.company.add
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"fields":{"TITLE":"LLC Smith","COMPANY_TYPE":"CUSTOMER","INDUSTRY":"MANUFACTURING","EMPLOYEES":"EMPLOYEES_2","CURRENCY_ID":"USD","REVENUE":3000000,"OPENED":"Y","ASSIGNED_BY_ID":1,"PHONE":[{"VALUE":"555888","VALUE_TYPE":"WORK"}]},"params":{"REGISTER_SONET_EVENT":"Y"},"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/crm.company.add
        
try
        {
        	const response = await $b24.callMethod(
        		"crm.company.add",
        		{
        			fields:
        			{
        				"TITLE": "LLC Smith",
        				"COMPANY_TYPE": "CUSTOMER",
        				"INDUSTRY": "MANUFACTURING",
        				"EMPLOYEES": "EMPLOYEES_2",
        				"CURRENCY_ID": "USD",
        				"REVENUE" : 3000000,
        				"LOGO": { "fileData": document.getElementById('logo') },
        				"OPENED": "Y",
        				"ASSIGNED_BY_ID": 1,
        				"PHONE": [ { "VALUE": "555888", "VALUE_TYPE": "WORK" } ]     
        			},
        			params: { "REGISTER_SONET_EVENT": "Y" }        
        		}
        	);
        	
        	const result = response.getData().result;
        	console.info("Company created with ID " + result);
        }
        catch( error )
        {
        	console.error(error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'crm.company.add',
                    [
                        'fields' => [
                            'TITLE'         => 'LLC Smith',
                            'COMPANY_TYPE'  => 'CUSTOMER',
                            'INDUSTRY'      => 'MANUFACTURING',
                            'EMPLOYEES'     => 'EMPLOYEES_2',
                            'CURRENCY_ID'   => 'USD',
                            'REVENUE'       => 3000000,
                            'LOGO'          => ['fileData' => $_POST['logo']],
                            'OPENED'        => 'Y',
                            'ASSIGNED_BY_ID' => 1,
                            'PHONE'         => [['VALUE' => '555888', 'VALUE_TYPE' => 'WORK']],
                        ],
                        'params' => ['REGISTER_SONET_EVENT' => 'Y'],
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Company created with ID ' . $result;
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error creating company: ' . $e->getMessage();
        }
        
BX24.callMethod(
            "crm.company.add",
            {
                fields:
                {
                    "TITLE": "LLC Smith",
                    "COMPANY_TYPE": "CUSTOMER",
                    "INDUSTRY": "MANUFACTURING",
                    "EMPLOYEES": "EMPLOYEES_2",
                    "CURRENCY_ID": "USD",
                    "REVENUE" : 3000000,
                    "LOGO": { "fileData": document.getElementById('logo') },
                    "OPENED": "Y",
                    "ASSIGNED_BY_ID": 1,
                    "PHONE": [ { "VALUE": "555888", "VALUE_TYPE": "WORK" } ]     
                },
                params: { "REGISTER_SONET_EVENT": "Y" }        
            },
            function(result)
            {
                if(result.error())
                    console.error(result.error());
                else
                    console.info("Company created with ID " + result.data());
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'crm.company.add',
            [
                'fields' => [
                    'TITLE' => 'LLC Smith',
                    'COMPANY_TYPE' => 'CUSTOMER',
                    'INDUSTRY' => 'MANUFACTURING',
                    'EMPLOYEES' => 'EMPLOYEES_2',
                    'CURRENCY_ID' => 'USD',
                    'REVENUE' => 3000000,
                    'OPENED' => 'Y',
                    'ASSIGNED_BY_ID' => 1,
                    'PHONE' => [['VALUE' => '555888', 'VALUE_TYPE' => 'WORK']],
                ],
                'params' => ['REGISTER_SONET_EVENT' => 'Y'],
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        

Response Handling

HTTP Status: 200

{
            "result": 2921,
            "time": {
                "start": 1769500710,
                "finish": 1769500711.551784,
                "duration": 1.5517840385437012,
                "processing": 1,
                "date_start": "2026-01-27T10:58:30+02:00",
                "date_finish": "2026-01-27T10:58:31+02:00",
                "operating_reset_at": 1769501310,
                "operating": 0.6509370803833008
            }
        }
        

Returned Data

Name
type

Description

result
integer

Root element of the response, contains the identifier of the created company

time
time

Information about the request execution time

Error Handling

HTTP Status: 400

{
            "error": "",
            "error_description": "Parameter 'fields' must be array."
        }
        

Name
type

Description

error
string

String error code. It may consist of digits, Latin letters, and underscores

error_description
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

-

Parameter 'fields' must be array

The fields parameter is not an object

-

Parameter 'params' must be array

The params parameter is not an object

-

Access denied

The user does not have permission for "Add" or "Import" companies

-

Disk resource exhausted

ERROR_CORE

The E-mail field contains an invalid address

The E-mail field contains an invalid address

Statuses and System Error Codes

HTTP Status: 20x, 40x, 50x

The errors described below may occur when calling any method.

Status

Code
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred, please contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

An internal server error has occurred, please contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

405

ERROR_BATCH_METHOD_NOT_ALLOWED
Method is not allowed for batch usage

The current method is not allowed to be called using batch

400

ERROR_BATCH_LENGTH_EXCEEDED
Max batch length exceeded

The maximum length of parameters passed to the batch method has been exceeded

401

NO_AUTH_FOUND
Wrong authorization data

Invalid access token or webhook code

400

INVALID_REQUEST
Https required

The methods must be called using the HTTPS protocol

503

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block, to remove it you need to contact Bitrix24 technical support

403

ACCESS_DENIED
REST API is available only on commercial plans

The REST API is available only on commercial plans

403

INVALID_CREDENTIALS
Invalid request credentials

The user whose access token or webhook was used to call the method lacks permissions

404

ERROR_MANIFEST_IS_NOT_AVAILABLE
Manifest is not available

The manifest is not available

403

insufficient_scope
The request requires higher privileges than provided by the webhook token

The request requires higher privileges than those provided by the webhook token

401

expired_token
The access token provided has expired

The provided access token has expired

403

user_access_error
The user does not have access to the application

The user does not have access to the application. This means that the application is installed, but the account administrator has allowed access to this application only for specific users

500

PORTAL_DELETED
Portal was deleted

The public part of the site is closed. To open the public part of the site on an on-premise installation, disable the option "Temporary closure of the public part of the site". Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site

Continue Learning