# Update Customer

## Update Customer

### <mark style="color:purple;">`PATCH`</mark> `{{baseUrl}}/customers/:customer_id`

You may update Customer details attached to a specific `customer_id` using this endpoint. `customer_id` and `api_token` are the only fields you are not able to update as they are automatically generated and assigned when you use the [*<mark style="color:orange;">**POST**</mark>**&#x20;Create New*****&#x20;Customer** ](https://finch-technologies.gitbook.io/gathr-api-documentation/customers/single-customer-crud/create-new-customer) endpoint. Updating the details of a Customer is pretty simple, but it is best explained with a before-and-after example.&#x20;

{% hint style="danger" %}
Please note that updating customer fields may yield different results for any subsequent validations and verifications performed on the customer.
{% endhint %}

### Path Parameters

<table><thead><tr><th width="180">Name</th><th width="129">Type</th><th>Description</th></tr></thead><tbody><tr><td>customer_id<mark style="color:red;">*</mark></td><td>String</td><td>This is UUID for a specific customer that gets generated and returned in the <a href="create-new-customer"><em><mark style="color:orange;"><strong>POST</strong></mark><strong> Create New</strong></em><strong> Customer</strong> </a>response. It ensures that the Bank Account is created and can be looked up in future for that specific customer.</td></tr></tbody></table>

### Request Body

<table><thead><tr><th width="211">Name</th><th width="118">Type</th><th>Description</th></tr></thead><tbody><tr><td>client_reference</td><td>String</td><td>This is a reference that you may use to identify and do a lookup on the Customer in your system. Each Customer needs to have a unique <code>client_reference</code>. </td></tr><tr><td>popi</td><td>String</td><td>This is used to store whether the Customer has given you Consent under the Protection Of Personal Information (POPI) Act to continue with collecting their data and performing additional verifications in Gathr.This is used to store whether the Customer has given you Consent under the Protection Of Personal Information (POPI) Act to continue with collecting their data and performing additional verifications in Gathr.</td></tr><tr><td>terms_and_conditions</td><td>String</td><td>This is used to store whether the Customer has agreed to the Terms and Conditions of the Application and Verifications you are performing.</td></tr><tr><td>email</td><td>String</td><td>The Customer's Email Address. It has to be of the format <code>example@123.com</code></td></tr><tr><td>id_number</td><td>String</td><td><p>This is the 13-digit South African ID Number of the Customer you are creating. Each Customer created with <code>"id_type" = "id_number"</code> will need to have a valid ID Number. You cannot create multiple Customers with the same ID Number on the same Gathr Tenant. </p><p></p><p>When id_type "passport" is selected, there is no validation on the Passport Number.</p></td></tr><tr><td>first_name</td><td>String</td><td>The Customer's First Name as per their ID Document. </td></tr><tr><td>middle_name</td><td>String</td><td>The Customer's Last Name/Surname as per their ID Document. </td></tr><tr><td>last_name</td><td>String</td><td>The Customer's Last Name/Surname as per their ID Document. </td></tr><tr><td>id_type</td><td>String</td><td><p>This is the type of identification number you want to create the customer with. The options are:</p><p><strong>[Default]</strong> <code>"id_number"</code> OR</p><p><code>"passport"</code>. You need to use "id_number" if you wish to get a Credit Report or perform an ID Verification on this customer. </p></td></tr><tr><td>country</td><td>String</td><td>The Customer's nationality .</td></tr></tbody></table>

### Status Codes&#x20;

<details>

<summary>200 - OK </summary>

Customer Updated&#x20;

```json
{
    "data": {
        "id": "16cd33d2-cf0a-66ad-8150-cb39e9b9ff27",
        "client_reference": "clientnumber1",
        "popi": null,
        "terms_and_conditions": null,
        "email": "chris2@gathr.com",
        "id_number": "8511215433085",
        "first_name": "Chris",
        "middle_name": "Jovonovich",
        "last_name": "Wick",
        "full_name": "John Jovonovich Wick",
        "id_type": "id_number",
        "country": null,
        "initials": "CJW",
        "api_token": {{apiToken}}
    }
}
```

</details>

<details>

<summary>422 - Unprocessable Content</summary>

Invalid format - POPI Consent&#x20;

```json
{
    "errors": {
        "popi": [
            "The popi field must be true or false."
        ]
    }
}
```

</details>

### Example&#x20;

#### Before: Available Customer Information&#x20;

```json
{
    "data": {
        "id": "16cd33d2-cf0a-66ad-8150-cb39e9b9ff27",
        "client_reference": "clientnumber1",
        "popi": null,
        "terms_and_conditions": null,
        "email": "john.w@finch-technologies.co.za",
        "id_number": "8511215433085",
        "first_name": "John",
        "middle_name": "Jovonovich",
        "last_name": "Wick",
        "full_name": "John Jovonovich Wick",
        "id_type": "id_number",
        "country": null,
        "initials": "JJW",
        "api_token": {{apiToken}}
    }
}
```

#### Patch: Updating the customers first name and email address

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "email": "chris2@gathr.com",
    "first_name": "Chris"
}
</code></pre>

#### After: Updated Customer Information

```json
{
    "data": {
        "id": "16cd33d2-cf0a-66ad-8150-cb39e9b9ff27",
        "client_reference": "clientnumber1",
        "popi": null,
        "terms_and_conditions": null,
        "email": "chris2@gathr.com",
        "id_number": "8511215433085",
        "first_name": "Chris",
        "middle_name": "Jovonovich",
        "last_name": "Wick",
        "full_name": "John Jovonovich Wick",
        "id_type": "id_number",
        "country": null,
        "initials": "CJW",
        "api_token": {{apiToken}}
    }
}
```
