Add

[POST] .../v1/client/add

Creates a CRM client and sends the ClientAdded webhook after success. Use this method to create a CRM client from a form, import, chat, ticket, lead or external integration before linking CRM activity to that client. The method validates the conditional identity fields, validates the optional responsible user, validates required custom fields when additional fields are enabled, stores the client and custom field values, writes an action log record, sends the ClientAdded webhook and returns new_id. The request body is required; at least one of external_id, phone or email must be provided, string fields follow the database limits documented in the schema and fields are accepted only when the additional-fields tariff option is enabled. The caller must have CRM client add permission; missing body, missing identity, denied access, missing responsible user, disabled additional fields, required custom-field failures, database errors, transaction failures and action-log errors are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
description String Optional Client comment.
email String Optional Client email address. Maximum length is 150 characters.
external_id String Optional External client ID. Maximum length is 150 characters.
fields Array of FieldValueAdd Optional Custom field values.
name String Optional Client name. Maximum length is 200 characters.
phone String Optional Client phone number. Maximum length is 50 characters.
photo_url String Optional Avatar URL. Maximum length is 500 characters.
responsible_user_id Int64 Optional Responsible user ID.

Request Example

{
  "external_id": "crm-126",
  "name": "Maria Sokolova",
  "phone": "\u002B998933334455",
  "email": "m.sokolova@example.com",
  "description": "Client from website form",
  "responsible_user_id": 17,
  "fields": []
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Insert Created record result.

Response Example

{
  "ok": true,
  "result": {
    "new_id": 126
  }
}