Get a list of deals crm.deal.list
Scope:
crmWho can execute the method: any user with "read" access permission for deals
Method Development Stopped
The method crm.deal.list continues to function, but there is a more relevant alternative crm.item.list.
The method crm.deal.list returns a list of deals based on a filter. It is an implementation of the list method for deals.
Method Parameters
|
Name |
Description |
|
select |
List of fields that should be populated for deals in the selection. You can use the following masks for selection:
You can find the list of available fields for selection using the method crm.deal.fields. By default, all fields are taken — |
|
filter |
Object format:
where:
You can add a prefix to the keys
The LIKE filter does not work with fields of type You can find the list of available fields for filtering using the method crm.deal.fields. The filter does not support the field |
|
order |
Object format:
where:
You can find the list of available fields for sorting using the method crm.deal.fields |
|
start |
This parameter is used to manage pagination. The page size of results is always static — 50 records. To select the second page of results, pass the value The formula for calculating the
|
Also, see the description of list methods.
Related methods and topics
Code Examples
How to Use Examples in Documentation
Get a list of deals where:
- the funnel ID equals
1 - the deal type equals
COMPLEX - the title ends with
a - the stage equals
C1:NEW - the amount is greater than 10000 but less than or equal to 20000
- manual mode for amount calculation is enabled
- the responsible person is either the user with
id = 1or the user withid = 6 - the deal was created at least 6 months ago
Set the following sort order for this selection: title and amount in ascending order.
For clarity, select only the necessary fields:
- Identifier
ID - Title
TITLE - Deal type
TYPE_ID - Funnel ID
CATEGORY_ID - Stage
STAGE_ID - Amount
OPPORTUNITY - Is manual mode enabled
IS_MANUAL_OPPORTUNITY - Responsible
ASSIGNED_BY_ID - Creation date
DATE_CREATE
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"SELECT":["ID","TITLE","TYPE_ID","CATEGORY_ID","STAGE_ID","OPPORTUNITY","IS_MANUAL_OPPORTUNITY","ASSIGNED_BY_ID","DATE_CREATE"],"FILTER":{"=%TITLE":"%a","CATEGORY_ID":1,"TYPE_ID":"COMPLEX","STAGE_ID":"C1:NEW",">OPPORTUNITY":10000,"<=OPPORTUNITY":20000,"IS_MANUAL_OPPORTUNITY":"Y","@ASSIGNED_BY_ID":[1,6],">DATE_CREATE":"'"$(date --date='-6 months' +%Y-%m-%d)"'"},"ORDER":{"TITLE":"ASC","OPPORTUNITY":"ASC"}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.deal.list
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"SELECT":["ID","TITLE","TYPE_ID","CATEGORY_ID","STAGE_ID","OPPORTUNITY","IS_MANUAL_OPPORTUNITY","ASSIGNED_BY_ID","DATE_CREATE"],"FILTER":{"=%TITLE":"%a","CATEGORY_ID":1,"TYPE_ID":"COMPLEX","STAGE_ID":"C1:NEW",">OPPORTUNITY":10000,"<=OPPORTUNITY":20000,"IS_MANUAL_OPPORTUNITY":"Y","@ASSIGNED_BY_ID":[1,6],">DATE_CREATE":"'"$(date --date='-6 months' +%Y-%m-%d)"'"},"ORDER":{"TITLE":"ASC","OPPORTUNITY":"ASC"},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.deal.list
// callListMethod: Retrieves all data at once. Use only for small selections (< 1000 items) due to high memory usage.
const now = new Date();
const sixMonthAgo = new Date();
sixMonthAgo.setMonth(now.getMonth() - 6);
try {
const response = await $b24.callListMethod(
'crm.deal.list',
{
select: [
'ID',
'TITLE',
'TYPE_ID',
'CATEGORY_ID',
'STAGE_ID',
'OPPORTUNITY',
'IS_MANUAL_OPPORTUNITY',
'ASSIGNED_BY_ID',
'DATE_CREATE',
],
filter: {
'=%TITLE': '%а',
CATEGORY_ID: 1,
TYPE_ID: 'COMPLEX',
STAGE_ID: 'C1:NEW',
'>OPPORTUNITY': 10000,
'<=OPPORTUNITY': 20000,
IS_MANUAL_OPPORTUNITY: 'Y',
'@ASSIGNED_BY_ID': [1, 6],
'>DATE_CREATE': sixMonthAgo,
},
order: {
TITLE: 'ASC',
OPPORTUNITY: 'ASC',
},
},
(result) => {
result.error()
? console.error(result.error())
: console.info(result.data())
;
},
);
} catch (error) {
console.error('Request failed', error);
}
// fetchListMethod: Retrieves data in parts using an iterator. Use it for large data volumes to optimize memory usage.
const now = new Date();
const sixMonthAgo = new Date();
sixMonthAgo.setMonth(now.getMonth() - 6);
try {
const generator = $b24.fetchListMethod('crm.deal.list', {
select: [
'ID',
'TITLE',
'TYPE_ID',
'CATEGORY_ID',
'STAGE_ID',
'OPPORTUNITY',
'IS_MANUAL_OPPORTUNITY',
'ASSIGNED_BY_ID',
'DATE_CREATE',
],
filter: {
'=%TITLE': '%а',
CATEGORY_ID: 1,
TYPE_ID: 'COMPLEX',
STAGE_ID: 'C1:NEW',
'>OPPORTUNITY': 10000,
'<=OPPORTUNITY': 20000,
IS_MANUAL_OPPORTUNITY: 'Y',
'@ASSIGNED_BY_ID': [1, 6],
'>DATE_CREATE': sixMonthAgo,
},
order: {
TITLE: 'ASC',
OPPORTUNITY: 'ASC',
},
}, 'ID');
for await (const page of generator) {
for (const entity of page) {
console.log('Entity:', entity);
}
}
} catch (error) {
console.error('Request failed', error);
}
// callMethod: Manually controls pagination through the start parameter. Use it for precise control of request batches. For large datasets, it is less efficient than fetchListMethod.
const now = new Date();
const sixMonthAgo = new Date();
sixMonthAgo.setMonth(now.getMonth() - 6);
try {
const response = await $b24.callMethod('crm.deal.list', {
select: [
'ID',
'TITLE',
'TYPE_ID',
'CATEGORY_ID',
'STAGE_ID',
'OPPORTUNITY',
'IS_MANUAL_OPPORTUNITY',
'ASSIGNED_BY_ID',
'DATE_CREATE',
],
filter: {
'=%TITLE': '%а',
CATEGORY_ID: 1,
TYPE_ID: 'COMPLEX',
STAGE_ID: 'C1:NEW',
'>OPPORTUNITY': 10000,
'<=OPPORTUNITY': 20000,
IS_MANUAL_OPPORTUNITY: 'Y',
'@ASSIGNED_BY_ID': [1, 6],
'>DATE_CREATE': sixMonthAgo,
},
order: {
TITLE: 'ASC',
OPPORTUNITY: 'ASC',
},
}, 0);
const result = response.getData().result || [];
for (const entity of result) {
console.log('Entity:', entity);
}
} catch (error) {
console.error('Request failed', error);
}
try {
$response = $b24Service
->core
->call(
'crm.deal.list',
[
'select' => [
'ID',
'TITLE',
'TYPE_ID',
'CATEGORY_ID',
'STAGE_ID',
'OPPORTUNITY',
'IS_MANUAL_OPPORTUNITY',
'ASSIGNED_BY_ID',
'DATE_CREATE',
],
'filter' => [
'=%TITLE' => '%а',
'CATEGORY_ID' => 1,
'TYPE_ID' => 'COMPLEX',
'STAGE_ID' => 'C1:NEW',
'>OPPORTUNITY' => 10000,
'<=OPPORTUNITY' => 20000,
'IS_MANUAL_OPPORTUNITY' => 'Y',
'@ASSIGNED_BY_ID' => [1, 6],
'>DATE_CREATE' => $sixMonthAgo,
],
'order' => [
'TITLE' => 'ASC',
'OPPORTUNITY' => 'ASC',
],
]
);
$result = $response
->getResponseData()
->getResult();
if ($result->error()) {
echo 'Error: ' . $result->error();
} else {
echo 'Data: ' . print_r($result->data(), true);
}
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error fetching deal list: ' . $e->getMessage();
}
const now = new Date();
const sixMonthAgo = new Date();
sixMonthAgo.setMonth(now.getMonth() - 6);
BX24.callMethod(
'crm.deal.list',
{
select: [
'ID',
'TITLE',
'TYPE_ID',
'CATEGORY_ID',
'STAGE_ID',
'OPPORTUNITY',
'IS_MANUAL_OPPORTUNITY',
'ASSIGNED_BY_ID',
'DATE_CREATE',
],
filter: {
'=%TITLE': '%а',
CATEGORY_ID: 1,
TYPE_ID: 'COMPLEX',
STAGE_ID: 'C1:NEW',
'>OPPORTUNITY': 10000,
'<=OPPORTUNITY': 20000,
IS_MANUAL_OPPORTUNITY: 'Y',
'@ASSIGNED_BY_ID': [1, 6],
'>DATE_CREATE': sixMonthAgo,
},
order: {
TITLE: 'ASC',
OPPORTUNITY: 'ASC',
},
},
(result) => {
result.error()
? console.error(result.error())
: console.info(result.data())
;
},
);
require_once('crest.php');
$sixMonthAgo = (new DateTime())->modify('-6 months')->format('Y-m-d');
$result = CRest::call(
'crm.deal.list',
[
'SELECT' => [
'ID',
'TITLE',
'TYPE_ID',
'CATEGORY_ID',
'STAGE_ID',
'OPPORTUNITY',
'IS_MANUAL_OPPORTUNITY',
'ASSIGNED_BY_ID',
'DATE_CREATE',
],
'FILTER' => [
'=%TITLE' => '%а',
'CATEGORY_ID' => 1,
'TYPE_ID' => 'COMPLEX',
'STAGE_ID' => 'C1:NEW',
'>OPPORTUNITY' => 10000,
'<=OPPORTUNITY' => 20000,
'IS_MANUAL_OPPORTUNITY' => 'Y',
'@ASSIGNED_BY_ID' => [1, 6],
'>DATE_CREATE' => $sixMonthAgo,
],
'ORDER' => [
'TITLE' => 'ASC',
'OPPORTUNITY' => 'ASC',
],
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Response Handling
HTTP status: 200
{
"result": [
{
"ID": "37",
"TITLE": "[A] Deal",
"TYPE_ID": "COMPLEX",
"CATEGORY_ID": "1",
"STAGE_ID": "C1:NEW",
"OPPORTUNITY": "19999.99",
"IS_MANUAL_OPPORTUNITY": "Y",
"ASSIGNED_BY_ID": "1",
"DATE_CREATE": "2024-09-02T18:37:18+02:00"
},
{
"ID": "38",
"TITLE": "[A] Deal",
"TYPE_ID": "COMPLEX",
"CATEGORY_ID": "1",
"STAGE_ID": "C1:NEW",
"OPPORTUNITY": "20000.00",
"IS_MANUAL_OPPORTUNITY": "Y",
"ASSIGNED_BY_ID": "6",
"DATE_CREATE": "2024-09-02T18:37:38+02:00"
},
{
"ID": "39",
"TITLE": "[B] Sale",
"TYPE_ID": "COMPLEX",
"CATEGORY_ID": "1",
"STAGE_ID": "C1:NEW",
"OPPORTUNITY": "12500.00",
"IS_MANUAL_OPPORTUNITY": "Y",
"ASSIGNED_BY_ID": "1",
"DATE_CREATE": "2024-04-09T23:11:01+02:00"
},
{
"ID": "40",
"TITLE": "[B] Deal",
"TYPE_ID": "COMPLEX",
"CATEGORY_ID": "1",
"STAGE_ID": "C1:NEW",
"OPPORTUNITY": "13500.00",
"IS_MANUAL_OPPORTUNITY": "Y",
"ASSIGNED_BY_ID": "6",
"DATE_CREATE": "2024-08-08T19:00:14+02:00"
},
{
"ID": "41",
"TITLE": "[C] Deal",
"TYPE_ID": "COMPLEX",
"CATEGORY_ID": "1",
"STAGE_ID": "C1:NEW",
"OPPORTUNITY": "11500.00",
"IS_MANUAL_OPPORTUNITY": "Y",
"ASSIGNED_BY_ID": "6",
"DATE_CREATE": "2024-05-08T09:38:23+02:00"
},
{
"ID": "42",
"TITLE": "[D] Deal",
"TYPE_ID": "COMPLEX",
"CATEGORY_ID": "1",
"STAGE_ID": "C1:NEW",
"OPPORTUNITY": "18500.00",
"IS_MANUAL_OPPORTUNITY": "Y",
"ASSIGNED_BY_ID": "6",
"DATE_CREATE": "2024-07-02T15:38:32+02:00"
}
],
"total": 6,
"time": {
"start": 1725292115.026221,
"finish": 1725292115.907058,
"duration": 0.8808369636535645,
"processing": 0.2484450340270996,
"date_start": "2024-09-02T17:48:35+02:00",
"date_finish": "2024-09-02T17:48:35+02:00",
"operating": 0
}
}
Returned Data
|
Name |
Description |
|
result |
The root element of the response. Contains an array of objects with information about the fields of deals. It should be noted that the structure of fields may change due to the |
|
total |
The total number of found items |
|
next |
Contains the value that needs to be passed in the next request in the The |
|
time |
Information about the execution time of the request |
Error Handling
HTTP status: 400
{
"error": "",
"error_description": "Parameter 'filter' 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 user does not have permission to "read" deals |
|
|
|
A non-object was passed to the |
|
|
|
A non-object was passed to the |
|
|
|
An unknown error occurred |
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 Deal by Id crm.deal.get
- Delete deal crm.deal.delete
- Get Deal Fields crm.deal.fields
- Add an activity to a new lead or deal depending on the CRM mode