Get the list of activities crm.activity.list
Scope:
crmWho can execute the method: any user
The method crm.activity.list returns a list of activities based on the filter, considering the access permissions of the current user.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
select |
An array of fields of the activity crm.activity.fields that need to be selected. To get the fields |
|
filter |
An object for filtering the selected items in key-value format. Possible values for An additional prefix can be assigned to the key to clarify the filter's behavior. Possible prefix values:
|
|
order |
A set of key-value pairs for sorting the output results. The keys can use the fields of the activity crm.activity.fields. Possible values for
By default, it is sorted by increasing the Start Date field ( |
|
start |
This parameter is used to control pagination. The page size of results is always static: 50 records. To select the second page of results, you need to pass the value The formula for calculating the value of the
|
See the description of list methods.
Pay attention to the peculiarity of the parameter filter[BINDINGS].
Activity can be linked to multiple CRM entities. For example, a call can be linked to both a lead and an activity, so to retrieve these entities, there is a special filter key in the parameters of the method crm.activity.list - BINDINGS.
You need to specify an array of system or custom types of CRM objects for which you need to find the binding.
Each object can consist of the keys OWNER_TYPE_ID (entity type identifier) and OWNER_ID (entity identifier), either one or a combination of both. For example:
"BINDINGS": [
{"OWNER_TYPE_ID": 2},
{"OWNER_TYPE_ID": 3}
]
Code Examples
How to Use Examples in Documentation
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"order":{"ID":"DESC"},"filter":{"OWNER_TYPE_ID":3,"OWNER_ID":102},"select":["*","COMMUNICATIONS"]}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.activity.list
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"order":{"ID":"DESC"},"filter":{"OWNER_TYPE_ID":3,"OWNER_ID":102},"select":["*","COMMUNICATIONS"],"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.activity.list
In this example, we retrieve the list of activities for the contact with ID = 102.
BX24.callMethod(
"crm.activity.list",
{
order: { "ID": "DESC" },
filter:
{
"OWNER_TYPE_ID": 3,
"OWNER_ID": 102
},
select: [ "*", "COMMUNICATIONS" ]
},
function(result)
{
if(result.error())
console.error(result.error());
else
{
console.dir(result.data());
if(result.more())
result.next();
}
}
);
require_once('crest.php');
$result = CRest::call(
'crm.activity.list',
[
'order' => [ 'ID' => 'DESC' ],
'filter' => [
'OWNER_TYPE_ID' => 3,
'OWNER_ID' => 102
],
'select' => [ '*', 'COMMUNICATIONS' ]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Typical use-cases and scenarios
Response Handling
HTTP status: 200
{
"result": [
{
"ID": "20",
"OWNER_ID": "15",
"OWNER_TYPE_ID": "3",
"TYPE_ID": "2",
"PROVIDER_ID": "VOXIMPLANT_CALL",
"PROVIDER_TYPE_ID": "CALL",
"PROVIDER_GROUP_ID": null,
"ASSOCIATED_ENTITY_ID": "0",
"SUBJECT": "Outgoing call Nicholas Mitchell",
"CREATED": "2020-09-27T13:26:55+03:00",
"LAST_UPDATED": "2021-03-21T20:28:24+03:00",
"START_TIME": "2020-09-27T13:25:00+03:00",
"END_TIME": "2020-09-27T19:25:00+03:00",
"DEADLINE": "2020-09-27T13:25:00+03:00",
"COMPLETED": "Y",
"STATUS": "2",
"RESPONSIBLE_ID": "505",
"PRIORITY": "2",
"NOTIFY_TYPE": "1",
"NOTIFY_VALUE": "15",
"DESCRIPTION": "",
"DESCRIPTION_TYPE": "1",
"DIRECTION": "2",
"LOCATION": "",
"SETTINGS": [],
"ORIGINATOR_ID": null,
"ORIGIN_ID": null,
"AUTHOR_ID": "505",
"EDITOR_ID": "505",
"PROVIDER_PARAMS": [],
"PROVIDER_DATA": null,
"RESULT_MARK": "0",
"RESULT_VALUE": null,
"RESULT_SUM": null,
"RESULT_CURRENCY_ID": null,
"RESULT_STATUS": "0",
"RESULT_STREAM": "0",
"RESULT_SOURCE_ID": null,
"AUTOCOMPLETE_RULE": "0"
},
// .. 49 more items
],
"next": 50,
"total": 123456,
"time": {
"start": 1724677896.295857,
"finish": 1724677897.197243,
"duration": 0.901386022567749,
"processing": 0.8762130737304688,
"date_start": "2024-08-26T16:11:36+03:00",
"date_finish": "2024-08-26T16:11:37+03:00",
"operating_reset_at": "2024-08-26T16:11:37+03:00",
"operating": 0.0162130737304688
}
}
Returned Data
|
Name |
Description |
|
result |
The result of the operation. An array of activitys. For information about the structure of an activity, see the method crm.activity.fields |
|
time |
Information about the execution time of the request |
Error Handling
HTTP status: 400, 403
{
"error": "INVALID_REQUEST",
"error_description": "Https required"
}
|
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 |
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 |
Private Examples
How to Use Examples in Documentation
Using BINDINGS
Retrieve fields: Identifier, Name, Owner Type (Entity Type Identifier), Owner (Entity Identifier)
Selection condition: the activity is linked to both a deal and a contact
Note
When using multiple pairs in BINDINGS, duplication may occur in the results. For example, in the result of executing the code example below, the activity linked to both entities will be output twice.
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"order":{"ID":"DESC"},"filter":{"BINDINGS":[{"OWNER_TYPE_ID":2},{"OWNER_TYPE_ID":3}]},"select":["*","COMMUNICATIONS"]}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.activity.list
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"order":{"ID":"DESC"},"filter":{"BINDINGS":[{"OWNER_TYPE_ID":2},{"OWNER_TYPE_ID":3}]},"select":["*","COMMUNICATIONS"],"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.activity.list
BX24.callMethod(
"crm.activity.list",
{
order: { "ID": "DESC" },
filter:
{
"BINDINGS": [
{"OWNER_TYPE_ID": 2},
{"OWNER_TYPE_ID": 3}
]
},
select: [ "*", "COMMUNICATIONS" ]
},
function(result)
{
if(result.error())
console.error(result.error());
else
{
console.dir(result.data());
if(result.more())
result.next();
}
}
);
require_once('crest.php');
$result = CRest::call(
'crm.activity.list',
[
'order' => ['ID' => 'DESC'],
'filter' => [
'BINDINGS' => [
['OWNER_TYPE_ID' => 2],
['OWNER_TYPE_ID' => 3]
]
],
'select' => ['*', 'COMMUNICATIONS']
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Retrieving COMMUNICATIONS
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"filter":{"ID":"20"},"select":["*","COMMUNICATIONS"]}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.activity.list
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"filter":{"ID":"20"},"select":["*","COMMUNICATIONS"],"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.activity.list
BX24.callMethod(
"crm.activity.list",
{
filter:
{
"ID": '20'
},
select: [ "*", "COMMUNICATIONS" ]
},
function(result)
{
if(result.error())
console.error(result.error());
else
{
console.dir(result.data());
if(result.more())
result.next();
}
}
);
require_once('crest.php');
$result = CRest::call(
'crm.activity.list',
[
'filter' => [
'ID' => '20'
],
'select' => ['*', 'COMMUNICATIONS']
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Example of Returned Data
HTTP status: 200
{
"result": [
{
"ID": "20",
"COMMUNICATIONS": [
{
"ID": "23",
"TYPE": "PHONE",
"VALUE": "19152222222",
"ENTITY_ID": "15",
"ENTITY_TYPE_ID": "3",
"ENTITY_SETTINGS": {
"HONORIFIC": "1",
"NAME": "Andrew ",
"SECOND_NAME": "Nikolaev",
"LAST_NAME": "",
"COMPANY_TITLE": "Ltd. Fusion",
"COMPANY_ID": "21"
}
}
]
}
],
"total": 1,
"time": {
"start": 1724659407.69855,
"finish": 1724659407.723506,
"duration": 0.02495598793029785,
"processing": 0.003489971160888672,
"date_start": "2024-08-26T11:03:27+03:00",
"date_finish": "2024-08-26T11:03:27+03:00"
}
}
Retrieving Attachments
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"filter":{"ID":"101121"},"select":["*","STORAGE_ELEMENT_IDS"]}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.activity.list
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"filter":{"ID":"101121"},"select":["*","STORAGE_ELEMENT_IDS"],"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.activity.list
BX24.callMethod(
"crm.activity.list",
{
filter:
{
"ID": '101121'
},
select: [ "*", "STORAGE_ELEMENT_IDS" ]
},
function(result)
{
if(result.error())
console.error(result.error());
else
{
console.dir(result.data());
if(result.more())
result.next();
}
}
);
require_once('crest.php');
$result = CRest::call(
'crm.activity.list',
[
'filter' => [
'ID' => '101121'
],
'select' => ['*', 'STORAGE_ELEMENT_IDS']
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Example of Returned Data
HTTP status: 200
{
"result": [
{
"ID": "101121",
"FILES": [
{
"id": 3101820,
"url": "http://xxx.bitrix24.com/bitrix/tools/crm_show_file.php?fileId=3101820&ownerTypeId=6&ownerId=101121&auth="
}
]
}
],
"total": 1,
"time": {
"start": 1724659652.591025,
"finish": 1724659652.623784,
"duration": 0.03275895118713379,
"processing": 0.00624394416809082,
"date_start": "2024-08-26T11:07:32+03:00",
"date_finish": "2024-08-26T11:07:32+03:00"
}
}
Continue Learning
- How to Transfer an Activity from One Object Type to Another
- How to Transfer an Activity Between Entities of the Same Type
- How to Get a List of Activities from Deals