Skip to content

Agent groups list

Method to retrieve the list of Agent Groups.

Filtering by agent identifier (agentId) is supported — in this case, only the groups that include the specified agent will be returned.


URL and method

GET /v2/agent-group/


Parameters

offset int optional
Parameter used for pagination. Specifies the ordinal number of the item from which the selection starts. Default — 0

limit int optional
Parameter used for pagination. Number of items returned per request. Maximum value — 100. Default — 50

agentId int optional
Agent identifier. If specified, only groups to which the agent with the given identifier is assigned will be returned. Value > 0


Request example

curl -X GET "https://YOUR_LINER_API_HOST/v2/agent-group/?offset=0&limit=50&agentId=123" \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_TOKEN"
<?php

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

$query = http_build_query([
    'offset' => 0,
    'limit' => 50,
    'agentId' => 123,
]);

$ch = curl_init($host . '/v2/agent-group/?' . $query);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'X-Api-Key: ' . $token,
    ],
    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 params = new URLSearchParams();
params.set("offset", "0");
params.set("limit", "50");
params.set("agentId", "123");

const res = await fetch(`${host}/v2/agent-group/?${params.toString()}`, {
  method: "GET",
  headers: {
    "Content-Type": "application/json",
    "X-Api-Key": token
  }
});

const data = await res.json();
console.log("HTTP", res.status, data);

Response example

{
  "success": true,
  "message": "",
  "data": {
    "list": [
      {
        "id": 123,
        "names": {
          "ru": "Группа агентов",
          "gb": "Agent group"
        },
        "agentIds": [101, 102],
        "createdAt": "2024-01-01T00:00:00Z",
        "updatedAt": "2024-01-01T00:00:00Z"
      }
    ],
    "next": 50,
    "total": 12345
  }
}

Response fields

Fields in data

Field Type Description
list array List of agent groups.
next int Offset for the next request.
total int Total number of agent groups (taking filters into account, if applied).

Fields in list

Field Type Description
id int Agent group identifier in Liner.
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 of agent identifiers assigned to the group.
createdAt string Creation date and time (ISO 8601).
updatedAt string Update date and time (ISO 8601).

Note

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