# Unlink a customer from its parent account

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


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

When a customer belongs to an [account hierarchy](https://www.chargebee.com/docs/2.0/account-hierarchy.html) , this operation detaches the customer from its parent. The hierarchy, if any, beneath the customer remains unchanged.

## Sample Request

#### cURL

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

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Customer.DeleteRelationship("__test__KyVnHhSBWlAG12cF").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.DeleteRelationship("__test__KyVnHhSBWlAG12cF").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.DeleteRelationship("__test__KyVnHhSBWlAG12cF")
      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.deleteRelationship("__test__KyVnHhSBWlAG12cF").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.CustomerDeleteRelationshipParams;
import com.chargebee.v4.models.customer.responses.CustomerDeleteRelationshipResponse;

public class CustomerDeleteRelationship {

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

        CustomerDeleteRelationshipResponse response = client.customers().deleteRelationship("__test__KyVnHhSBWlAG12cF");

        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.deleteRelationship("__test__KyVnHhSBWlAG12cF");

    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()->deleteRelationship("__test__KyVnHhSBWlAG12cF");
$customer = $result->customer;
```

#### Python

```python
from chargebee import Chargebee

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

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Customer.delete_relationship("__test__KyVnHhSBWlAG12cF")

customer = result.customer
```

## Sample Response

```json
{
  "customer": {
    "allow_direct_debit": false,
    "auto_collection": "on",
    "card_status": "no_card",
    "created_at": 1517505741,
    "deleted": false,
    "excess_payments": 0,
    "first_name": "Bella",
    "id": "__test__KyVnHhSBWlAG12cF",
    "last_name": "Brown",
    "net_term_days": 0,
    "object": "customer",
    "pii_cleared": "active",
    "preferred_currency_code": "USD",
    "promotional_credits": 0,
    "refundable_credits": 0,
    "resource_version": 1517505741000,
    "taxability": "taxable",
    "unbilled_charges": 0,
    "updated_at": 1517505741
  }
}
```

## URL Format

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

## Returns

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