Get a list of crm.item.list elements

Scope: crm

Who can execute the method: any user with "read" access permission for CRM object elements

The method retrieves a list of elements of a specific type of CRM object.

CRM object elements will not be included in the final selection if the user does not have "read" access permission for these elements.

Method Parameters

Required parameters are marked with *

Name
type

Description

entityTypeId*
integer

Identifier of the system or user-defined type whose elements need to be retrieved

select
array

List of fields that should be populated in the selected elements.

Can contain only field names or '*'.

A list of all available fields for selection can be obtained using the crm.item.fields method. A list of standard fields is available in the article CRM Object Fields

filter
object

Object format:

{
            field_1: value_1,
            field_2: value_2,
            ...,
            field_n: value_n,
        }
        

where

  • field_n — field name by which the selection of elements will be filtered
  • value_n — filter value

The filter can have unlimited nesting and number of conditions.
By default, all conditions are combined with AND. If you need to use OR, you can pass a special key logic with the value OR.

You can add a prefix to the field_n keys to clarify the filter operation.
Possible prefix values:

  • >= — greater than or equal to
  • > — greater than
  • <= — less than or equal to
  • < — less than
  • @ — IN, an array is passed as the value
  • !@ — NOT IN, an array is passed as the value
  • % — LIKE, substring search. The % symbol in the filter value should not be passed. The search looks for a substring in any position of the string
  • =% — LIKE, substring search. The % symbol should be passed in the value. Examples:
    • "mol%" — searches for values starting with "mol"
    • "%mol" — searches for values ending with "mol"
    • "%mol%" — searches for values where "mol" can be in any position
  • %= — LIKE (similar to =%)
  • !% — NOT LIKE, substring search. The % symbol in the filter value should not be passed. The search goes from both sides
  • !=% — NOT LIKE, substring search. The % symbol should be passed in the value. Examples:
    • "mol%" — searches for values not starting with "mol"
    • "%mol" — searches for values not ending with "mol"
    • "%mol%" — searches for values where the substring "mol" is not present in any position
  • !%= — NOT LIKE (similar to !=%)
  • = — equal, exact match (used by default)
  • != — not equal
  • ! — not equal

A list of all available fields for filtering can be obtained using the crm.item.fields method. A list of standard fields is available in the article CRM Object Fields

order
object

Object format:

{
            field_1: value_1,
            field_2: value_2,
            ...,
            field_n: value_n,
        }
        

where

  • field_n — field name by which the selection of elements will be sorted
  • value_n — value of type string equal to:
    • ASC — ascending sort
    • DESC — descending sort

A list of all available fields for sorting can be obtained using the crm.item.fields method. A list of standard fields is available in the article CRM Object Fields

start
integer

This parameter is used to control pagination.

The page size of results is always static — 50 records.

To select the second page of results, pass the value 50. To select the third page of results — the value 100, and so on.

The formula for calculating the start parameter value:

start = (N-1) * 50, where N — the desired page number

useOriginalUfNames
boolean

This parameter controls the format of user field names in the request and response.
Possible values:

  • Y — original names of user fields, e.g., UF_CRM_2_1639669411830
  • N — user field names in camelCase, e.g., ufCrm2_1639669411830

Default — N

Code Examples

Get a list of leads where:

  1. First name or last name is not empty
  2. Are in the status "In Progress" or "Unprocessed".
  3. Came from sources "Advertising" or "Website".
  4. Are assigned to managers with IDs 1 or 6.
  5. Have a deal amount from 5000 to 20000.
  6. The calculation mode for the amount is manual.

Set the following sort order for this selection:

  • First name and last name in ascending order.

For clarity, we will choose only the fields we need:

  • Identifier id
  • Title title
  • First name name
  • Last name lastName
  • Stage identifier stageId
  • Source identifier sourceId
  • Responsible identifier assignedById
  • Amount opportunity
  • Amount calculation mode isManualOpportunity
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"entityTypeId":1,"select":["id","title","lastName","name","stageId","sourceId","assignedById","opportunity","isManualOpportunity"],"filter":{"0":{"logic":"OR","0":{"!=name":""},"1":{"!=lastName":""}},"@stageId":["NEW","IN_PROCESS"],"@sourceId":["WEB","ADVERTISING"],"@assignedById":[1,6],">=opportunity":5000,"<=opportunity":20000,"isManualOpportunity":"Y"},"order":{"lastName":"ASC","name":"ASC"}}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.item.list
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"entityTypeId":1,"select":["id","title","lastName","name","stageId","sourceId","assignedById","opportunity","isManualOpportunity"],"filter":{"0":{"logic":"OR","0":{"!=name":""},"1":{"!=lastName":""}},"@stageId":["NEW","IN_PROCESS"],"@sourceId":["WEB","ADVERTISING"],"@assignedById":[1,6],">=opportunity":5000,"<=opportunity":20000,"isManualOpportunity":"Y"},"order":{"lastName":"ASC","name":"ASC"},"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/crm.item.list
        
