Get Deal by Id crm.deal.get
Scope:
crmWho can execute the method: any user with "read" access permission for deals
Method Development Stopped
The method crm.deal.get continues to function, but there is a more relevant alternative crm.item.get.
The method crm.deal.get returns a deal by its identifier.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
id* |
Identifier of the deal. The identifier can be obtained using the methods crm.deal.list or crm.deal.add |
Related methods and topics
Code Examples
How to Use Examples in Documentation
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"ID":410}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.deal.get
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"ID":410,"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.deal.get
try
{
const response = await $b24.callMethod(
'crm.deal.get',
{
id: 410,
}
);
const result = response.getData().result;
result.error()
? console.error(result.error())
: console.info(result)
;
}
catch( error )
{
console.error('Error:', error);
}
try {
$response = $b24Service
->core
->call(
'crm.deal.get',
[
'id' => 410,
]
);
$result = $response
->getResponseData()
->getResult();
if ($result->error()) {
echo 'Error: ' . $result->error();
} else {
echo 'Deal data: ' . print_r($result->data(), true);
}
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error getting deal: ' . $e->getMessage();
}
BX24.callMethod(
'crm.deal.get',
{
id: 410,
},
(result) => {
result.error()
? console.error(result.error())
: console.info(result.data())
;
},
);
require_once('crest.php');
$result = CRest::call(
'crm.deal.get',
[
'ID' => 410
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Response Handling
HTTP Status: 200
{
"result": {
"ID": "410",
"TITLE": "New Deal #1",
"TYPE_ID": "COMPLEX",
"STAGE_ID": "PREPARATION",
"PROBABILITY": "99",
"CURRENCY_ID": "EUR",
"OPPORTUNITY": "1000000.00",
"IS_MANUAL_OPPORTUNITY": "Y",
"TAX_VALUE": "0.00",
"LEAD_ID": null,
"COMPANY_ID": "9",
"CONTACT_ID": "84",
"QUOTE_ID": null,
"BEGINDATE": "2024-08-30T02:00:00+02:00",
"CLOSEDATE": "2024-09-09T02:00:00+02:00",
"ASSIGNED_BY_ID": "1",
"CREATED_BY_ID": "1",
"MODIFY_BY_ID": "1",
"DATE_CREATE": "2024-08-30T14:29:00+02:00",
"DATE_MODIFY": "2024-08-30T14:29:00+02:00",
"OPENED": "Y",
"CLOSED": "N",
"COMMENTS": "[B]Example comment[\/B]",
"ADDITIONAL_INFO": "Additional information",
"LOCATION_ID": null,
"CATEGORY_ID": "0",
"STAGE_SEMANTIC_ID": "P",
"IS_NEW": "N",
"IS_RECURRING": "N",
"IS_RETURN_CUSTOMER": "N",
"IS_REPEATED_APPROACH": "N",
"SOURCE_ID": "CALLBACK",
"SOURCE_DESCRIPTION": "Additional information about the source",
"ORIGINATOR_ID": null,
"ORIGIN_ID": null,
"MOVED_BY_ID": "1",
"MOVED_TIME": "2024-08-30T14:29:00+02:00",
"LAST_ACTIVITY_TIME": "2024-08-30T14:29:00+02:00",
"UTM_SOURCE": "google",
"UTM_MEDIUM": "CPC",
"UTM_CAMPAIGN": null,
"UTM_CONTENT": null,
"UTM_TERM": null,
"PARENT_ID_1220": "22",
"LAST_ACTIVITY_BY": "1",
"UF_CRM_1721244482250": "Hello world!"
},
"time": {
"start": 1725020945.541275,
"finish": 1725020946.179076,
"duration": 0.637800931930542,
"processing": 0.21427488327026367,
"date_start": "2024-08-30T14:29:05+02:00",
"date_finish": "2024-08-30T14:29:06+02:00",
"operating": 0
}
}
Returned Data
|
Name |
Description |
|
result |
Root element of the response. Contains information about the deal fields. The structure is described below |
|
time |
Information about the request execution time |
Type deal
|
Name |
Description |
|
ID |
Identifier of the deal |
|
TITLE |
Title |
|
TYPE_ID |
String identifier of the deal type. To learn more about the obtained deal type, you can use the method crm.status.list, passing the filter:
|
|
CATEGORY_ID |
Funnel. To learn more about this funnel, you can use the method crm.category.get, passing |
|
STAGE_ID |
String identifier of the deal stage. To learn more about the obtained stage, you can use the method crm.status.list, passing the filter:
where:
|
|
STAGE_SEMANTIC_ID |
Stage group. Possible values:
|
|
IS_NEW |
Indicates whether the deal is new. Possible values:
|
|
IS_RECURRING |
Indicates whether the deal is recurring. Possible values:
|
|
IS_RETURN_CUSTOMER |
Indicates whether the deal is a repeat. Possible values:
|
|
IS_REPEATED_APPROACH |
Indicates whether the approach is repeated. Possible values:
|
|
PROBABILITY |
Probability, % |
|
CURRENCY_ID |
Currency |
|
OPPORTUNITY |
Amount |
|
IS_MANUAL_OPPORTUNITY |
Indicates whether manual mode for calculating the amount is enabled. Possible values:
|
|
TAX_VALUE |
Tax rate |
|
COMPANY_ID |
Identifier of the company. To learn more about the company, you can use the method crm.item.get, passing |
|
CONTACT_ID |
Identifier of the contact. Deprecated. To get a list of all contacts associated with the deal, use the method crm.deal.contact.items.get or the universal method crm.item.get |
|
QUOTE_ID |
Identifier of the estimate based on which the deal was created. To learn more about the estimate, you can use the method crm.item.get, passing |
|
BEGINDATE |
Start date |
|
CLOSEDATE |
Close date |
|
OPENED |
Indicates whether the deal is available to everyone. Possible values:
|
|
CLOSED |
Indicates whether the deal is closed. Possible values:
|
|
COMMENTS |
Comment |
|
ASSIGNED_BY_ID |
Responsible person |
|
CREATED_BY_ID |
Created by |
|
MODIFY_BY_ID |
Modified by |
|
MOVED_BY_ID |
Identifier of the user who last changed the stage |
|
DATE_CREATE |
Creation date |
|
DATE_MODIFY |
Modification date |
|
MOVED_TIME |
Date of the last stage change |
|
SOURCE_ID |
Source. To learn more about the obtained source, you can use the method crm.status.list, passing the filter:
|
|
SOURCE_DESCRIPTION |
Additional information about the source |
|
LEAD_ID |
Identifier of the lead based on which the deal was created. To learn more about the lead, you can use the method crm.item.get, passing |
|
ADDITIONAL_INFO |
Additional information |
|
LOCATION_ID |
Location. System field |
|
ORIGINATOR_ID |
External source |
|
ORIGIN_ID |
Identifier of the element in the external source |
|
UTM_SOURCE |
Advertising system |
|
UTM_MEDIUM |
Traffic type |
|
UTM_CAMPAIGN |
Advertising campaign designation |
|
UTM_CONTENT |
Content of the campaign |
|
UTM_TERM |
Search condition of the campaign |
|
LAST_ACTIVITY_TIME |
Date of the last activity in the timeline |
|
LAST_ACTIVITY_BY |
Author of the last activity in the timeline |
|
UF_CRM_... |
User-defined fields. For example, Depending on the portal settings, deals may have a set of user-defined fields of specific types. Read more in the section about user-defined fields |
|
PARENT_ID_... |
Relationship fields. If there are smart processes associated with deals on the portal, for each such smart process, there is a field that stores the relationship between this smart process and the deal. The field itself stores the identifier of the element of that smart process. For example, the field |
Error Handling
HTTP Status: 400
{
"error": "",
"error_description": "Parameter 'fields' must be array."
}
|
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 |
|
|
|
The |
|
|
|
The user does not have permission to "read" this deal |
|
|
|
No deal exists with the provided |
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
- Create a new deal crm.deal.add
- Update Deal crm.deal.update
- Get a list of deals crm.deal.list
- Delete deal crm.deal.delete
- Get Deal Fields crm.deal.fields