Update Order
Update order data in Liner.
Endpoint and method
POST /v2/order/update/{orderId}/
orderIdint
Order identifier in Liner. Value> 0.
Parameters (Body)
Send only the fields you want to update.
codestringoptional
Order code in Liner.
serviceTitlestringoptional
Internal order name.
titlestringoptional
Display name of the order.
callSchedulearrayoptional
A list where each item contains the start and end time of the working day.
callHolidayOverridesarrayoptional
List of holidays.
autoDialingEnabledbooloptional
Whether calls are allowed for the order.
predictiveModeEnabledbooloptional
Whether calls are allowed in predictive mode.
aiModeEnabledbooloptional
Whether AI calling is allowed.
standaloneAiModeEnabledbooloptional
AI processing without online agents.
aiModePromptstringoptional
Base prompt for the AI bot.
aiModeFirstPhrasestringoptional
First phrase for the AI bot.
aiDefaultLanguagestringoptional
Default language for AI. Available values:ru,gb.
amdDetectionEnabledbooloptional
Whether answering machine detection is enabled.
callRecordRulestringoptional
When to start call recording. Available values:client_is_connected,agent_is_connected.
callCenterPhonestringoptional
Main call center phone number.
additionalCallCenterPhonesarrayoptional
Additional call center phone numbers.
sipEndpointUsageSchemestringoptional
Number usage scheme. Available values:random_default,random_without_repetition,even_loaded,even_loaded_daily.
agentUserIdsarrayoptional
IDs of agents who can work in this order.
agentGroupIdsarrayoptional
IDs of agent groups who can work in this order.
showLeadContactsToAgentbooloptional
Whether agents can see lead contacts.
callAttemptsGroupIdintoptional
Call attempt intervals group ID.
qualifiedLeadsPerDayLimitintoptional
Maximum number of qualified leads per day.
callScenarioIdintoptional
Call scenario ID.
leadTransformEnabledbooloptional
Whether an agent is allowed to change the lead type.
leadsPriorityintoptional
Lead priority within the order.
statusstringoptional
Order status. Available values:success,secondary,info.
speechRecognitionEnabledbooloptional
Whether call recognition is enabled.
ignoreLeadTimezonebooloptional
Whether to ignore the client’s time zone.
sipEndpointIdsarrayoptional
List of virtual number identifiers.
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/order/update/{orderId}/" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_TOKEN" \
-d '{
"code": "{{code}}",
"serviceTitle": "{{serviceTitle}}",
"title": "{{title}}",
"status": "{{status}}",
"sipEndpointIds": [{{sipEndpointId}}, {{sipEndpointId2}}],
"callSchedule": [[{{start}}, {{end}}]],
"callHolidayOverrides": ["{{holiday}}"],
"autoDialingEnabled": {{autoDialingEnabled}},
"predictiveModeEnabled": {{predictiveModeEnabled}},
"aiModeEnabled": {{aiModeEnabled}},
"standaloneAiModeEnabled": {{standaloneAiModeEnabled}},
"aiModePrompt": "{{aiModePrompt}}",
"aiModeFirstPhrase": "{{aiModeFirstPhrase}}",
"aiDefaultLanguage": "{{aiDefaultLanguage}}",
"amdDetectionEnabled": {{amdDetectionEnabled}},
"callRecordRule": "{{callRecordRule}}",
"callCenterPhone": "{{callCenterPhone}}",
"additionalCallCenterPhones": ["{{additionalCallCenterPhone}}", ...],
"sipEndpointUsageScheme": "{{sipEndpointUsageScheme}}",
"agentUserIds": [{{agentUserId}}, ...],
"agentGroupIds": [{{agentGroupId}}, ...],
"showLeadContactsToAgent": {{showLeadContactsToAgent}},
"callAttemptsGroupId": {{callAttemptsGroupId}},
"qualifiedLeadsPerDayLimit": {{qualifiedLeadsPerDayLimit}},
"callScenarioId": {{callScenarioId}},
"leadTransformEnabled": {{leadTransformEnabled}},
"leadsPriority": {{leadsPriority}},
"speechRecognitionEnabled": {{speechRecognitionEnabled}},
"ignoreLeadTimezone": {{ignoreLeadTimezone}},
"customValues": {
"{{customFieldId}}": "{{customFieldValue}}"
}
}'
<?php
$host = 'https://YOUR_LINER_API_HOST';
$token = 'YOUR_API_TOKEN';
$orderId = (int)$orderId;
// Important: set only the fields you want to update
$payload = [
'code' => $code ?? null,
'serviceTitle' => $serviceTitle ?? null,
'title' => $title ?? null,
'status' => $status ?? null,
'sipEndpointIds' => $sipEndpointIds ?? null,
'callSchedule' => $callSchedule ?? null,
'callHolidayOverrides' => $callHolidayOverrides ?? null,
'autoDialingEnabled' => isset($autoDialingEnabled) ? (bool)$autoDialingEnabled : null,
'predictiveModeEnabled' => isset($predictiveModeEnabled) ? (bool)$predictiveModeEnabled : null,
'aiModeEnabled' => isset($aiModeEnabled) ? (bool)$aiModeEnabled : null,
'standaloneAiModeEnabled' => isset($standaloneAiModeEnabled) ? (bool)$standaloneAiModeEnabled : null,
'aiModePrompt' => $aiModePrompt ?? null,
'aiModeFirstPhrase' => $aiModeFirstPhrase ?? null,
'aiDefaultLanguage' => $aiDefaultLanguage ?? null,
'amdDetectionEnabled' => isset($amdDetectionEnabled) ? (bool)$amdDetectionEnabled : null,
'callRecordRule' => $callRecordRule ?? null,
'callCenterPhone' => $callCenterPhone ?? null,
'additionalCallCenterPhones' => $additionalCallCenterPhones ?? null,
'sipEndpointUsageScheme' => $sipEndpointUsageScheme ?? null,
'agentUserIds' => $agentUserIds ?? null,
'agentGroupIds' => $agentGroupIds ?? null,
'showLeadContactsToAgent' => isset($showLeadContactsToAgent) ? (bool)$showLeadContactsToAgent : null,
'callAttemptsGroupId' => isset($callAttemptsGroupId) ? (int)$callAttemptsGroupId : null,
'qualifiedLeadsPerDayLimit' => isset($qualifiedLeadsPerDayLimit) ? (int)$qualifiedLeadsPerDayLimit : null,
'callScenarioId' => isset($callScenarioId) ? (int)$callScenarioId : null,
'leadTransformEnabled' => isset($leadTransformEnabled) ? (bool)$leadTransformEnabled : null,
'leadsPriority' => isset($leadsPriority) ? (int)$leadsPriority : null,
'speechRecognitionEnabled' => isset($speechRecognitionEnabled) ? (bool)$speechRecognitionEnabled : null,
'ignoreLeadTimezone' => isset($ignoreLeadTimezone) ? (bool)$ignoreLeadTimezone : null,
'customValues' => [
$customFieldId => isset($customFieldValue) ? $customFieldValue : null,
],
];
// Remove null fields to avoid overwriting values accidentally
$payload = array_filter($payload, fn($v) => $v !== null);
$ch = curl_init($host . '/v2/order/update/' . $orderId . '/');
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 orderId = Number(orderId);
// Important: add only the fields you want to update
const payload = {
code: code,
serviceTitle: serviceTitle,
title: title,
status: status,
sipEndpointIds: sipEndpointIds,
callSchedule: callSchedule,
callHolidayOverrides: callHolidayOverrides,
autoDialingEnabled: autoDialingEnabled != null ? Boolean(autoDialingEnabled) : undefined,
predictiveModeEnabled: predictiveModeEnabled != null ? Boolean(predictiveModeEnabled) : undefined,
aiModeEnabled: aiModeEnabled != null ? Boolean(aiModeEnabled) : undefined,
standaloneAiModeEnabled: standaloneAiModeEnabled != null ? Boolean(standaloneAiModeEnabled) : undefined,
aiModePrompt: aiModePrompt ?? undefined,
aiModeFirstPhrase: aiModeFirstPhrase ?? undefined,
aiDefaultLanguage: aiDefaultLanguage ?? undefined,
amdDetectionEnabled: amdDetectionEnabled != null ? Boolean(amdDetectionEnabled) : undefined,
callRecordRule: callRecordRule ?? undefined,
callCenterPhone: callCenterPhone ?? undefined,
additionalCallCenterPhones: additionalCallCenterPhones ?? undefined,
sipEndpointUsageScheme: sipEndpointUsageScheme ?? undefined,
agentUserIds: agentUserIds ?? undefined,
agentGroupIds: agentGroupIds ?? undefined,
showLeadContactsToAgent: showLeadContactsToAgent != null ? Boolean(showLeadContactsToAgent) : undefined,
callAttemptsGroupId: callAttemptsGroupId != null ? Number(callAttemptsGroupId) : undefined,
qualifiedLeadsPerDayLimit: qualifiedLeadsPerDayLimit != null ? Number(qualifiedLeadsPerDayLimit) : undefined,
callScenarioId: callScenarioId != null ? Number(callScenarioId) : undefined,
leadTransformEnabled: leadTransformEnabled != null ? Boolean(leadTransformEnabled) : undefined,
leadsPriority: leadsPriority != null ? Number(leadsPriority) : undefined,
speechRecognitionEnabled: speechRecognitionEnabled != null ? Boolean(speechRecognitionEnabled) : undefined,
ignoreLeadTimezone: ignoreLeadTimezone != null ? Boolean(ignoreLeadTimezone) : undefined,
customValues: {
[customFieldId]: customFieldValue != null ? customFieldValue : undefined,
}
};
// Remove undefined fields
Object.keys(payload).forEach((k) => payload[k] === undefined && delete payload[k]);
const res = await fetch(`${host}/v2/order/update/${orderId}/`, {
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
Note
The structure of the data field is described above. For the overall API response format, see Request Schema