---
sidebar_position: 1
description: Create lead 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 lead
 Creates a new lead by fields structure



`Function CreateLead(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; | Lead fields structure. See GetLeadStructure |
  | 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.lead.add](https://dev.1c-bitrix.ru/rest_help/crm/leads/crm_lead_add.php)
:::
<br/>


```bsl title="1C:Enterprise/OneScript code example"
    EmailsArray = New Array;
    EmailsArray.Add(New Structure("VALUE,VALUE_TYPE", "yo@example.com", "HOME"));
    EmailsArray.Add(New Structure("VALUE,VALUE_TYPE", "hi@example.com", "WORK"));

    PhonesArray = New Array;
    PhonesArray.Add(New Structure("VALUE,VALUE_TYPE", "88005553535", "WORK"));

    FieldsStructure = New Structure;
    FieldsStructure.Insert("ADDRESS"        , "Pushkin st., b. 10");
    FieldsStructure.Insert("ADDRESS_COUNTRY", "Russia");
    FieldsStructure.Insert("EMAIL"          , EmailsArray);
    FieldsStructure.Insert("NAME"           , "John");
    FieldsStructure.Insert("LAST_NAME"      , "Doe");
    FieldsStructure.Insert("PHONE"          , PhonesArray);
    FieldsStructure.Insert("TITLE"          , "MegaClient");

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

    Result = OPI_Bitrix24.CreateLead(URL, FieldsStructure);

    FieldsStructure.Insert("NAME"     , "Ivan");
    FieldsStructure.Insert("LAST_NAME", "Ivanov");

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

    Result = OPI_Bitrix24.CreateLead(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 CreateLead \
             --url "b24-ar17wx.bitrix24.by" \
             --fields "{'ADDRESS':'Pushkin st., b. 10','ADDRESS_COUNTRY':'Russia','EMAIL':[{'VALUE':'yo@example.com','VALUE_TYPE':'HOME'},{'VALUE':'hi@example.com','VALUE_TYPE':'WORK'}],'NAME':'Ivan','LAST_NAME':'Ivanov','PHONE':[{'VALUE':'88005553535','VALUE_TYPE':'WORK'}],'TITLE':'MegaClient'}" \
             --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 CreateLead ^
             --url "b24-ar17wx.bitrix24.by" ^
             --fields "{'ADDRESS':'Pushkin st., b. 10','ADDRESS_COUNTRY':'Russia','EMAIL':[{'VALUE':'yo@example.com','VALUE_TYPE':'HOME'},{'VALUE':'hi@example.com','VALUE_TYPE':'WORK'}],'NAME':'Ivan','LAST_NAME':'Ivanov','PHONE':[{'VALUE':'88005553535','VALUE_TYPE':'WORK'}],'TITLE':'MegaClient'}" ^
             --token "***"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "result": 2878,
 "time": {
  "start": 1765396927,
  "finish": 1765396927.8821,
  "duration": 0.88210391998291,
  "processing": 0,
  "date_start": "2025-12-10T20:02:07+00:00",
  "date_finish": "2025-12-10T20:02:07+00:00",
  "operating_reset_at": 1765397527,
  "operating": 0.659426927566528
 }
}
```
