Skip to content

Custom fields list

Retrieves the list of custom fields in Liner. Fields are sorted by sort in ascending order.


URL and method

GET /v2/custom-field/


Parameters

essence string optional
Entity the custom field is attached to. Allowed values: orders, leads.

offset int optional
Pagination parameter. Specifies the ordinal number (offset) of the item from which the selection starts. Default is 0

limit int optional
Pagination parameter. Number of items returned per request. Maximum value is 100. Default is 50


Request example

curl -X GET "https://YOUR_LINER_API_HOST/v2/custom-field/?essence=orders&offset=0&limit=50" \
  -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([
    'essence' => 'orders', // optional: orders | leads
    'offset' => 0,
    'limit' => 50,
]);

$ch = curl_init($host . '/v2/custom-field/?' . $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("essence", "orders"); // optional: orders | leads
params.set("offset", "0");
params.set("limit", "50");

const res = await fetch(`${host}/v2/custom-field/?${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,
        "title": "Source",
        "type": "select",
        "essence": "leads",
        "params": [
          {
            "code": "option_1",
            "sort": 10,
            "title": "Option 1",
            "isDeleted": false
          }
        ],
        "sort": 10,
        "defaultValue": null,
        "allowEmpty": false,
        "showAlways": true,
        "apiOnly": false
      }
    ],
    "total": 1,
    "next": 0
  }
}

Response fields

Fields in data

Field Type Description
list array List of custom fields.
next int Offset to use for the next request.
total int Total number of custom fields.

Fields in list

Field Type Description
id int Custom field identifier.
title string Custom field title in the current locale.
type string Field type. Allowed values: string, int, float, date, datetime, bool, select, multiselect.
essence string Entity where the field is used. Allowed values: leads, orders.
params array<object> Field parameters. For select and multiselect types it contains the list of options, including hidden (deleted) ones. For other types — an empty array.
sort int Sort order of the field.
defaultValue mixed \| null Default value that is set when a lead or order is created. Has the same format as the field value (see the "Custom field values" section below). null — no default value.
allowEmpty bool Whether the field value can be cleared (set to an empty value).
showAlways bool Whether the field is always shown in the lead or order card, even when it has no value.
apiOnly bool The field value can be changed only via the API — not from the card and not by processing rules.

Fields in params

Field Type Description
code string Option code. This code is passed and returned as the field value.
sort int Option sort order.
title string Option title in the current locale.
isDeleted bool The option is hidden (deleted). It cannot be selected, but stays in the entities where it was selected earlier.

Note

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


Custom field values

Custom field values of leads and orders are passed and returned in the customValues field — a map where the key is the custom field ID (id) and the value is the value of that field.

Field type Value when writing Value in the response
string String. String.
int Integer or string of digits. String, for example "10".
float Number or numeric string. String, for example "10.5".
bool true / false or the strings "true" / "false". String "true" / "false".
date String YYYY-MM-DD, in the Liner instance time zone. String YYYY-MM-DD HH:MM:SS in UTC — midnight of the date in the instance time zone.
datetime String YYYY-MM-DDTHH:MM, in the Liner instance time zone. String YYYY-MM-DD HH:MM:SS in UTC.
select Option code (params[].code). Option code.
multiselect Array of option codes. Array of option codes.

Writing rules:

  • Values are saved field by field. An invalid value (unknown field, field of another entity, value not matching the field type, unknown or hidden option code, empty value for a field with allowEmpty: false) does not cause an error — it is skipped, and the other fields and the lead/order itself are saved.
  • To clear a field, pass null, "" or []. Works only for fields with allowEmpty: true.
  • A hidden (deleted) option cannot be selected, but if it is already selected in the entity, it can be kept.
  • When a lead or order is created, fields with defaultValue get the default value; the values passed in the request overwrite it.