Skip to content

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 /v1/lead/create-async/


Parameters

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

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

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

order_code string
Order code in Liner (string).

telegramId int
Telegram user ID. Value must be > 0.

vkId int
VK user ID. Value must be > 0.

instagramLogin string
Instagram user login (string).

client_name string optional
Client name (string).

quiz_log string optional
Questionnaire comment/log.

campaign_id string optional
Ad campaign identifier (string).

external_id string optional
Lead identifier in an external system (string).

priority int optional
Lead priority in the call queue (integer).

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


Request Example

curl -X POST "https://YOUR_LINER_API_HOST/v1/lead/create-async/" \
  -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-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 = {
  lead_type: "straight",
  client_name: client_name,
  client_phone: client_phone,
  order_id: Number(order_id),
  order_code: order_code,
  quiz_log: JSON.stringify({ "quiz_log_any_data:": "post anything here" }),
  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-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);

Response Example

{
  "success": true,
  "message": "",
  "data": []
}