Create CRM Status Element crm.status.add
Scope:
crmWho 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 |
Description |
|
fields* |
Object with fields of the new directory element. The list of available fields is described below |
Parameter fields
|
Name |
Description |
|
ENTITY_ID* |
Type of directory, for example |
|
STATUS_ID* |
Status value code. The code must be unique within the directory. Length and character restrictions depend on the type of directory |
|
NAME* |
Name |
|
SORT |
Sorting. Default is 10 |
|
COLOR |
Hex color code, for example |
|
SEMANTICS |
Group of stages:
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 ofSTATUS_IDis 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:
- Stages of the "In Progress" group
- Stage of the "Success" group
- 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 |
Description |
|
result |
Identifier of the created directory element |
|
time |
Information about the request execution time |
Error Handling
HTTP status: 400
{
"error": "Invalid parameters.",
"error_description": "Invalid parameters were provided."
}
|
Name |
Description |
|
error |
String error code. It may consist of digits, Latin letters, and underscores |
|
error_description |
Textual description of the error. The description is not intended to be shown to the end user in its raw form |
Possible Error Codes
|
Code |
Description |
Value |
|
|
|
No rights to perform the operation |
|
|
|
Invalid parameters were provided |
|
|
|
An unsupported directory type was specified |
|
|
|
|
|
|
|
|
|
|
|
Such |
|
|
|
Error creating the element |
|
|
|
Cannot create an intermediate stage after success |
|
|
|
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 |
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 allowed to be called using batch |
|
|
|
The maximum length of parameters passed to the batch method has been exceeded |
|
|
|
Invalid access token or webhook code |
|
|
|
The methods must be called using the HTTPS protocol |
|
|
|
The REST API is blocked due to overload. This is a manual individual block, to remove it you need to contact Bitrix24 technical support |
|
|
|
The REST API is available only on commercial plans |
|
|
|
The user whose access token or webhook was used to call the method lacks 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 account administrator has allowed access to this application only for specific users |
|
|
|
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
- Get a List of Directory Items by Filter crm.status.list
- Get a directory item by ID crm.status.get
- Update CRM Status Element `crm.status.update`
- Delete CRM Status Element `crm.status.delete`
- Get Description of CRM Status Fields
- Get CRM Status Entity Types
- How to Create a New Sales Funnel with Stages in a Smart Process