Get Element by Id crm.item.get

Choose a tool for developing with an AI agent:

  • use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
  • use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation

Scope: crm

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

This method returns information about an entity based on its identifier and the identifier of the CRM object type.

Method Parameters

Required parameters are marked with *

Name
type

Description

entityTypeId*
integer

Identifier of the system or custom type whose element we want to retrieve.

Numeric values for system types (Lead — 1, Deal — 2, Contact — 3, Company — 4, Invoice — 31, etc.) are listed in the CRM object types reference. The identifier for a smart process can be obtained using the crm.type.list method.

id*
integer

Identifier of the element whose information we want to retrieve.

This can be obtained using the crm.item.list method or when creating an element with the crm.item.add method.

useOriginalUfNames
boolean

This parameter controls the format of custom field names in the response.
Possible values:

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

Default is N

Code Examples

How to Use Examples in Documentation

Retrieve information about a lead with id = 250

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"entityTypeId":1,"id":250,"useOriginalUfNames":"N"}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.item.get
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"entityTypeId":1,"id":250,"useOriginalUfNames":"N","auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/crm.item.get
        
// This snippet is an ES module: top-level await requires type="module" or a bundler.
        // $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
        import { Text } from '@bitrix24/b24jssdk'
        import type { B24Frame, ISODate } from '@bitrix24/b24jssdk'
        
        declare const $b24: B24Frame
        
        // Shape of the payload returned in result (match the "response handling" section of the page)
        type CrmItemGetResult = {
          item: {
            id: number
            createdTime: ISODate
            updatedTime: ISODate
            createdBy: number
            updatedBy: number
            assignedById: number
            opened: string
            stageId: string
            stageSemanticId: string
            opportunity: number
            currencyId: string
            sourceId: string
            title: string
            name: string
            lastName: string
            movedBy: number
            movedTime: ISODate
            lastActivityBy: number
            lastActivityTime: ISODate
            email: string
            phone: string
            fm: Array<{
              id: number
              valueType: string
              value: string
              typeId: string
            }>
            observers: number[]
            contactIds: number[]
            entityTypeId: number
          }
        }
        
        try {
          const response = await $b24.actions.v2.call.make<CrmItemGetResult>({
            method: 'crm.item.get',
            params: {
              entityTypeId: 1,
              id: 250,
              useOriginalUfNames: 'N',
            },
            requestId: Text.getUuidRfc4122()
          })
        
          // The payload is available only on a successful response
          if (!response.isSuccess) {
            console.error(response.getErrorMessages().join('; '))
          } else {
            const result = response.getData()!.result
            console.info('Item:', result.item.id, result.item.title, result.item.entityTypeId)
          }
        } catch (error) {
          // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
          console.error(error)
        }
        
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
        <script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
        <script>
          async function fetchCrmItem() {
            try {
              // Initialize the SDK inside a Bitrix24 frame
              const $b24 = await B24Js.initializeB24Frame()
        
              const response = await $b24.actions.v2.call.make({
                method: 'crm.item.get',
                params: {
                  entityTypeId: 1,
                  id: 250,
                  useOriginalUfNames: 'N',
                },
                requestId: B24Js.Text.getUuidRfc4122()
              })
        
              // The payload is available only on a successful response
              if (!response.isSuccess) {
                console.error(response.getErrorMessages().join('; '))
                return
              }
        
              const result = response.getData().result
              console.info('Item:', result.item.id, result.item.title, result.item.entityTypeId)
            } catch (error) {
              // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
              console.error(error)
            }
          }
        
          document.addEventListener('DOMContentLoaded', fetchCrmItem)
        </script>
        

        from b24pysdk.errors import BitrixAPIError, BitrixSDKException
        
        try:
            bitrix_response = client.crm.item.get(
                entity_type_id=1,
                bitrix_id=250,
                use_original_uf_names=False,
            ).response
            result = bitrix_response.result
            print(result)
        except BitrixAPIError as error:
            print(
                "Bitrix API Error",
                f"error: {error.error}",
                f"error_description: {error.error_description}",
                sep="\n",
            )
        except BitrixSDKException as error:
            print(f"Bitrix SDK Error: {error.message}")
        except Exception as error:
            print(f"Unexpected error: {error}")
        