// callListMethod: Retrieves all data at once. Use only for small selections (< 1000 items) due to high memory usage.
        
        try {
          const response = await $b24.callListMethod(
            'crm.item.list',
            {
              entityTypeId: 1,
              select: [
                "id",
                "title",
                "lastName",
                "name",
                "stageId",
                "sourceId",
                "assignedById",
                "opportunity",
                "isManualOpportunity",
              ],
              filter: {
                "0": {
                  logic: "OR",
                  "0": {
                    "!=name": "",
                  },
                  "1": {
                    "!=lastName": "",
                  },
                },
                "@stageId": ["NEW", "IN_PROCESS"],
                "@sourceId": ['WEB', "ADVERTISING"],
                "@assignedById": [1, 6],
                ">=opportunity": 5000,
                "<=opportunity": 20000,
                "isManualOpportunity": "Y",
              },
              order: {
                lastName: 'ASC',
                name: 'ASC',
              },
            },
            (progress) => { console.log('Progress:', progress) }
          );
          const items = response.getData() || [];
          for (const entity of items) { console.log('Entity:', entity); }
        } 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.
        
        try {
          const generator = $b24.fetchListMethod('crm.item.list', {
            entityTypeId: 1,
            select: [
              "id",
              "title",
              "lastName",
              "name",
              "stageId",
              "sourceId",
              "assignedById",
              "opportunity",
              "isManualOpportunity",
            ],
            filter: {
              "0": {
                logic: "OR",
                "0": {
                  "!=name": "",
                },
                "1": {
                  "!=lastName": "",
                },
              },
              "@stageId": ["NEW", "IN_PROCESS"],
              "@sourceId": ['WEB', "ADVERTISING"],
              "@assignedById": [1, 6],
              ">=opportunity": 5000,
              "<=opportunity": 20000,
              "isManualOpportunity": "Y",
            },
            order: {
              lastName: 'ASC',
              name: '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.
        
        try {
          const response = await $b24.callMethod('crm.item.list', {
            entityTypeId: 1,
            select: [
              "id",
              "title",
              "lastName",
              "name",
              "stageId",
              "sourceId",
              "assignedById",
              "opportunity",
              "isManualOpportunity",
            ],
            filter: {
              "0": {
                logic: "OR",
                "0": {
                  "!=name": "",
                },
                "1": {
                  "!=lastName": "",
                },
              },
              "@stageId": ["NEW", "IN_PROCESS"],
              "@sourceId": ['WEB', "ADVERTISING"],
              "@assignedById": [1, 6],
              ">=opportunity": 5000,
              "<=opportunity": 20000,
              "isManualOpportunity": "Y",
            },
            order: {
              lastName: 'ASC',
              name: 'ASC',
            },
          }, 0);
          const result = response.getData().result || [];
          for (const entity of result) { console.log('Entity:', entity); }
        } catch (error) {
          console.error('Request failed', error);
        }
        
try {
            $entityTypeId = 1; // Replace with actual entity type ID
            $order = []; // Replace with actual order array
            $filter = []; // Replace with actual filter array
            $select = []; // Replace with actual select array
            $startItem = 0; // Optional, can be adjusted as needed
            $itemsResult = $serviceBuilder
                ->getCRMScope()
                ->item()
                ->list($entityTypeId, $order, $filter, $select, $startItem);
            foreach ($itemsResult->getItems() as $item) {
                print("ID: " . $item->id . PHP_EOL);
                print("XML ID: " . $item->xmlId . PHP_EOL);
                print("Title: " . $item->title . PHP_EOL);
                print("Created By: " . $item->createdBy . PHP_EOL);
                print("Updated By: " . $item->updatedBy . PHP_EOL);
                print("Created Time: " . $item->createdTime->format(DATE_ATOM) . PHP_EOL);
                print("Updated Time: " . $item->updatedTime->format(DATE_ATOM) . PHP_EOL);
                // Add more fields as necessary
            }
        } catch (Throwable $e) {
            print("Error: " . $e->getMessage() . PHP_EOL);
        }
        
    BX24.callMethod(
                'crm.item.list',
                {
                    entityTypeId: 1,
                    select: [
                        "id", 
                        "title",
                        "lastName",
                        "name",
                        "stageId", 
                        "sourceId", 
                        "assignedById", 
                        "opportunity", 
                        "isManualOpportunity",
                    ],
                    filter: {
                        "0": {
                            logic: "OR",
                            "0": {
                                "!=name": "",
                            },
                            "1": {
                                "!=lastName": "",
                            },
                        },
                        "@stageId": ["NEW", "IN_PROCESS"],
                        "@sourceId": ['WEB', "ADVERTISING"],
                        "@assignedById": [1, 6],
                        ">=opportunity": 5000,
                        "<=opportunity": 20000,
                        "isManualOpportunity": "Y",
                    },
                    order: {
                        lastName: 'ASC',
                        name: 'ASC',
                    },
                },
                (result) => {
                    if (result.error())
                    {
                        console.error(result.error());
        
                        return;
                    }
        
                    console.info(result.data());
                },
            );
        
require_once('crest.php');
        
        $result = CRest::call(
            'crm.item.list',
            [
                'entityTypeId' => 1,
                'select' => [
                    "id",
                    "title",
                    "lastName",
                    "name",
                    "stageId",
                    "sourceId",
                    "assignedById",
                    "opportunity",
                    "isManualOpportunity",
                ],
                'filter' => [
                    "0" => [
                        "logic" => "OR",
                        "0" => [
                            "!=name" => "",
                        ],
                        "1" => [
                            "!=lastName" => "",
                        ],
                    ],
                    "@stageId" => ["NEW", "IN_PROCESS"],
                    "@sourceId" => ['WEB', "ADVERTISING"],
                    "@assignedById" => [1, 6],
                    ">=opportunity" => 5000,
                    "<=opportunity" => 20000,
                    "isManualOpportunity" => "Y",
                ],
                'order' => [
                    'lastName' => 'ASC',
                    'name' => 'ASC',
                ],
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        

Example request with date filter using OR logic

Filter deals entityTypeId = 2 by two creation dates. For each date, set the start and end of the day range.

For clarity, we will choose only the fields we need:

  • Identifier id
  • Title title
  • Creation date createdTime
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"entityTypeId":2,"select":["id","title","createdTime"],"filter":{"0":{"logic":"OR","0":{">=createdTime":"2025-10-31T00:00:00+02:00","<createdTime":"2025-11-01T00:00:00+02:00"},"1":{">=createdTime":"2025-02-28T00:00:00+02:00","<createdTime":"2025-03-01T00:00:00+02:00"}}}}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.item.list
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"entityTypeId":2,"select":["id","title","createdTime"],"filter":{"0":{"logic":"OR","0":{">=createdTime":"2025-10-31T00:00:00+02:00","<createdTime":"2025-11-01T00:00:00+02:00"},"1":{">=createdTime":"2025-02-28T00:00:00+02:00","<createdTime":"2025-03-01T00:00:00+02:00"}}},"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/crm.item.list
        
try {
            const response = await $b24.callMethod(
                'crm.item.list',
                {
                    entityTypeId: 2,
                    select: ['id', 'title', 'createdTime'],
                    filter: {
                        '0': {
                            logic: 'OR',
                            '0': {
                                '>=createdTime': '2025-10-31T00:00:00+02:00',
                                '<createdTime': '2025-11-01T00:00:00+02:00',
                            },
                            '1': {
                                '>=createdTime': '2025-02-28T00:00:00+02:00',
                                '<createdTime': '2025-03-01T00:00:00+02:00',
                            },
                        },
                    },
                },
            );
        
            const items = response.getData().items || [];
            items.forEach((item) => {
                console.info(`Deal #${item.id}: ${item.title} (${item.createdTime})`);
            });
        } catch (error) {
            console.error('crm.item.list error', error);
        }
        
try {
            $entityTypeId = 2;
            $order = [];
            $filter = [
                "0" => [
                    "logic" => "OR",
                    "0" => [
                        ">=createdTime" => "2025-10-31T00:00:00+02:00",
                        "<createdTime" => "2025-11-01T00:00:00+02:00",
                    ],
                    "1" => [
                        ">=createdTime" => "2025-02-28T00:00:00+02:00",
                        "<createdTime" => "2025-03-01T00:00:00+02:00",
                    ],
                ],
            ];
            $select = ['id', 'title', 'createdTime'];
            $startItem = 0;
        
            $itemsResult = $serviceBuilder
                ->getCRMScope()
                ->item()
                ->list($entityTypeId, $order, $filter, $select, $startItem);
        
            foreach ($itemsResult->getItems() as $item) {
                print("ID: " . $item->id . PHP_EOL);
                print("Title: " . $item->title . PHP_EOL);
                print("Created Time: " . $item->createdTime->format(DATE_ATOM) . PHP_EOL);
                print(PHP_EOL);
            }
        } catch (Throwable $e) {
            print("Error: " . $e->getMessage() . PHP_EOL);
        }
        
    BX24.callMethod(
                'crm.item.list',
                {
                    entityTypeId: 2,
                    select: ['id', 'title', 'createdTime'],
                    filter: {
                        '0': {
                            logic: 'OR',
                            '0': {
                                '>=createdTime': '2025-10-31T00:00:00+02:00',
                                '<createdTime': '2025-11-01T00:00:00+02:00',
                            },
                            '1': {
                                '>=createdTime': '2025-02-28T00:00:00+02:00',
                                '<createdTime': '2025-03-01T00:00:00+02:00',
                            },
                        },
                    },
                },
                function (result) {
                    if (result.error()) {
                        console.error('crm.item.list error', result.error());
                        return;
                    }
        
                    const { items } = result.data();
                    items.forEach((item) => {
                        console.log(`Deal #${item.id}: ${item.title} (${item.createdTime})`);
                    });
        
                    if (result.more()) {
                        result.next();
                    }
                }
            );
        
require_once('crest.php');
        
        $result = CRest::call(
            'crm.item.list',
            [
                'entityTypeId' => 2,
                'select' => ['id', 'title', 'createdTime'],
                'filter' => [
                    "0" => [
                        "logic" => "OR",
                        "0" => [
                            ">=createdTime" => "2025-10-31T00:00:00+02:00",
                            "<createdTime" => "2025-11-01T00:00:00+02:00",
                        ],
                        "1" => [
                            ">=createdTime" => "2025-02-28T00:00:00+02:00",
                            "<createdTime" => "2025-03-01T00:00:00+02:00",
                        ],
                    ],
                ],
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        

Response Handling

HTTP status: 200

{
            "result": {
                "items": [
                    {
                        "id": 253,
                        "assignedById": 6,
                        "stageId": "NEW",
                        "opportunity": 19000,
                        "sourceId": "WEB",
                        "title": "Lead #253",
                        "name": "Admin",
                        "lastName": null,
                        "isManualOpportunity": "Y"
                    },
                    {
                        "id": 255,
                        "assignedById": 1,
                        "stageId": "NEW",
                        "opportunity": 19600,
                        "sourceId": "WEB",
                        "title": "Lead #255",
                        "name": "John",
                        "lastName": "Doe",
                        "isManualOpportunity": "Y"
                    },
                    {
                        "id": 252,
                        "assignedById": 1,
                        "stageId": "NEW",
                        "opportunity": 12000,
                        "sourceId": "ADVERTISING",
                        "title": "Lead #252",
                        "name": "John",
                        "lastName": "Smith",
                        "isManualOpportunity": "Y"
                    },
                    {
                        "id": 254,
                        "assignedById": 6,
                        "stageId": "IN_PROCESS",
                        "opportunity": 19000,
                        "sourceId": "ADVERTISING",
                        "title": "Lead #254",
                        "name": "Cat",
                        "lastName": "Smith",
                        "isManualOpportunity": "Y"
                    }
                ]
            },
            "total": 4,
            "time": {
                "start": 1721724354.214286,
                "finish": 1721724354.805263,
                "duration": 0.5909769535064697,
                "processing": 0.24513697624206543,
                "date_start": "2024-07-23T10:45:54+02:00",
                "date_finish": "2024-07-23T10:45:54+02:00",
                "operating": 0
            }
        }
        

Returned Data

Name
type

Description

result
object

Root element of the response. Contains a single key items

items
item[]

Array with information about found elements.

Returned fields depend on the select parameter, field description

total
integer

Total number of found elements

next
integer

Contains the value to be passed in the next request in the start parameter to get the next batch of data.

The next parameter appears in the response if the number of elements matching your request exceeds 50.

time
time

Information about the execution time of the request

By default, user field names are passed and returned in camelCase, e.g., ufCrm2_1639669411830.
When passing the useOriginalUfNames parameter with the value Y, user fields will be returned with their original names, e.g., UF_CRM_2_1639669411830.

Error Handling

HTTP status: 400, 403

{
            "error": "INVALID_ARG_VALUE",
            "error_description": "Invalid filter: field 'FIELD' is not allowed in filter"
        }
        

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

Status

Code

Description

Value

403

allowed_only_intranet_user

Action allowed only for intranet users

User is not an intranet user

400

NOT_FOUND

Smart process not found

Occurs when an invalid entityTypeId is passed

400

INVALID_ARG_VALUE

Invalid filter: field 'field' is not allowed in filter

The field field passed in filter is not available for filtering

400

INVALID_ARG_VALUE

Invalid filter: field 'field' has invalid value

The value passed for the field field in filter is incorrect

400

INVALID_ARG_VALUE

Invalid order: field 'field' is not allowed in order

The field field passed in order is not available for sorting

400

INVALID_ARG_VALUE

Invalid order: allowed sort directions are ASC, DESC. But got 'orderValue' for field 'field'

The value orderValue passed for the field field in the order parameter is incorrect

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