Skip to content

Create Order

Synchronous method for creating a new Order in Liner. On success, returns the identifier of the created Order.


Endpoint and method

POST /v2/order/create/


Parameters

serviceTitle string
Internal order name.

title string
Display name of the order.

status string
Order status. Available values: success, secondary, info.

sipEndpointIds array
List of virtual number identifiers (int). Must not be empty.

code string optional
Order code in Liner. Allowed characters: a-z, 0-9, -, _. Must be unique. Generated from title when omitted.

callSchedule array optional
Call schedule: up to 7 items, the item position is the weekday (Mon → Sun). An item is ["HH:MM", "HH:MM"] (start and end of the working day) or [] for a day off.

callHolidayOverrides array optional
List of holidays (string). Any parsable date format is accepted; stored and returned in dd.mm.yyyy format.

autoDialingEnabled bool optional
Whether calls are allowed for the order.

predictiveModeEnabled bool optional
Whether calls are allowed in predictive mode.

aiDefaultLanguage string optional
Default language for AI. A code of one of the available languages, e.g. ru, gb.

amdDetectionEnabled bool optional
Whether answering machine detection is enabled.

callRecordRule string optional
When to start call recording. Available values: client_is_connected, agent_is_connected.

sipEndpointUsageScheme string optional
Number usage scheme. Available values: random_default, random_without_repetition, even_loaded, even_loaded_daily.

agentUserIds array optional
IDs (int) of agents who can work in this order.

agentGroupIds array optional
IDs (int) of agent groups who can work in this order.

showLeadContactsToAgent bool optional
Whether agents can see lead contacts.

callAttemptGroupId int optional
Call attempt intervals group ID. Value >= 1.

qualifiedLeadsPerDayLimit int optional
Maximum number of qualified leads per day. Value >= 1.

callScenarioId int optional
Call scenario ID. Value >= 1.

leadTransformEnabled bool optional
Whether an agent is allowed to change the lead type.

speechRecognitionEnabled bool optional
Whether call recognition is enabled.

ignoreLeadTimezone bool optional
Whether to ignore the client’s time zone.

customValues array optional
Map of custom field values: key is the custom field ID, value is the value to be stored for that field. The field must exist and belong to orders, and the value must match the field type (for a multiselect — a comma-separated string).

transferNumbers array optional
Call transfer numbers. Each item is an object: number (string, required, no spaces) and names (object, optional: key is a language code, value is the name).

autoProcessCall bool optional
Whether the call is processed automatically.

agentLeadCreationIsAllowed bool optional
Whether an agent is allowed to create leads.

agentLeadEditMode string optional
Lead editing mode for agents, e.g. during-call.

Note

Unknown fields in the request body are ignored. The createdAt, updatedAt, createdBy, updatedBy fields cannot be set.


Request example

curl -X POST "https://YOUR_LINER_API_HOST/v2/order/create/" \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_TOKEN" \
  -d '{
    "code": "{{code}}",
    "serviceTitle": "{{serviceTitle}}",
    "title": "{{title}}",
    "status": "{{status}}",
    "sipEndpointIds": [{{sipEndpointId}}, ...],
    "callSchedule": [["{{start}}", "{{end}}"], ...],
    "callHolidayOverrides": ["{{holiday}}", ...],
    "autoDialingEnabled": {{autoDialingEnabled}},
    "predictiveModeEnabled": {{predictiveModeEnabled}},
    "aiDefaultLanguage": "{{aiDefaultLanguage}}",
    "amdDetectionEnabled": {{amdDetectionEnabled}},
    "callRecordRule": "{{callRecordRule}}",
    "sipEndpointUsageScheme": "{{sipEndpointUsageScheme}}",
    "agentUserIds": [{{agentUserId}}, ...],
    "agentGroupIds": [{{agentGroupId}}, ...],
    "showLeadContactsToAgent": {{showLeadContactsToAgent}},
    "callAttemptGroupId": {{callAttemptGroupId}},
    "qualifiedLeadsPerDayLimit": {{qualifiedLeadsPerDayLimit}},
    "callScenarioId": {{callScenarioId}},
    "leadTransformEnabled": {{leadTransformEnabled}},
    "speechRecognitionEnabled": {{speechRecognitionEnabled}},
    "ignoreLeadTimezone": {{ignoreLeadTimezone}},
    "customValues": {
      "{{customFieldId}}": "{{customFieldValue}}"
    },
    "transferNumbers": [
      {
        "number": "{{transferNumber}}",
        "names": {
          "{{langCode}}": "{{transferNumberName}}"
        }
      }
    ],
    "autoProcessCall": {{autoProcessCall}},
    "agentLeadCreationIsAllowed": {{agentLeadCreationIsAllowed}},
    "agentLeadEditMode": "{{agentLeadEditMode}}"
  }'
