Add

[POST] .../v1/retailcustomer/add

Adds new customer. Use this method to create a retail customer before issuing a loyalty card, attaching a POS sale, or maintaining customer contact and additional-field data. The request requires group_id and first_name, accepts optional region, name parts, phone, email, birth date, referral, description, and additional fields, and returns new_id for the created customer. The method checks the current request user and requires retail customer add permission; it validates the group, required additional fields when the tariff enables them, phone format and optional phone uniqueness, email format, and string lengths, and returns validation, permission, duplicate, tariff, and storage failures as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
address String Optional Customer address.
date_of_birth String Optional Customer birth date.
description String Optional Customer description or note.
email String Optional Customer email address.
fields Array of FieldValueAdd Optional Custom field values.
first_name String Required Customer first name.
group_id Int64 Required Customer group ID in the system.
last_name String Optional Customer last name.
main_phone String Optional Customer primary phone.
middle_name String Optional Customer middle name.
phones String Optional Additional customer phone numbers.
refer_id Int64 Optional ID of the customer who referred this customer.
region_id Int64 Optional Residence region ID.
sex String Optional Customer gender. Allowed values: none, male, female.

Request Example

{
  "address": "string",
  "date_of_birth": "string",
  "description": "string",
  "email": "string",
  "fields": [
    {
      "key": "string",
      "value": "string"
    }
  ],
  "first_name": "string",
  "group_id": 1,
  "last_name": "string",
  "main_phone": "string",
  "middle_name": "string",
  "phones": "string",
  "refer_id": 1,
  "region_id": 1,
  "sex": "none"
}

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": 1
  }
}