# Clear personal data of a customer

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


[Idempotency Supported](/docs/api/idempotency)

Clear personal details of a customer using this API.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/customers/__test__KyVnHhSBWl5qO2b9/clear_personal_data \
     -X POST  \
     -u {site_api_key}:
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Customer.ClearPersonalData("__test__KyVnHhSBWl5qO2b9").Request();

Customer customer = result.Customer;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    customerAction "github.com/chargebee/chargebee-go/v3/actions/customer"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := customerAction.ClearPersonalData("__test__KyVnHhSBWl5qO2b9").Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Customer := res.Customer
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  
  res, err := client.Customer.ClearPersonalData("__test__KyVnHhSBWl5qO2b9")
      if err != nil {
        fmt.Println(err)
    } else {
        Customer := res.Customer
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = Customer.clearPersonalData("__test__KyVnHhSBWl5qO2b9").request();

        Customer customer = result.customer();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.customer.Customer;
import com.chargebee.v4.models.customer.params.CustomerClearPersonalDataParams;
import com.chargebee.v4.models.customer.responses.CustomerClearPersonalDataResponse;

public class CustomerClearPersonalData {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        CustomerClearPersonalDataResponse response = client.customers().clearPersonalData("__test__KyVnHhSBWl5qO2b9");

        Customer customer = response.getCustomer();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.customer.clearPersonalData("__test__KyVnHhSBWl5qO2b9");

    console.log(result);
    const customer = result.customer;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->customer()->clearPersonalData("__test__KyVnHhSBWl5qO2b9");
$customer = $result->customer;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Customer.clear_personal_data("__test__KyVnHhSBWl5qO2b9")
customer = response.customer
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::Customer.clear_personal_data("__test__KyVnHhSBWl5qO2b9")

customer = result.customer
```

## Sample Response

```json
{
  "card": {
    "card_type": "visa",
    "created_at": 1517505724,
    "customer_id": "__test__KyVnHhSBWl5qO2b9",
    "expiry_month": 12,
    "expiry_year": 2022,
    "funding_type": "credit",
    "gateway": "chargebee",
    "gateway_account_id": "gw___test__KyVnGlSBWl4T71j4",
    "iin": "411111",
    "last4": "1111",
    "masked_number": "************1111",
    "object": "card",
    "payment_source_id": "pm___test__KyVnHhSBWl5rL2bB",
    "resource_version": 1517505724000,
    "status": "valid",
    "updated_at": 1517505724
  },
  "customer": {
    "allow_direct_debit": false,
    "auto_collection": "on",
    "card_status": "valid",
    "created_at": 1517505724,
    "deleted": false,
    "excess_payments": 0,
    "first_name": "Mark",
    "id": "__test__KyVnHhSBWl5qO2b9",
    "last_name": "Henry",
    "net_term_days": 0,
    "object": "customer",
    "payment_method": {
      "gateway": "chargebee",
      "gateway_account_id": "gw___test__KyVnGlSBWl4T71j4",
      "object": "payment_method",
      "reference_id": "tok___test__KyVnHhSBWl5rH2bA",
      "status": "valid",
      "type": "card"
    },
    "pii_cleared": "scheduled_for_clear",
    "preferred_currency_code": "USD",
    "primary_payment_source_id": "pm___test__KyVnHhSBWl5rL2bB",
    "promotional_credits": 0,
    "refundable_credits": 0,
    "resource_version": 1517505724000,
    "taxability": "taxable",
    "unbilled_charges": 0,
    "updated_at": 1517505724
  }
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/customers/{customer-id}/clear_personal_data

## Returns

- `customer` (Customer object)
  Resource object representing customer
