---
sidebar_position: 1
description: Create deal and other functions to work with Bitrix24 in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Bitrix24]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Create deal
 Creates a new deal by field structure



`Function CreateDeal(Val URL, Val FieldsStructure, Val Token = "") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | URL | --url | String | &#x2714; | URL of webhook or a Bitrix24 domain, when token used |
  | FieldsStructure | --fields | Structure Of KeyAndValue | &#x2714; | Deal fields structure. See. GetDealStructure |
  | Token | --token | String | &#x2716; | Access token, when app auth method used |

  
  Returns:  Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API

:::tip
Method at API documentation: [crm.deal.add](https://dev.1c-bitrix.ru/rest_help/crm/cdeals/crm_deal_add.php)
:::
<br/>


```bsl title="1C:Enterprise/OneScript code example"
    FieldsStructure = New Structure;
    FieldsStructure.Insert("TITLE"         , "Planned sale");
    FieldsStructure.Insert("TYPE_ID"       , "GOODS");
    FieldsStructure.Insert("STAGE_ID"      , "NEW");
    FieldsStructure.Insert("COMPANY_ID"    , 1);
    FieldsStructure.Insert("CONTACT_ID"    , 3);
    FieldsStructure.Insert("OPENED"        , "Y");
    FieldsStructure.Insert("ASSIGNED_BY_ID", 1);
    FieldsStructure.Insert("PROBABILITY"   , 30);
    FieldsStructure.Insert("CURRENCY_ID"   , "USD");
    FieldsStructure.Insert("OPPORTUNITY"   , 5000);
    FieldsStructure.Insert("CATEGORY_ID"   , 5);
    FieldsStructure.Insert("BEGINDATE"     , "2024-01-01");
    FieldsStructure.Insert("CLOSEDATE"     , "2030-01-01");

    URL = "https://b24-ar17wx.bitrix24.by/rest/1/h0m...";

    Result = OPI_Bitrix24.CreateDeal(URL, FieldsStructure);

    FieldsStructure.Insert("TITLE"    , "Another deal");
    FieldsStructure.Insert("CLOSEDATE", "2031-01-01");

    URL   = "b24-ar17wx.bitrix24.by";
    Token = "6ad03969006e9f06006b12e400000001000...";

    Result = OPI_Bitrix24.CreateDeal(URL, FieldsStructure, Token);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint bitrix24 CreateDeal \
             --url "b24-ar17wx.bitrix24.by" \
             --fields "{'TITLE':'Another deal','TYPE_ID':'GOODS','STAGE_ID':'NEW','COMPANY_ID':'1','CONTACT_ID':'3','OPENED':'Y','ASSIGNED_BY_ID':'1','PROBABILITY':'30','CURRENCY_ID':'USD','OPPORTUNITY':'5000','CATEGORY_ID':'5','BEGINDATE':'2024-01-01','CLOSEDATE':'2031-01-01'}" \
             --token "***"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: JSON data can also be passed as a path to a .json file
            
            oint bitrix24 CreateDeal ^
             --url "b24-ar17wx.bitrix24.by" ^
             --fields "{'TITLE':'Another deal','TYPE_ID':'GOODS','STAGE_ID':'NEW','COMPANY_ID':'1','CONTACT_ID':'3','OPENED':'Y','ASSIGNED_BY_ID':'1','PROBABILITY':'30','CURRENCY_ID':'USD','OPPORTUNITY':'5000','CATEGORY_ID':'5','BEGINDATE':'2024-01-01','CLOSEDATE':'2031-01-01'}" ^
             --token "***"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "result": 5746,
 "time": {
  "start": 1765396959,
  "finish": 1765396959.53886,
  "duration": 0.538855075836182,
  "processing": 0,
  "date_start": "2025-12-10T20:02:39+00:00",
  "date_finish": "2025-12-10T20:02:39+00:00",
  "operating_reset_at": 1765397559,
  "operating": 0.303427934646606
 }
}
```
