# Adding a Client

Endpoint: POST /clients/{location_id}
Version: 1.0.0
Security: BearerPartnerUser

## Security:

  - `BearerPartnerUser` (unknown)
    http bearer Bearer {PartnerToken}, User {UserToken}

## Path parameters:

  - `location_id` (number, required)
    location ID

## Header parameters:

  - `Accept` (string, required)
    e.g. application/vnd.api.v2+json

  - `Content-Type` (string, required)
    application/json

  - `Authorization` (string, required)
    Bearer partner_token, User user_token

## Request fields (*/*):

  - `name` (string, required)
    Client name

  - `surname` (string)
    Client surname

  - `middle_name` (string)
    Client middle name

  - `phone` (string, required)
    Customer phone

  - `email` (string)
    Client Email

  - `gender_id` (number)
    Gender of the client (1 - male, 2 - female, 0 - unknown)

  - `importance_id` (number)
    Client priority level (0 - none, 1 - bronze, 2 - silver, 3 - gold)

  - `discount` (number)
    Customer Discount

  - `card` (string)
    Client card number

  - `national_id` (string)
    Client national ID: CPF for Brazil, IIN for Kazakhstan. For a location in Kazakhstan the value must be a valid individual IIN — 12 digits with a correct check digit — otherwise the request is rejected with 422 Unprocessable Entity. Optional.

  - `birth_date` (string)
    Date of birth of the client in the format yyyy-mm-dd

  - `comment` (string)
    A comment

  - `spent` (number)
    How much money spent in the location at the time of adding

  - `balance` (number)
    Client balance

  - `sms_check` (number)
    1 - Happy Birthday by SMS, 0 - do not congratulate

  - `sms_not` (number)
    1 - Exclude the client from SMS mailings, 0 - do not exclude

  - `categories` (object)
    Array of customer tag IDs

  - `custom_fields` (object)
    Array of additional client fields as "api-key": "value" pairs

## Response 201:

  - `201` (unknown)
    Created

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `success` (boolean)
    Response status.
    Example: false

  - `data` (object | null)
    Response data.
    Example: null

  - `meta` (object)
    Additional response data.

  - `meta.message` (string)
    Error message.
    Example: Authentication needed.

## Response 403:

  - `403` (unknown)
    Forbidden

## Response 403 fields (application/json):

  - `success` (boolean)
    Response status.
    Example: false

  - `data` (object | null)
    Response data.
    Example: null

  - `meta` (object)
    Additional response data.

  - `meta.message` (string)
    Error message.
    Example: Access denied.

## Response 404:

  - `404` (unknown)
    Not Found

## Response 404 fields (application/json):

  - `success` (boolean)
    Response status.
    Example: false

  - `data` (object | null)
    Response data.
    Example: null

  - `meta` (object | array)
    Additional response data (empty object or empty array)
    Example: {}

