Get Contact Fields crm.contact.fields

Scope: crm

Who can execute the method: any user

Method Development Stopped

The method crm.contact.fields continues to function, but there is a more relevant alternative crm.item.fields.

The method returns a description of contact fields, including custom fields.

No parameters required.

Code Examples

How to Use Examples in Documentation

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.contact.fields
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/crm.contact.fields
        
try
        {
        	const response = await $b24.callMethod(
        		'crm.contact.fields',
        		{}
        	);
        	
        	const result = response.getData().result;
        	console.info('Contact fields', result);
        }
        catch( error )
        {
        	console.error('Error:', error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'crm.contact.fields',
                    []
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            if ($result->error()) {
                error_log($result->error());
                echo 'Error: ' . $result->error();
            } else {
                echo 'Contact fields: ' . print_r($result->data(), true);
            }
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error fetching contact fields: ' . $e->getMessage();
        }
        
BX24.callMethod(
            "crm.contact.fields",
            {},
            (result) => {
                if(result.error())
                    console.error(result.error());
                else
                    console.info("Contact fields", result.data());
            }
        );    
        
require_once('crest.php');
        
        $result = CRest::call(
            'crm.contact.fields',
            []
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        

Response Handling

HTTP status: 200

{
            "result": {
                "ID": {
                "type": "integer",
                "isRequired": false,
                "isReadOnly": true,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "ID"
                },
                "HONORIFIC": {
                "type": "crm_status",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "statusType": "HONORIFIC",
                "title": "Salutation"
                },
                "NAME": {
                "type": "string",
                "isRequired": true,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "First Name"
                },
                "SECOND_NAME": {
                "type": "string",
                "isRequired": true,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Middle Name"
                },
                "LAST_NAME": {
                "type": "string",
                "isRequired": true,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Last Name"
                },
                "PHOTO": {
                "type": "file",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Photo"
                },
                "BIRTHDATE": {
                "type": "date",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Birthdate"
                },
                "TYPE_ID": {
                "type": "crm_status",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "statusType": "CONTACT_TYPE",
                "title": "Contact Type"
                },
                "SOURCE_ID": {
                "type": "crm_status",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "statusType": "SOURCE",
                "title": "Source"
                },
                "SOURCE_DESCRIPTION": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Additional Source Info"
                },
                "POST": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Position"
                },
                "ADDRESS": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Address"
                },
                "ADDRESS_2": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Address (line 2)"
                },
                "ADDRESS_CITY": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "City"
                },
                "ADDRESS_POSTAL_CODE": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Postal Code"
                },
                "ADDRESS_REGION": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Region"
                },
                "ADDRESS_PROVINCE": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "State"
                },
                "ADDRESS_COUNTRY": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Country"
                },
                "ADDRESS_COUNTRY_CODE": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Country Code"
                },
                "ADDRESS_LOC_ADDR_ID": {
                "type": "integer",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Location Address ID"
                },
                "COMMENTS": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Comment"
                },
                "OPENED": {
                "type": "char",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Available to all"
                },
                "EXPORT": {
                "type": "char",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Participates in contact export"
                },
                "HAS_PHONE": {
                "type": "char",
                "isRequired": false,
                "isReadOnly": true,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Phone set"
                },
                "HAS_EMAIL": {
                "type": "char",
                "isRequired": false,
                "isReadOnly": true,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "E-mail set"
                },
                "HAS_IMOL": {
                "type": "char",
                "isRequired": false,
                "isReadOnly": true,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Open channel set"
                },
                "ASSIGNED_BY_ID": {
                "type": "user",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Responsible"
                },
                "CREATED_BY_ID": {
                "type": "user",
                "isRequired": false,
                "isReadOnly": true,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Created by"
                },
                "MODIFY_BY_ID": {
                "type": "user",
                "isRequired": false,
                "isReadOnly": true,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Modified by"
                },
                "DATE_CREATE": {
                "type": "datetime",
                "isRequired": false,
                "isReadOnly": true,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Creation Date"
                },
                "DATE_MODIFY": {
                "type": "datetime",
                "isRequired": false,
                "isReadOnly": true,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Modification Date"
                },
                "COMPANY_ID": {
                "type": "crm_company",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "isDeprecated": true,
                "title": "Company"
                },
                "COMPANY_IDS": {
                "type": "crm_company",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": true,
                "isDynamic": false,
                "title": "COMPANY_IDS"
                },
                "LEAD_ID": {
                "type": "crm_lead",
                "isRequired": false,
                "isReadOnly": true,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Lead",
                "settings": {
                    "parentEntityTypeId": 1
                }
                },
                "ORIGINATOR_ID": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "External Source"
                },
                "ORIGIN_ID": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Identifier in External Source"
                },
                "ORIGIN_VERSION": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Original Version"
                },
                "UTM_SOURCE": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Advertising System"
                },
                "UTM_MEDIUM": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Traffic Type"
                },
                "UTM_CAMPAIGN": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Campaign Identifier"
                },
                "UTM_CONTENT": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Campaign Content"
                },
                "UTM_TERM": {
                "type": "string",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Campaign Search Condition"
                },
                "LAST_ACTIVITY_TIME": {
                "type": "datetime",
                "isRequired": false,
                "isReadOnly": true,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Last Activity"
                },
                "LAST_ACTIVITY_BY": {
                "type": "user",
                "isRequired": false,
                "isReadOnly": true,
                "isImmutable": false,
                "isMultiple": false,
                "isDynamic": false,
                "title": "Last Activity Author"
                },
                "PHONE": {
                "type": "crm_multifield",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": true,
                "isDynamic": false,
                "title": "Phone"
                },
                "EMAIL": {
                "type": "crm_multifield",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": true,
                "isDynamic": false,
                "title": "E-mail"
                },
                "WEB": {
                "type": "crm_multifield",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": true,
                "isDynamic": false,
                "title": "Website"
                },
                "IM": {
                "type": "crm_multifield",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": true,
                "isDynamic": false,
                "title": "Messenger"
                },
                "LINK": {
                "type": "crm_multifield",
                "isRequired": false,
                "isReadOnly": false,
                "isImmutable": false,
                "isMultiple": true,
                "isDynamic": false,
                "title": "LINK"
                }
            },
            "time": {
                "start": 1715004755.782705,
                "finish": 1715004756.118899,
                "duration": 0.3361940383911133,
                "processing": 0.10344505310058594,
                "date_start": "2024-05-06T17:12:35+03:00",
                "date_finish": "2024-05-06T17:12:36+03:00",
                "operating": 0
            }
        }
        

