# Create a client

### URL

<mark style="color:green;">**POST**</mark> `https://api.complycube.com/v1/clients`

Creates a new client.

### Headers

<table><thead><tr><th width="240.15625">Name</th><th width="76">Type</th><th width="379">Description</th></tr></thead><tbody><tr><td><code>Content-Type</code><mark style="color:red;">*</mark></td><td>string</td><td>The content-type must always be set to <code>application/json</code>.</td></tr><tr><td><code>Authorization</code><mark style="color:red;">*</mark></td><td>string</td><td>The API <strong><code>live</code></strong> or <strong><code>test</code></strong> key.</td></tr></tbody></table>

### Body

<table><thead><tr><th width="239.625">Name</th><th width="79">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code><mark style="color:red;">*</mark></td><td>string</td><td>The type of client. Valid values are: <br>1. <code>person</code> <br>2. <code>company</code></td></tr><tr><td><code>email</code><mark style="color:red;">*</mark></td><td>string</td><td>The client's email address.</td></tr><tr><td><code>mobile</code></td><td>string</td><td>The client's mobile number.</td></tr><tr><td><code>telephone</code></td><td>string</td><td>The client's telephone number.</td></tr><tr><td><code>externalId</code></td><td>string</td><td>A unique identifier that you can associate with the client. For example, this can be the client ID in your system.</td></tr><tr><td><code>joinedDate</code></td><td>string</td><td>The date and time when the client was registered with you. This is relevant for users that migrate existing customers. The format is <code>YYYY-MM-DD</code>.</td></tr><tr><td><code>personDetails</code></td><td>object</td><td>Primary details for a client of type <code>person</code>. This is <strong>required</strong> when the <code>type</code> is person. Also, see the <a href="#the-persondetails-object">person details object</a> below.</td></tr><tr><td><code>companyDetails</code></td><td>object</td><td>Primary details for a client of type <code>company</code>. This is <strong>required</strong> when the <code>type</code> is company. Also, see the <a href="#the-companydetails-object">company details object</a> below.</td></tr><tr><td><code>metadata</code></td><td>object</td><td>Set of key-value pairs that you can associate with the client object. This is useful for storing additional information about the client in a structured format. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long.</td></tr></tbody></table>

#### The `personDetails` object

<table data-full-width="false"><thead><tr><th width="240.28830213784875">Attribute</th><th width="82">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>firstName</code></td><td>string</td><td><p>The client's first name. </p><p>(<strong>Required</strong>)</p></td></tr><tr><td><code>middleName</code></td><td>string</td><td>The client's middle name. (<em>Optional)</em></td></tr><tr><td><code>lastName</code></td><td>string</td><td>The client's last name. (<strong>Required</strong>)</td></tr><tr><td><code>dob</code></td><td>string</td><td>The client's date of birth. The format is <code>YYYY-MM-DD</code>. (<em>Optional)</em></td></tr><tr><td><code>gender</code></td><td>string</td><td><p>The client's gender. Valid values include:</p><ol><li><code>male</code></li><li><code>female</code></li><li><code>other</code></li></ol><p> (<em>Optional)</em></p></td></tr><tr><td><code>nationality</code></td><td>string</td><td>The client's nationality. This will be the <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">two-letter country ISO code</a>. (<em>Optional)</em></td></tr><tr><td><code>birthCountry</code></td><td>string</td><td>The client's birth country. This will be the <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">two-letter country ISO code</a>. (<em>Optional)</em></td></tr><tr><td><code>ssn</code></td><td>string</td><td>The client's SSN (Social Security Number). This is for US clients. (<em>Optional)</em></td></tr><tr><td><code>socialInsuranceNumber</code></td><td>string</td><td>The client's Social Insurance Number. (<em>Optional)</em></td></tr><tr><td><code>nationalIdentityNumber</code></td><td>string</td><td>The client's National Identity Number. (<em>Optional)</em></td></tr><tr><td><code>taxIdentificationNumber</code></td><td>string</td><td>The client's Tax Identification Number (TIN). (<em>Optional)</em></td></tr></tbody></table>

#### The `companyDetails` object&#x20;

