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 /v1/lead/create/
Parameters
lead_typestring
Lead type. Possible values:straight— regular lead,selection— selection lead.
client_phonestring
Client phone number in E.164 format (numbers with or without the leading + are allowed), e.g.79001234567.
order_idint
Order ID in Liner. Value must be> 0.
order_codestring
Order code in Liner (string).
telegramIdint
Telegram user ID. Value must be> 0.
vkIdint
VK user ID. Value must be> 0.
instagramLoginstring
Instagram user login (string).
client_namestringoptional
Client name (string).
quiz_logstringoptional
Questionnaire comment/log.
campaign_idstringoptional
Ad campaign identifier (string).
external_idstringoptional
Lead identifier in an external system (string).
priorityintoptional
Lead priority in the call queue (integer).
utc_offsetintoptional
Client time zone — UTC offset, e.g.3,-5.
Request Example
curl -X POST "https://YOUR_LINER_API_HOST/v1/lead/create/" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_TOKEN" \
-d '{
"lead_type": "straight",
"client_name": "{{client_name}}",
"client_phone": "{{client_phone}}",
"order_id": {{order_id}},
"order_code": "{{order_code}}",
"quiz_log": "",
"campaign_id": "{{campaign_id}}",
"external_id": "{{external_id}}",
"priority": {{call_priority}},
"utc_offset": {{utc_offset}},
"telegramId": {{telegram_id}},
"vkId": {{vk_id}},
"instagramLogin": "{{instagram_login}}"
}'
<?php
$host = 'https://YOUR_LINER_API_HOST';
$token = 'YOUR_API_TOKEN';
$payload = [
'lead_type' => 'straight',
'client_name' => $client_name,
'client_phone' => $client_phone,
'order_id' => (int)$order_id,
'order_code' => $order_code,
'quiz_log' => '',
'campaign_id' => $campaign_id,
'external_id' => $external_id,
'priority' => (int)$call_priority,
'utc_offset' => (int)$utc_offset,
'telegramId' => (int)$telegram_id,
'vkId' => (int)$vk_id,
'instagramLogin' => $instagram_login,
];
$ch = curl_init($host . '/v1/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 = {
lead_type: "straight",
client_name: client_name,
client_phone: client_phone,
order_id: Number(order_id),
order_code: order_code,
quiz_log: "",
campaign_id: campaign_id,
external_id: external_id,
priority: Number(call_priority),
utc_offset: Number(utc_offset),
telegramId: Number(telegram_id),
vkId: Number(vk_id),
instagramLogin: instagram_login
};
const res = await fetch(`${host}/v1/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
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