<?php

$host = 'https://YOUR_LINER_API_HOST';
$token = 'YOUR_API_TOKEN';

$payload = [
    'code' => $code,
    'serviceTitle' => $serviceTitle,
    'title' => $title,
    'status' => $status,
    'sipEndpointIds' => [$sipEndpointId, ...],
    'callSchedule' => [[$start, $end], ...],
    'callHolidayOverrides' => [$holiday, ...],
    'autoDialingEnabled' => (bool)$autoDialingEnabled,
    'predictiveModeEnabled' => (bool)$predictiveModeEnabled,
    'aiDefaultLanguage' => $aiDefaultLanguage,
    'amdDetectionEnabled' => (bool)$amdDetectionEnabled,
    'callRecordRule' => $callRecordRule,
    'sipEndpointUsageScheme' => $sipEndpointUsageScheme,
    'agentUserIds' => [$agentUserId, ...],
    'agentGroupIds' => [$agentGroupId, ...],
    'showLeadContactsToAgent' => (bool)$showLeadContactsToAgent,
    'callAttemptGroupId' => (int)$callAttemptGroupId,
    'qualifiedLeadsPerDayLimit' => (int)$qualifiedLeadsPerDayLimit,
    'callScenarioId' => (int)$callScenarioId,
    'leadTransformEnabled' => (bool)$leadTransformEnabled,
    'speechRecognitionEnabled' => (bool)$speechRecognitionEnabled,
    'ignoreLeadTimezone' => (bool)$ignoreLeadTimezone,
    'customValues' => [
        $customFieldId => $customFieldValue,
    ],
    'transferNumbers' => [
        [
            'number' => $transferNumber,
            'names' => [$langCode => $transferNumberName],
        ],
    ],
    'autoProcessCall' => (bool)$autoProcessCall,
    'agentLeadCreationIsAllowed' => (bool)$agentLeadCreationIsAllowed,
    'agentLeadEditMode' => $agentLeadEditMode,
];

$ch = curl_init($host . '/v2/order/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 = {
  code: code,
  serviceTitle: serviceTitle,
  title: title,
  status: status,
  sipEndpointIds: [sipEndpointId, ...],
  callSchedule: [[start, end], ...],
  callHolidayOverrides: [holiday, ...],
  autoDialingEnabled: Boolean(autoDialingEnabled),
  predictiveModeEnabled: Boolean(predictiveModeEnabled),
  aiDefaultLanguage: aiDefaultLanguage,
  amdDetectionEnabled: Boolean(amdDetectionEnabled),
  callRecordRule: callRecordRule,
  sipEndpointUsageScheme: sipEndpointUsageScheme,
  agentUserIds: [agentUserId, ...],
  agentGroupIds: [agentGroupId, ...],
  showLeadContactsToAgent: Boolean(showLeadContactsToAgent),
  callAttemptGroupId: Number(callAttemptGroupId),
  qualifiedLeadsPerDayLimit: Number(qualifiedLeadsPerDayLimit),
  callScenarioId: Number(callScenarioId),
  leadTransformEnabled: Boolean(leadTransformEnabled),
  speechRecognitionEnabled: Boolean(speechRecognitionEnabled),
  ignoreLeadTimezone: Boolean(ignoreLeadTimezone),
  customValues: {
    [customFieldId]: customFieldValue
  },
  transferNumbers: [
    { number: transferNumber, names: { [langCode]: transferNumberName } }
  ],
  autoProcessCall: Boolean(autoProcessCall),
  agentLeadCreationIsAllowed: Boolean(agentLeadCreationIsAllowed),
  agentLeadEditMode: agentLeadEditMode
};

const res = await fetch(`${host}/v2/order/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

{
  "success": true,
  "message": "",
  "data": {
    "id": 100200300
  }
}

Response structure

Field Type Description
id int Identifier of the created Order.

Note

The structure of the data field is described above. For the overall API response format, see Request Schema