Skip to content

Create agent group

Synchronous method to create a new Agent Group in Liner. On success, returns the identifier of the created group.


URL and method

POST /v2/agent-group/create/


Parameters

names object
Object containing agent group names in different languages.

names.ru string
Agent group name in Russian.

names.gb string
Agent group name in English.

agentIds array<int>
Array containing identifiers of agents assigned to the group.


Request example

curl -X POST "https://YOUR_LINER_API_HOST/v2/agent-group/create/" \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_TOKEN" \
  -d '{
    "names": {
      "ru": "{{nameRu}}",
      "gb": "{{nameGb}}"
    },
    "agentIds": [{{agentId}}, ...]
  }'
<?php

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

$payload = [
    'names' => [
        'ru' => $nameRu,
        'gb' => $nameGb,
    ],
    'agentIds' => [$agentId, ...],
];

$ch = curl_init($host . '/v2/agent-group/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 = {
  names: {
    ru: nameRu,
    gb: nameGb
  },
  agentIds: [agentId, ...]
};

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

Note

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