# Create a client

`POST https://testing-backend.estactics.com/api/clients/create`

Adds a new client. An email or phone number that already belongs to a client is rejected, unless you set `throwErrorOnClientExists` to false.

Authentication: `Authorization: Bearer YOUR_API_KEY`. Required permission: `clients.MANAGE`.

## Body parameters

- `firstName` (string, required): First name.
- `lastName` (string): Last name.
- `email` (string, required): Email address. Masked or left out when the API key lacks email visibility.
- `language` (string): Preferred language code, for example en.
- `country` (string): Country name.
- `city` (string): City.
- `address` (string): Street address.
- `campaignCode` (string): Code of the marketing campaign the client came from.
- `brandId` (integer): ID of the brand the client belongs to.
- `assignedToUserId` (integer): ID of the agent who owns the client.
- `assignedToHierarchyId` (integer): ID of the team that owns the client.
- `phone` (any, required): Phone number. Send it in international format, such as +35799123456, or send the national number together with `phoneDialCode`.
- `phoneDialCode` (integer): Dial code without the plus sign. Only needed when `phone` is not in international format.
- `phoneCountryCode` (string): Two-letter country code. Only needed together with `phoneDialCode`.
- `phoneDefaultCountry` (string): Country to assume for a phone number with no dial code, for example CY.
- `throwErrorOnClientExists` (boolean): When false, a client who already exists is returned instead of an error. Defaults to true.
- `utmSource` (string): UTM source. Saved only when `campaignCode` is sent.
- `utmMedium` (string): UTM medium. Saved only when `campaignCode` is sent.
- `utmCampaign` (string): UTM campaign. Saved only when `campaignCode` is sent.
- `utmTerm` (string): UTM term. Saved only when `campaignCode` is sent.
- `utmContent` (string): UTM content. Saved only when `campaignCode` is sent.
- `form` (object): Any extra answers from your form. Saved only when `campaignCode` is sent.

## Example request body

```json
{
  "firstName": "Alex",
  "lastName": "Morgan",
  "email": "alex.morgan@example.com",
  "phone": "+35799123456",
  "language": "en",
  "country": "Cyprus"
}
```

## Example response

```json
{
  "success": true,
  "data": {
    "id": 1042,
    "assignedToUser": null,
    "assignedToUserLanguage": null
  }
}
```
