Create CRM Status Element crm.status.add

Scope: crm

Who can execute the method: user with CRM administrator rights

The method crm.status.add creates a new element in the specified CRM directory: deal stage, source, company type, and others.

Method Parameters

Required parameters are marked with *

Name
type

Description

fields*
object

Object with fields of the new directory element. The list of available fields is described below

Parameter fields

Name
type

Description

ENTITY_ID*
string

Type of directory, for example DEAL_STAGE, SOURCE. You can get the list of types using the method crm.status.entity.types

STATUS_ID*
string

Status value code. The code must be unique within the directory. Length and character restrictions depend on the type of directory

NAME*
string

Name

SORT
integer

Sorting. Default is 10

COLOR
string

Hex color code, for example #39A8EF. Use for status stages

SEMANTICS
string

Group of stages:

  • "S" — "Success",
  • "F" — "Failure",
  • "" — "In Progress".

Use for status stages. Default is "In Progress" group

Field Features

Restrictions for STATUS_ID

Follow the length and character restrictions for different types of directories:

  • STATUS lead stages. Max length: 21, can contain only Latin letters, numbers, hyphens, and underscores.
  • QUOTE_STATUS estimate stages. Max length: 22, can contain only Latin letters, numbers, hyphens, and underscores.
  • DEAL_STAGE deal stages. Max length: 22, can contain only Latin letters, numbers, hyphens, and underscores.
  • DEAL_STAGE_xx deal stages in non-default funnels. xx — funnel identifier. Max length depends on the funnel identifier. Can contain only Latin letters, numbers, hyphens, and underscores.
  • For other ENTITY_ID, the maximum length of STATUS_ID is 50 characters and can contain any characters.

If a stage is added for a custom deal funnel, the status identifier will automatically have the funnel prefix added. This is necessary to identify the funnel by the stage identifier.

For example, the value DECISION for a deal funnel with identifier 1 will be saved as C1:DECISION. The system will automatically add the prefix C1: corresponding to the deal funnel identifier.
If a value is passed to the field with the prefix C1:DECISION, it will be saved as C1:DECISION, and no additional prefix will be added.

For SPAs with funnels, a similar logic for forming STATUS_ID from the value and prefix applies. The funnel prefix can be obtained using the method crm.status.entity.types.

Restrictions for SORT

For the correct operation of status stages, the sorting must follow this order:

  1. Stages of the "In Progress" group
  2. Stage of the "Success" group
  3. Stages of the "Failure" group

Code Examples

How to Use Examples in Documentation

curl -X POST \
             -H "Content-Type: application/json" \
             -H "Accept: application/json" \
             -d '{"fields":{"ENTITY_ID":"DEAL_STAGE_1","STATUS_ID":"DECISION","NAME":"Decision Making","SORT":70,"COLOR":"#FFA900"}}' \
             https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.status.add
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"fields":{"ENTITY_ID":"DEAL_STAGE_1","STATUS_ID":"DECISION","NAME":"Decision Making","SORT":70,"COLOR":"#FFA900"},"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/crm.status.add
        
try
        {
        	const response = await $b24.callMethod(
        		'crm.status.add',
        		{
        			fields: {
        				ENTITY_ID: 'DEAL_STAGE_1',
        				STATUS_ID: 'DECISION',
        				NAME: 'Decision Making',
        				SORT: 70,
        				COLOR: '#FFA900'
        			}
        		}
        	);
        	
        	const result = response.getData().result;
        	if (result.error())
        		console.error(result.error());
        	else
        		console.dir(result);
        }
        catch( error )
        {
        	console.error('Error:', error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'crm.status.add',
                    [
                        'fields' => [
                            'ENTITY_ID' => 'DEAL_STAGE_1',
                            'STATUS_ID' => 'DECISION',
                            'NAME'     => 'Decision Making',
                            'SORT'     => 70,
                            'COLOR'    => '#FFA900',
                        ],
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            if ($result->error()) {
                error_log($result->error());
                echo 'Error: ' . $result->error();
            } else {
                echo 'Success: ' . print_r($result->data(), true);
            }
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error adding status: ' . $e->getMessage();
        }
        
BX24.callMethod(
            "crm.status.add",
            {
                fields: {
                    ENTITY_ID: "DEAL_STAGE_1",
                    STATUS_ID: "DECISION",
                    NAME: "Decision Making",
                    SORT: 70,
                    COLOR: "#FFA900"
                }
            },
            function(result) {
                if(result.error())
                    console.error(result.error());
                else
                    console.dir(result.data());
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'crm.status.add',
            [
                'fields' => [
                    'ENTITY_ID' => 'DEAL_STAGE_1',
                    'STATUS_ID' => 'DECISION',
                    'NAME' => 'Decision Making',
                    'SORT' => 70,
                    'COLOR' => '#FFA900'
                ]
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        

Response Handling

HTTP status: 200

{
            "result": 773,
            "time": {
                "start": 1752215174.862923,
                "finish": 1752215174.916697,
                "duration": 0.053774118423461914,
                "processing": 0.014070987701416016,
                "date_start": "2025-07-11T09:26:14+02:00",
                "date_finish": "2025-07-11T09:26:14+02:00",
                "operating_reset_at": 1752215774,
                "operating": 0
            }
        }
        

Returned Data

Name
type

Description

result
integer

Identifier of the created directory element

time
time

Information about the request execution time

Error Handling

HTTP status: 400

{
            "error": "Invalid parameters.",
            "error_description": "Invalid parameters were provided."
        }
        

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

400

Access denied.

No rights to perform the operation

400

Invalid parameters.

Invalid parameters were provided

400

Specified entity type is not supported.

An unsupported directory type was specified

400

The field ENTITY_ID is required.

ENTITY_ID is not specified

400

The field STATUS_ID is required.

STATUS_ID is not specified

400

Duplicate STATUS_ID.

Such STATUS_ID already exists

400

Error on creating status.

Error creating the element

400

Cannot create an intermediate stage after success

400

The required field "Title" is not filled

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