try {
            $entityTypeId = 1; // Example entity type ID
            $id = 123; // Example item ID
            $itemResult = $serviceBuilder
                ->getCRMScope()
                ->item()
                ->get($entityTypeId, $id);
            $item = $itemResult->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("Moved By: " . $item->movedBy . PHP_EOL);
            print("Created Time: " . $item->createdTime->format(DATE_ATOM) . PHP_EOL);
            print("Updated Time: " . $item->updatedTime->format(DATE_ATOM) . PHP_EOL);
            print("Moved Time: " . $item->movedTime->format(DATE_ATOM) . PHP_EOL);
            print("Category ID: " . $item->categoryId . PHP_EOL);
            print("Opened: " . ($item->opened ? 'true' : 'false') . PHP_EOL);
            print("Previous Stage ID: " . $item->previousStageId . PHP_EOL);
            print("Begin Date: " . $item->begindate->format(DATE_ATOM) . PHP_EOL);
            print("Close Date: " . $item->closedate->format(DATE_ATOM) . PHP_EOL);
            print("Company ID: " . $item->companyId . PHP_EOL);
            print("Contact ID: " . $item->contactId . PHP_EOL);
            print("Opportunity: " . $item->opportunity . PHP_EOL);
            print("Is Manual Opportunity: " . ($item->isManualOpportunity ? 'true' : 'false') . PHP_EOL);
            print("Tax Value: " . $item->taxValue . PHP_EOL);
            print("Currency ID: " . $item->currencyId . PHP_EOL);
            print("Opportunity Account: " . $item->opportunityAccount . PHP_EOL);
            print("Tax Value Account: " . $item->taxValueAccount . PHP_EOL);
            print("Account Currency ID: " . $item->accountCurrencyId . PHP_EOL);
            print("My Company ID: " . $item->mycompanyId . PHP_EOL);
            print("Source ID: " . $item->sourceId . PHP_EOL);
            print("Source Description: " . $item->sourceDescription . PHP_EOL);
            print("Webform ID: " . $item->webformId . PHP_EOL);
            print("Assigned By ID: " . $item->assignedById . PHP_EOL);
            print("Last Activity By: " . $item->lastActivityBy . PHP_EOL);
            print("Last Activity Time: " . $item->lastActivityTime->format(DATE_ATOM) . PHP_EOL);
            print("UTM Source: " . $item->utmSource . PHP_EOL);
            print("UTM Medium: " . $item->utmMedium . PHP_EOL);
            print("UTM Campaign: " . $item->utmCampaign . PHP_EOL);
            print("UTM Content: " . $item->utmContent . PHP_EOL);
            print("UTM Term: " . $item->utmTerm . PHP_EOL);
            print("Observers: " . json_encode($item->observers) . PHP_EOL);
            print("Contact IDs: " . json_encode($item->contactIds) . PHP_EOL);
            print("Entity Type ID: " . $item->entityTypeId . PHP_EOL);
        } catch (Throwable $e) {
            print("Error: " . $e->getMessage() . PHP_EOL);
        }
        
    BX24.callMethod(
                'crm.item.get',
                {
                    entityTypeId: 1,
                    id: 250,
                    useOriginalUfNames: 'N',
                },
                (result) => {
                    if (result.error())
                    {
                        console.error(result.error());
        
                        return;
                    }
        
                    console.info(result.data());
                },
            );
        