Returned Data

Name
type

Description

ID
integer

Contact identifier. Read-only

HONORIFIC
crm_status

Salutation.

You can get the values of the directory using the method crm.status.list with a filter by ENTITY_ID=HONORIFIC

NAME
string

First Name

SECOND_NAME
string

Middle Name

LAST_NAME
string

Last Name

PHOTO
file

Photo

BIRTHDATE
date

Birthdate

TYPE_ID
crm_status

Contact Type.

You can get the values of the directory using the method crm.status.list with a filter by ENTITY_ID=CONTACT_TYPE

SOURCE_ID
crm_status

Source.

You can get the values of the directory using the method crm.status.list with a filter by ENTITY_ID=SOURCE

SOURCE_DESCRIPTION
string

Additional Source Info

POST
string

Position

COMMENTS
string

Comment. Supports BB codes

OPENED
char

Available to all. Possible values:

  • Y — yes
  • N — no

Considered in the access permission work for roles with "All Open" access level

EXPORT
char

Participates in contact export. Possible values:

  • Y — yes
  • N — no

HAS_PHONE
char

Is phone set. Possible values:

  • Y — yes
  • N — no

Read-only

HAS_EMAIL
char

Is e-mail set. Possible values:

  • Y — yes
  • N — no

Read-only

HAS_IMOL
char

Is open channel set. Possible values:

  • Y — yes
  • N — no

Read-only

ASSIGNED_BY_ID
user

Responsible

CREATED_BY_ID
user

Created by. Read-only

MODIFY_BY_ID
user

Modified by. Read-only

DATE_CREATE
datetime

Creation Date. Read-only

DATE_MODIFY
datetime

Modification Date. Read-only

COMPANY_ID
crm_company

Main company of the contact

COMPANY_IDS
crm_company

Contact association with companies. Multiple.

In the methods crm.contact.update and crm.contact.add it is used to submit an array of companies.

In the methods crm.contact.list and crm.contact.get this field is not present and you need to use crm.contact.company.items.get to get the list of companies

LEAD_ID
crm_lead

Identifier of the lead associated with the contact. Read-only

UTM_SOURCE
string

Advertising system (Google Ads, etc.)

UTM_MEDIUM
string

Traffic type. Possible values:

  • CPC — ads
  • CPM — banners

UTM_CAMPAIGN
string

Campaign identifier

UTM_CONTENT
string

Campaign content. For example, for contextual ads

UTM_TERM
string

Campaign search condition. For example, keywords for contextual advertising

LAST_ACTIVITY_TIME
datetime

Last activity date in the timeline. Read-only

LAST_ACTIVITY_BY
user

Author of the last activity in the timeline. Read-only

PHONE
crm_multifield

Phones. Multiple

EMAIL
crm_multifield

E-mail. Multiple

WEB
crm_multifield

Websites. Multiple

IM
crm_multifield

Messengers. Multiple

LINK
crm_multifield

Links. Multiple. Service field.

UF_...

Custom fields. For example, UF_CRM_25534736.

Depending on the account settings, contacts may have a set of custom fields of defined types.

You can add a custom field to a contact using the method crm.contact.userfield.add

PARENT_ID_...

Relationship fields.

If there are smart processes related to contacts in the account, for each such smart process there is a field that stores the relationship between this smart process and the contact. The field itself stores the identifier of the element of that smart process.

For example, the field PARENT_ID_153 — relationship with the smart process entityTypeId=153. It stores the identifier of the element of this smart process associated with the current contact

Fields for External Data Sources

If the contact was created by an external system, then:

  • the field ORIGINATOR_ID stores the string identifier of that system
  • the field ORIGIN_ID stores the string identifier of the contact in that external system
  • the field ORIGIN_VERSION stores the version of the contact data in that external system

Name
type

Description

ORIGINATOR_ID
string

Identifier of the external system that is the source of data about this contact

ORIGIN_ID
string

Identifier of the contact in the external system

ORIGIN_VERSION
string

Version of the contact data in the external system.

Used to protect data from accidental overwriting by the external system.

If the data was imported and not changed in the external system, then such data can be edited in CRM without fear that the next export will lead to data overwriting

Deprecated Fields

Address fields in the contact are deprecated and are only used for compatibility mode. To work with the address, use requisites.

Name
type

Description

ADDRESS
string

Address

ADDRESS_2
string

Second line of address

ADDRESS_CITY
string

City

ADDRESS_POSTAL_CODE
string

Postal Code

ADDRESS_REGION
string

Region

ADDRESS_PROVINCE
string

State

ADDRESS_COUNTRY
string

Country

ADDRESS_COUNTRY_CODE
string

Country Code

ADDRESS_LOC_ADDR_ID
location

Location Address ID

Error Handling

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