# Update a client

### URL

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

Updates the specified client by setting the values of the parameters passed. Any parameters not provided will be left unchanged.\
\
Once a client is created, their **type** can no longer be amended.

### Headers

<table><thead><tr><th width="274">Name</th><th width="109">Type</th><th>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>

### Path parameters

<table><thead><tr><th width="275">Name</th><th width="107">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code><mark style="color:red;">*</mark></td><td>string</td><td>The ID of the client.</td></tr></tbody></table>

### Body

<table><thead><tr><th width="277">Name</th><th width="106">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>email</code></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="/pages/-M6V_n1xzMjc3LnDMeNO#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="/pages/-M6V_n1xzMjc3LnDMeNO#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 20 keys, with key names up to 40 characters long and values up to 500 characters long.</td></tr></tbody></table>

### Example request

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

```bash
curl -X POST https://api.complycube.com/v1/clients/{:clientId} \
     -H 'Authorization: <YOUR_API_KEY>' \
     -H 'Content-Type: application/json' \
     -d '{
          	"email": "jane.doe@example.com",
		"personDetails":{
			"firstName": "Jane",
			"lastName": "Doe",
			"dob":"1995-12-20",
			"nationality": "US"
		}
    	}'
```

{% endtab %}

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

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

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

const client = await complycube.client.update("CLIENT_ID", {
  email: "jane.doe@example.com",
  personDetails: {
    firstName: "Jane",
    lastName: "Doe",
    dob: "1995-12-20",
    nationality: "US"
  }
});
```

{% endtab %}

{% tab title="Python" %}

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

client = cc_api.clients.update('CLIENT_ID',email='jane.doe@example.com')
```

{% endtab %}

{% tab title="PHP" %}

```php
use ComplyCube\ComplyCubeClient;

$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');
$updated = $ccapi->clients()->update($id, ['email' => 'jane.doe@example.com']);
```

{% endtab %}

{% tab title=".NET" %}

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

var clientApi = new ClientApi(new ComplyCubeClient("<YOUR_API_KEY>"));

var update = new ClientRequest {
  email: "jane.doe@example.com",
  personDetails = new PersonDetails {
    firstName = "Jane",
    lastName = "Doe"
  }
};

var client = await clientApi.UpdateAsync("CLIENT_ID", update);
```

{% endtab %}
{% endtabs %}

### Example response

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

```json
{
    "id": "5eb04fcd0f3e360008035eb1",
    "type": "person",
    "email": "jane.doe@example.com",
    "mobile": "+12345678910",
    "telephone": "+12 345678910",
    "joinedDate": "2020-01-01",
    "personDetails": {
        "firstName": "Jane",
        "lastName": "Doe",
        "dob": "1995-12-20",
        "nationality": "US"
    },
    "createdAt": "2020-01-04T17:24:29.146Z",
    "updatedAt": "2020-01-04T17:13:10.712Z"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.complycube.com/documentation/api-reference/core-resources/clients/update-a-client.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