require_once('crest.php');
        
        $result = CRest::call(
            'crm.item.get',
            [
                'entityTypeId' => 1,
                'id' => 250,
                'useOriginalUfNames' => 'N',
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        
// client and ctx are already created — see the Go SDK section
        res, err := client.Core().Call(ctx, "crm.item.get", b24.Params{
        	"entityTypeId":       1,
        	"id":                 250,
        	"useOriginalUfNames": "N",
        }, b24.WithIdempotent())
        if err != nil {
        	return fmt.Errorf("crm.item.get: %w", err)
        }
        
        // The method wraps the response in an object with the "item" key.
        raw, ok := b24.Unwrap(res.Result, "item")
        if !ok {
        	return fmt.Errorf("no item key in the response")
        }
        
        var item struct {
        	ID           b24.ID `json:"id"`
        	CreatedTime  string `json:"createdTime"`
        	UpdatedTime  string `json:"updatedTime"`
        	CreatedBy    int    `json:"createdBy"`
        	UpdatedBy    int    `json:"updatedBy"`
        	AssignedByID b24.ID `json:"assignedById"`
        }
        if err := json.Unmarshal(raw, &item); err != nil {
        	return fmt.Errorf("parse response: %w", err)
        }
        fmt.Println(item.ID, item.CreatedTime)
        

Response Handling

HTTP status: 200

{
            "result": {
                "item": {
                    "id": 250,
                    "createdTime": "2024-07-22T18:00:08+02:00",
                    "dateCreateShort": null,
                    "updatedTime": "2024-07-22T18:00:08+02:00",
                    "dateModifyShort": null,
                    "createdBy": 1,
                    "updatedBy": 1,
                    "assignedById": 1,
                    "opened": "Y",
                    "companyId": 0,
                    "contactId": 0,
                    "stageId": "IN_PROCESS",
                    "isConvert": null,
                    "statusDescription": null,
                    "stageSemanticId": "P",
                    "productId": null,
                    "opportunity": 999.9,
                    "currencyId": "USD",
                    "sourceId": "TRADE_SHOW",
                    "sourceDescription": "Exhibition about admins",
                    "title": "Lead #250",
                    "name": "Admin",
                    "lastName": "Admins",
                    "secondName": "Admin",
                    "shortName": null,
                    "companyTitle": "Administrative Company",
                    "post": "Admin",
                    "address": null,
                    "comments": "[B]Comment about admin[/B]",
                    "webformId": 0,
                    "originatorId": null,
                    "originId": null,
                    "dateClosed": null,
                    "birthdate": "2000-01-01T02:00:00+02:00",
                    "honorific": "UC_N1LWUS",
                    "hasPhone": "Y",
                    "hasEmail": "Y",
                    "hasImol": "N",
                    "login": null,
                    "isReturnCustomer": "N",
                    "searchContent": "250 Lead #250 Admins Admin Admin Administrative Company 999.90 US Dollar 6111111111 111111111 11111111 1111111 111111 11111 1111 111 nqzva rknzcyr pbz In progress Exhibition Exhibition about admins g Admin [O]Comment about admin[/O] 321",
                    "isManualOpportunity": "Y",
                    "movedBy": 1,
                    "movedTime": "2024-07-22T17:00:08+02:00",
                    "lastActivityBy": 1,
                    "lastActivityTime": "2024-07-22T17:00:08+02:00",
                    "phoneMobile": "",
                    "phoneWork": "+6111111111",
                    "phoneMailing": "",
                    "emailHome": "",
                    "emailWork": "admin@example.com",
                    "emailMailing": "",
                    "skype": null,
                    "icq": null,
                    "imol": "",
                    "email": "admin@example.com",
                    "phone": "+6111111111",
                    "fm": [
                        {
                            "id": 101,
                            "valueType": "WORK",
                            "value": "+6111111111",
                            "typeId": "PHONE"
                        },
                        {
                            "id": 102,
                            "valueType": "WORK",
                            "value": "admin@example.com",
                            "typeId": "EMAIL"
                        }
                    ],
                    "ufCrm_1720019876534": "321",
                    "parentId1222": null,
                    "parentId1226": null,
                    "parentId1228": null,
                    "parentId1236": null,
                    "parentId1238": null,
                    "parentId1240": null,
                    "parentId1244": null,
                    "parentId1246": null,
                    "parentId1254": null,
                    "parentId1256": null,
                    "utmSource": null,
                    "utmMedium": null,
                    "utmCampaign": null,
                    "utmContent": null,
                    "utmTerm": null,
                    "observers": [],
                    "contactIds": [],
                    "entityTypeId": 1
                }
            },
            "time": {
                "start": 1721660468.931424,
                "finish": 1721660469.416092,
                "duration": 0.4846680164337158,
                "processing": 0.16368508338928223,
                "date_start": "2024-07-22T17:01:08+02:00",
                "date_finish": "2024-07-22T17:01:09+02:00",
                "operating": 0
            }
        }
        

Returned Data

Name
type

Description

result
object

The root element of the response. Contains a single key item

item
item

Information about the entity, field description

time
time

Object containing information about the request execution time

The response contains the fm field — an array of all system multiple fields (phone, e-mail, and others) in a structured format. Each array item contains:

  • id — the record identifier (required for updating or deleting via crm.item.update)
  • typeId — the field type: PHONE, EMAIL, WEB, IM
  • valueType — the value subtype: WORK, MOBILE, HOME, MAILING, OTHER
  • value — the value

The phoneWork, phoneMobile, emailWork fields and similar ones are flat aliases for convenient access to the first value of the corresponding type from fm. They do not replace fm and do not allow managing multiple values of the same type.

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

Error Handling

HTTP status: 400, 403

{
            "error": "NOT_FOUND",
            "error_description": "Element not found"
        }
        

Name
type

Description

error
string

String error code. It consists of digits, Latin letters, and underscores. It may arrive empty — in that case only error_description shows the reason

error_description
string

Error message for the developer. Do not show it to the end user without processing

Possible Error Codes

Status

Code

Description

Value

403

allowed_only_intranet_user

Action is allowed only to intranet users

User is not an intranet user

400

NOT_FOUND

SPA not found

Occurs when an invalid entityTypeId is passed

400

NOT_FOUND

Item not found

An item with the given id of type entityTypeId does not exist.

400

ACCESS_DENIED

You do not have permission to view this item

User does not have read access permission for elements of type entityTypeId

Statuses and System Error Codes

HTTP Status: 4xx, 5xx

The errors described below are returned by the REST API itself, not by the logic of a specific method. They can arrive in response to any method.

Status

Code
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

The server returned an unexpected response. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

429

OPERATION_TIME_LIMIT
Method is blocked due to operation time limit

The method is blocked because the request resource intensity limit has been exceeded. The block is lifted automatically once the accumulated execution time of the method no longer exceeds the limit

401

NO_AUTH_FOUND
Wrong authorization data

The request contains no authorization data: neither an access token nor a webhook code was passed

401

INVALID_REQUEST
Https required

Methods are called over the HTTPS protocol only

401

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block. To have it lifted, contact Bitrix24 technical support

401

ACCESS_DENIED
REST is available only on commercial plans

REST API access is not active for this account. In Bitrix24 Cloud, check the current plan or trial status: Vibe+ plans include REST API access, while Essentials plans do not. A webhook receives a different error message — REST is available only by subscription

401

INVALID_CREDENTIALS
Invalid request credentials

No active webhook with the specified user identifier and secret code was found

404

ERROR_METHOD_NOT_FOUND
Method not found!

No method with this name was found. The name is misspelled, the method does not exist in the REST API, or it is unavailable without the required scope

401

insufficient_scope
The request requires higher privileges than provided by the webhook token

The request requires broader permissions than the token has: for a webhook these are the permissions granted to it, for an application it is the scope. For an application, the error message ends with provided by the access token

401

expired_token
The access token provided has expired

The access token has expired

401

user_access_error
The user does not have access to the application

The application is installed, but the Bitrix24 administrator has granted access to it only to specific users

403

PORTAL_DELETED
Portal was deleted

The public part of the site is closed. To open it on an on-premise installation, disable the "Temporary closure of the public part of the site" option. Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site

Continue Learning