Skip to content

Lead Creation (Synchronous)

A synchronous method for creating a new Lead in Liner. If successful, it returns the identifier of the created Lead.

Recommendation

Use /lead/create/ only if it’s important to immediately get the Lead id and/or ensure that the lead is definitely created.
In all other cases, the asynchronous method is recommended: /lead/create-async/


Endpoint and Method

POST /v2/lead/create/


Parameters

leadType string
Lead type. Possible values: straight — regular lead, selection — selection lead.

phone string
Client phone number in E.164 format (numbers with or without the leading + are allowed), e.g. 79001234567.

orderId int
Order ID in Liner. Value must be > 0.

orderCode string
Order code in Liner.

telegramUserName string optional
Telegram username.

telegramPhone string optional
Telegram phone number (E.164 recommended).

vkId string optional
VK user ID. Value must be > 0.

instagramLogin string optional
Instagram user login.

name string optional
Client name.

sourceComment string optional
Questionnaire comment/log.

externalIdBitrix24 string optional
Lead identifier in Bitrix24 system.

externalIdAmo string optional
Lead identifier in AmoCRM system.

externalIdMacro string optional
Lead identifier in MacroCRM system.

externalIdDomoplaner string optional
Lead identifier in Domoplaner system.

priority int optional
Lead priority in the call queue.

utcOffset int optional
Client time zone — UTC offset, e.g. 3, -5.

statusId int optional
Lead status code, available only "in-progress" status category.

customValues object optional
Map of custom field values: key is the custom field ID, value is the value to be stored for that field.


Request Example

curl -X POST "https://YOUR_LINER_API_HOST/v2/lead/create/" \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_TOKEN" \
  -d '{
    "leadType": "straight",
    "name": "{{name}}",
    "phone": "{{phone}}",
    "orderId": {{orderId}},
    "orderCode": "{{orderCode}}",
    "sourceComment": "",
    "externalIdBitrix24": "{{externalIdBitrix24}}",
    "externalIdAmo": "{{externalIdAmo}}",
    "externalIdMacro": "{{externalIdMacro}}",
    "externalIdDomoplaner": "{{externalIdDomoplaner}}",
    "priority": {{callPriority}},
    "utcOffset": {{utcOffset}},
    "telegramUserName": {{telegramUserName}},
    "telegramPhone": {{telegramPhone}},
    "vkId": {{vkId}},
    "instagramLogin": "{{instagramLogin}}",
    "statusId": "{{statusId}}",
    "customValues": {
      "{{customFieldId}}": "{{customFieldValue}}"
    }
  }'
<?php

$host = 'https://YOUR_LINER_API_HOST';
$token = 'YOUR_API_TOKEN';

$payload = [
    'leadType' => 'straight',
    'name' => $name,
    'phone' => $phone,
    'orderId' => (int)$orderId,
    'orderCode' => $orderCode,
    'sourceComment' => '',
    'externalIdBitrix24' => $externalIdBitrix24,
    'externalIdAmo' => $externalIdAmo,
    'externalIdMacro' => $externalIdMacro,
    'externalIdDomoplaner' => $externalIdDomoplaner,
    'priority' => (int)$callPriority,
    'utcOffset' => (int)$utcOffset,
    'telegramUserName' => (int)$telegramUserName,
    'telegramPhone' => (int)$telegramPhone,
    'vkId' => $vkId,
    'instagramLogin' => $instagramLogin,
    'statusId' => $statusId,
    'customValues' => [
        $customFieldId => $customFieldValue,
    ],
];

$ch = curl_init($host . '/v2/lead/create/');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'X-Api-Key: ' . $token,
    ],
    CURLOPT_POSTFIELDS => json_encode($payload, JSON_UNESCAPED_UNICODE),
    CURLOPT_TIMEOUT => 15,
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($response === false) {
    throw new RuntimeException('cURL error: ' . curl_error($ch));
}

curl_close($ch);

echo "HTTP {$httpCode}\n";
echo $response;
const host = "https://YOUR_LINER_API_HOST";
const token = "YOUR_API_TOKEN";

const payload = {
  leadType: "straight",
  name: name,
  phone: phone,
  orderId: Number(orderId),
  orderCode: orderCode,
  sourceComment: "",
  externalIdBitrix24: externalIdBitrix24,
  externalIdAmo: externalIdAmo,
  externalIdMacro: externalIdMacro,
  externalIdDomoplaner: externalIdDomoplaner,
  priority: Number(callPriority),
  utcOffset: Number(utcOffset),
  telegramUserName: Number(telegramUserName),
  telegramPhone: Number(telegramPhone),
  vkId: vkId,
  instagramLogin: instagramLogin,
  statusId: statusId,
  customValues: {
    [customFieldId]: customFieldValue
  }
};

const res = await fetch(`${host}/v2/lead/create/`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Api-Key": token
  },
  body: JSON.stringify(payload)
});

const data = await res.json();
console.log("HTTP", res.status, data);

Response Example

{
  "success": true,
  "message": "",
  "data": {
    "id": 100200300
  }
}

Response Structure

Field Type Description
id int Identifier of the created Lead

Note

The structure of the data field is described above. For the overall API response format, see Request Schema