Lead Creation (Asynchronous)
An asynchronous method for creating a new Lead in Liner. It returns the status of whether the job was accepted for processing (without guaranteeing that the lead is actually created).
Recommendation
This method does not guarantee successful lead creation — it only returns the status of accepting the creation job.
If you need a guaranteed lead creation and an id, use the synchronous method: /lead/create/
Endpoint and Method
POST /v2/lead/create-async/
Parameters
leadTypestring
Lead type. Possible values:straight— regular lead,selection— selection lead.
phonestring
Client phone number in E.164 format (numbers with or without the leading + are allowed), e.g.79001234567.
orderIdint
Order ID in Liner. Value must be> 0.
orderCodestring
Order code in Liner.
telegramUserNamestringoptional
Telegram username.
telegramPhonestringoptional
Telegram phone number (E.164 recommended).
vkIdstringoptional
VK user ID. Value must be> 0.
instagramLoginstringoptional
Instagram user login.
namestringoptional
Client name.
sourceCommentstringoptional
Questionnaire comment/log.
externalIdBitrix24stringoptional
Lead identifier in Bitrix24 system.
externalIdAmostringoptional
Lead identifier in AmoCRM system.
externalIdMacrostringoptional
Lead identifier in MacroCRM system.
externalIdDomoplanerstringoptional
Lead identifier in Domoplaner system.
priorityintoptional
Lead priority in the call queue.
utcOffsetintoptional
Client time zone — UTC offset, e.g.3,-5.
statusIdintoptional
Lead status status, available only "in-progress" status category.
customValuesobjectoptional
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-async/" \
-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-async/');
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-async/`, {
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);