Get Deal by Id crm.deal.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 deals

DEPRECATED

The development of this method has been halted. Please use crm.item.get.

The method crm.deal.get returns a deal by its identifier.

Method Parameters

Required parameters are marked with *

Name
type

Description

id*
integer

The identifier of the deal.

The identifier can be obtained using the methods crm.deal.list or crm.deal.add

Code Examples

How to Use Examples in Documentation

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"ID":410}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.deal.get
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"ID":410,"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/crm.deal.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 CrmDealResult = {
          ID: string
          TITLE: string
          TYPE_ID: string
          STAGE_ID: string
          CATEGORY_ID: string
          OPPORTUNITY: string
          CURRENCY_ID: string
          PROBABILITY: string
          COMPANY_ID: string
          CONTACT_ID: string
          ASSIGNED_BY_ID: string
          OPENED: string
          CLOSED: string
          BEGINDATE: ISODate | null
          CLOSEDATE: ISODate | null
          DATE_CREATE: ISODate | null
          DATE_MODIFY: ISODate | null
        }
        
        try {
          const response = await $b24.actions.v2.call.make<CrmDealResult>({
            method: 'crm.deal.get',
            params: {
              id: 410,
            },
            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('Deal:', result.ID, result.TITLE)
          }
        } 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 getDeal() {
            try {
              // Initialize the SDK inside a Bitrix24 frame
              const $b24 = await B24Js.initializeB24Frame()
        
              const response = await $b24.actions.v2.call.make({
                method: 'crm.deal.get',
                params: {
                  id: 410,
                },
                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('Deal:', result.ID, result.TITLE)
            } catch (error) {
              // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
              console.error(error)
            }
          }
        
          document.addEventListener('DOMContentLoaded', getDeal)
        </script>
        

        from b24pysdk.errors import BitrixAPIError, BitrixSDKException
        
        try:
            bitrix_response = client.crm.deal.get(bitrix_id=123).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 {
            $response = $b24Service
                ->core
                ->call(
                    'crm.deal.get',
                    [
                        'id' => 410,
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            if ($result->error()) {
                echo 'Error: ' . $result->error();
            } else {
                echo 'Deal data: ' . print_r($result->data(), true);
            }
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error getting deal: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'crm.deal.get',
            {
                id: 410,
            },
            (result) => {
                result.error()
                    ? console.error(result.error())
                    : console.info(result.data())
                ;
            },
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'crm.deal.get',
            [
                'ID' => 410
            ]
        );
        
        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.deal.get", b24.Params{
        	"id": 410,
        }, b24.WithIdempotent())
        if err != nil {
        	return fmt.Errorf("crm.deal.get: %w", err)
        }
        
        var item struct {
        	ID          b24.ID `json:"ID"`
        	Title       string `json:"TITLE"`
        	TypeID      string `json:"TYPE_ID"`
        	StageID     string `json:"STAGE_ID"`
        	Probability string `json:"PROBABILITY"`
        	CurrencyID  string `json:"CURRENCY_ID"`
        }
        if err := json.Unmarshal(res.Result, &item); err != nil {
        	return fmt.Errorf("parse response: %w", err)
        }
        fmt.Println(item.ID, item.Title)
        

Response Handling

HTTP Status: 200

{
            "result": {
                "ID": "410",
                "TITLE": "New Deal #1",
                "TYPE_ID": "COMPLEX",
                "STAGE_ID": "PREPARATION",
                "PROBABILITY": "99",
                "CURRENCY_ID": "EUR",
                "OPPORTUNITY": "1000000.00",
                "IS_MANUAL_OPPORTUNITY": "Y",
                "TAX_VALUE": "0.00",
                "LEAD_ID": null,
                "COMPANY_ID": "9",
                "CONTACT_ID": "84",
                "QUOTE_ID": null,
                "BEGINDATE": "2024-08-30T02:00:00+02:00",
                "CLOSEDATE": "2024-09-09T02:00:00+02:00",
                "ASSIGNED_BY_ID": "1",
                "CREATED_BY_ID": "1",
                "MODIFY_BY_ID": "1",
                "DATE_CREATE": "2024-08-30T14:29:00+02:00",
                "DATE_MODIFY": "2024-08-30T14:29:00+02:00",
                "OPENED": "Y",
                "CLOSED": "N",
                "COMMENTS": "[B]Example comment[\/B]",
                "ADDITIONAL_INFO": "Additional information",
                "LOCATION_ID": null,
                "CATEGORY_ID": "0",
                "STAGE_SEMANTIC_ID": "P",
                "IS_NEW": "N",
                "IS_RECURRING": "N",
                "IS_RETURN_CUSTOMER": "N",
                "IS_REPEATED_APPROACH": "N",
                "SOURCE_ID": "CALLBACK",
                "SOURCE_DESCRIPTION": "Additional source information",
                "ORIGINATOR_ID": null,
                "ORIGIN_ID": null,
                "MOVED_BY_ID": "1",
                "MOVED_TIME": "2024-08-30T14:29:00+02:00",
                "LAST_ACTIVITY_TIME": "2024-08-30T14:29:00+02:00",
                "UTM_SOURCE": "google",
                "UTM_MEDIUM": "CPC",
                "UTM_CAMPAIGN": null,
                "UTM_CONTENT": null,
                "UTM_TERM": null,
                "PARENT_ID_1220": "22",
                "LAST_ACTIVITY_BY": "1",
                "UF_CRM_1721244482250": "Hello world!"
            },
            "time": {
                "start": 1725020945.541275,
                "finish": 1725020946.179076,
                "duration": 0.637800931930542,
                "processing": 0.21427488327026367,
                "date_start": "2024-08-30T14:29:05+02:00",
                "date_finish": "2024-08-30T14:29:06+02:00",
                "operating": 0
            }
        }
        

Returned Data

Name
type

Description

result
deal

The root element of the response. Contains information about the deal fields. The structure is described below

time
time

Information about the request execution time

Deal Type

Name
type

Description

ID
integer

The identifier of the deal

TITLE
string

Title

TYPE_ID
crm_status

String identifier of the deal type.

To learn more about the obtained deal type, you can use the method crm.status.list by passing the filter:

{
            ENTITY_ID: 'DEAL_TYPE',
            STATUS_ID: TYPE_ID,
        }
        

CATEGORY_ID
crm_category

Sales Funnel. To learn more about this funnel, you can use the method crm.category.get by passing entityTypeId = 2 and id = CATEGORY_ID

STAGE_ID
crm_status

String identifier of the deal stage.

To learn more about the obtained stage, you can use the method crm.status.list by passing the filter:

{
            ENTITY_ID: entityId,
            STATUS_ID: statusId,
        }
        

where:

  • entityId is equal to:
    • DEAL_STAGE if the deal is in the general funnel (CATEGORY_ID = 0)
    • DEAL_STAGE_{categoryId}, where categoryId = CATEGORY_ID
  • statusId is equal to STAGE_ID

STAGE_SEMANTIC_ID
string

Stage group. Possible values:

  • P — in progress
  • S — successful
  • F — unsuccessful

IS_NEW
char

Indicates whether the deal is new. Possible values:

  • Y — yes
  • N — no

IS_RECURRING
char

Indicates whether the deal is recurring. Possible values:

  • Y — yes
  • N — no

IS_RETURN_CUSTOMER
char

Indicates whether the deal is a repeat. Possible values:

  • Y — yes
  • N — no

IS_REPEATED_APPROACH
char

Indicates whether the approach is repeated. Possible values:

  • Y — yes
  • N — no

PROBABILITY
integer

Probability, %

CURRENCY_ID
crm_currency

Currency

OPPORTUNITY
double

Amount

IS_MANUAL_OPPORTUNITY
char

Indicates whether manual mode for calculating the amount is enabled. Possible values:

  • Y — yes
  • N — no

TAX_VALUE
double

Tax rate

COMPANY_ID
crm_company

Identifier of the company.

To learn more about the company, you can use the method crm.item.get by passing entityTypeId = 4 and id = COMPANY_ID

CONTACT_ID
crm_contact

Identifier of the contact. Deprecated.

To get a list of all contacts associated with the deal, use the method crm.deal.contact.items.get or the universal method crm.item.get

QUOTE_ID
crm_quote

Identifier of the estimate based on which the deal was created.

To learn more about the estimate, you can use the method crm.item.get by passing entityTypeId = 7 and id = QUOTE_ID

BEGINDATE
date

Start date

CLOSEDATE
date

Close date

OPENED
char

Indicates whether the deal is available to everyone. Possible values:

  • Y — yes
  • N — no

CLOSED
char

Indicates whether the deal is closed. Possible values:

  • Y — yes
  • N — no

COMMENTS
string

Comment

ASSIGNED_BY_ID
user

Responsible person

CREATED_BY_ID
user

Created by

MODIFY_BY_ID
user

Modified by

MOVED_BY_ID
user

Identifier of the user who last changed the stage

DATE_CREATE
datetime

Creation date

DATE_MODIFY
datetime

Modification date

MOVED_TIME
datetime

Date of the last stage change

SOURCE_ID
crm_status

Source.

To learn more about the obtained source, you can use the method crm.status.list by passing the filter:

{
            ENTITY_ID: 'SOURCE',
            STATUS_ID: SOURCE_ID,
        }
        

SOURCE_DESCRIPTION
string

Additional information about the source

LEAD_ID
crm_lead

Identifier of the lead based on which the deal was created.

To learn more about the lead, you can use the method crm.item.get by passing entityTypeId = 1 and id = LEAD_ID

ADDITIONAL_INFO
string

Additional information

LOCATION_ID
location

Location. System field

ORIGINATOR_ID
string

External source

ORIGIN_ID
string

Identifier of the item in the external source

UTM_SOURCE
string

Advertising system

UTM_MEDIUM
string

Traffic type

UTM_CAMPAIGN
string

Advertising campaign designation

UTM_CONTENT
string

Campaign content

UTM_TERM
string

Campaign search term

LAST_ACTIVITY_TIME
datetime

Date of the last activity in the timeline

LAST_ACTIVITY_BY
user

Author of the last activity in the timeline

UF_CRM_...
any

Custom fields. For example, UF_CRM_25534736.

Depending on the portal settings, deals may have a set of custom fields of defined types. Read more in the section about custom fields

PARENT_ID_...
crm_entity

Relationship fields.

If there are smart processes associated with deals on the portal, there is a field for each such smart process that stores the relationship between this smart process and the deal. The field itself stores the identifier of the item of that smart process.

For example, the field PARENT_ID_153 — relationship with the smart process entityTypeId=153, stores the identifier of the item of this smart process associated with the current deal

Error Handling

HTTP Status: 400

{
            "error": "",
            "error_description": "Parameter 'fields' must be array."
        }
        

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

Code

Description

Value

Empty value

ID is not defined or invalid

The id parameter either has no value or is not a positive integer

Empty value

Access denied

The user does not have permission to "read" this deal

Empty value

Not found

No deal exists with the provided id

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