<table data-full-width="false"><thead><tr><th width="240.48670632463438">Attribute</th><th width="81">Type</th><th width="431.618718252517">Description</th></tr></thead><tbody><tr><td><code>name</code></td><td>string</td><td>The client's name. (<strong>Required</strong>)</td></tr><tr><td><code>website</code></td><td>string</td><td>The client's website. (<em>Optional)</em></td></tr><tr><td><code>registrationNumber</code></td><td>string</td><td>The client's registration or incorporation number. (<em>Optional)</em></td></tr><tr><td><code>incorporationCountry</code></td><td>string</td><td>The client's incorporation country. This will be the <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">two-letter country ISO code</a>. (<em>Optional)</em></td></tr><tr><td><code>incorporationType</code></td><td>string</td><td><p>The client's incorporation type. Valid values include:</p><ol><li><code>sole_proprietorship</code></li><li><code>private_limited_company</code></li><li><code>public_limited_company</code></li><li><code>partnership</code></li><li><code>limited_partnership</code></li><li><code>limited_liability_partnership</code></li><li><code>holding_company</code></li><li><code>non_government_organization</code></li><li><code>non_profit_organization</code></li><li><code>governmental_entity</code></li><li><code>statutory_company</code></li><li><code>subsidiary_company</code></li><li><code>unlimited_partnership</code></li><li><code>unlimited_company</code></li><li><code>trust</code></li><li><code>charitable_incorporated_organization</code></li><li><code>chartered_company</code></li><li><code>cooperative</code></li><li><code>professional_association</code></li><li><code>other</code></li></ol><p>(<em>Optional)</em></p></td></tr></tbody></table>

### Example request

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://api.complycube.com/v1/clients \
     -H 'Authorization: <YOUR_API_KEY>' \
     -H 'Content-Type: application/json' \
     -d '{
          	"type": "person",
		"email": "john.doe@example.com",
		"mobile": "+12 345678910",
		"telephone": "+12 345678910",
		"joinedDate": "2020-01-01",
		"personDetails":{
			"firstName": "John",
			"lastName" :"Doe",
			"dob": "1990-01-01",
			"nationality": "GB"
		}
        }'
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const { ComplyCube } = require("@complycube/api");

const complycube = new ComplyCube({ apiKey: "<YOUR_API_KEY>" });

const client = await complycube.client.create({
  type: "person",
  email: "john.doe@example.com",
  mobile: "+12 345678910",
  telephone: "+12 345678910",
  joinedDate: "2020-01-01",
  personDetails: {
    firstName: "John",
    lastName: "Doe",
    dob: "1990-01-01",
    nationality: "GB"
  }
});
```

{% endtab %}

{% tab title="Python" %}

```python
from complycube import ComplyCubeClient
cc_api = ComplyCubeClient(api_key='<YOUR_API_KEY>')

new_client = {
    'mobile':"+12 345678910",
    'telephone': "+12 345678910",
    'joinedDate': "2020-01-01",
    'personDetails': {
        'firstName':'John',
        'lastName': "Doe",
        'dob': "1990-01-01",
        'nationality': "GB"
    }
}

client = cc_api.clients.create('person','john.doe@example.com', **new_client)
```

{% endtab %}

{% tab title="PHP" %}

```php
use ComplyCube\ComplyCubeClient;

$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');

$result = $ccapi->clients()->create([
    'type' => 'person',
    'email' => 'john@doe.com',
    'mobile' => '+12 345678910',
    'telephone' => '+12 345678910',
    'joinedDate' => '2020-01-01',
    'personDetails' => [
        'firstName' => 'John',
        'lastName' => 'Doe',
        'dob' => '1990-01-01',
        'nationality' => 'GB'
    ]
]);
```

{% endtab %}

{% tab title=".NET" %}

```csharp
using ComplyCube.Net;
using ComplyCube.Net.Resources.Clients;

var clientApi = new ClientApi(new ComplyCubeClient("<YOUR_API_KEY>"));
var newClient = new ClientRequest {
  type = "person",
  email = "john.doe@example.com",
  mobile = "+12 345678910",
  telephone = "+12 345678910",
  joinedDate = "2020-01-01",
  personDetails = new PersonDetails {
    firstName = "John",
    lastName = "Doe",
    dob = "1990-01-01",
    nationality = "GB"
  }
}

var client = await clientApi.CreateAsync(newClient);
```

{% endtab %}
{% endtabs %}

### Example responses

{% tabs %}
{% tab title="Success (200)" %}

```javascript
{
    "id": "5eb04fcd0f3e360008035eb1",
    "type": "person",
    "email": "john.doe@example.com",
    "mobile": "+12345678910",
    "telephone": "+12 345678910",
    "joinedDate": "2020-01-01",
    "personDetails": {
        "firstName": "John",
        "lastName": "Doe",
        "dob": "1990-01-01",
        "nationality": "GB"
    },
    "metadata": {
        "account_reference": "7201748192"
    },
    "createdAt": "2020-01-04T17:24:29.146Z",
    "updatedAt": "2020-01-04T17:24:29.146Z"
}
```

{% endtab %}

{% tab title="Invalid Request (400)" %}

```javascript
{
    "type": "invalid_request",
    "message": "'type' should be equal to one of the allowed values: person,company",
    "param": "type"
}
```

{% endtab %}
{% endtabs %}
