Skip to content

Lead Update

Updates lead data in Liner.


Endpoint and Method

POST /v1/lead/update/{lead_id}/

lead_id int
Lead identifier in Liner. Value must be > 0.


Parameters (Body)

Send only the fields you want to update.

client_name string optional
Client name (string).

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

quiz_log string optional
Questionnaire comment/log (string; JSON string if needed).

campaign_id string optional
Ad campaign identifier (string).

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

status int optional
Lead status in Liner (integer).

call_timestamp int optional
Next call time (Unix timestamp, seconds).

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

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

telegramUserName string optional
Telegram username (string).

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

vkId int optional
VK user identifier. Value must be > 0.

instagramLogin string optional
Instagram user login (string).


Request Example

curl -X POST "https://YOUR_LINER_API_HOST/v1/lead/update/{{lead_id}}" \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_TOKEN" \
  -d '{
    "client_name": "{{client_name}}",
    "client_phone": "{{client_phone}}",
    "quiz_log": "",
    "campaign_id": "{{campaign_id}}",
    "external_id": "{{external_id}}",
    "status": {{lead_status}},
    "call_timestamp": {{call_timestamp}},
    "priority": {{call_priority}},
    "utc_offset": {{utc_offset}},
    "telegramUserName": "{{telegramUserName}}",
    "telegramPhone": "{{telegramPhone}}",
    "vkId": {{vk_id}},
    "instagramLogin": "{{instagram_login}}"
  }'
<?php

$host = 'https://YOUR_LINER_API_HOST';
$token = 'YOUR_API_TOKEN';
$leadId = (int)$lead_id;

// Important: fill only the fields you want to update
$payload = [
    'client_name' => $client_name,
    'client_phone' => $client_phone,
    'quiz_log' => '',
    'campaign_id' => $campaign_id,
    'external_id' => $external_id,
    'status' => isset($lead_status) ? (int)$lead_status : null,
    'call_timestamp' => isset($call_timestamp) ? (int)$call_timestamp : null,
    'priority' => isset($call_priority) ? (int)$call_priority : null,
    'utc_offset' => isset($utc_offset) ? (int)$utc_offset : null,
    'telegramUserName' => $telegramUserName,
    'telegramPhone' => $telegramPhone,
    'vkId' => isset($vk_id) ? (int)$vk_id : null,
    'instagramLogin' => $instagram_login,
];

// Remove null fields to avoid overwriting values by accident
$payload = array_filter($payload, fn($v) => $v !== null);

$ch = curl_init($host . '/v1/lead/update/' . $leadId);
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 leadId = Number(lead_id);

// Important: include only the fields you want to update
const payload = {
  client_name: client_name,
  client_phone: client_phone,
  quiz_log: "",
  campaign_id: campaign_id,
  external_id: external_id,
  status: lead_status != null ? Number(lead_status) : undefined,
  call_timestamp: call_timestamp != null ? Number(call_timestamp) : undefined,
  priority: call_priority != null ? Number(call_priority) : undefined,
  utc_offset: utc_offset != null ? Number(utc_offset) : undefined,
  telegramUserName: telegramUserName,
  telegramPhone: telegramPhone,
  vkId: vk_id != null ? Number(vk_id) : undefined,
  instagramLogin: instagram_login
};

// Remove undefined fields
Object.keys(payload).forEach((k) => payload[k] === undefined && delete payload[k]);

const res = await fetch(`${host}/v1/lead/update/${leadId}`, {
  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": []
}