# Move a customer

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


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

This API copies a customer object from one site to another. The destination site (the site to which the customer is copied) is specified by the path parameter `{site}`; whereas, the source site (the site from which the customer is copied) is specified by the query parameter `from_site`.

**Prerequisites**

-   This endpoint is disabled by default. For the operation to work, the endpoint must be enabled for both the source and destination sites. Contact [Chargebee Support](https://www.chargebee.com/docs/billing/2.0/kb/getting-started/how-to-contact-chargebees-support-team?utm_source=docs_api&utm_medium=content&utm_campaign=support) to have it enabled.
-   The customer's `preferred_currency_code` must be enabled in the destination site.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/customers/move \
     -u {site_api_key}:\
     -d id_at_from_site="__test__KyVnHhSBWlCxa2cx" \
     -d from_site="mannar"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Customer.Move()
		.IdAtFromSite("__test__KyVnHhSBWlCxa2cx")
		.FromSite("mannar")
		.Request();

ResourceMigration resourceMigration = result.ResourceMigration;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    customerAction "github.com/chargebee/chargebee-go/v3/actions/customer"
    "github.com/chargebee/chargebee-go/v3/models/customer"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := customerAction.Move(&customer.MoveRequestParams{
        IdAtFromSite : "__test__KyVnHhSBWlCxa2cx",
        FromSite : "mannar",
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        ResourceMigration := res.ResourceMigration
    }
}
```

#### 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)
  req := &chargebee.CustomerMoveRequest{
    IdAtFromSite : "__test__KyVnHhSBWlCxa2cx",
    FromSite : "mannar",
}
  res, err := client.Customer.Move(req)
      if err != nil {
        fmt.Println(err)
    } else {
        ResourceMigration := res.ResourceMigration
    }
}
```

#### 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.move()
            .idAtFromSite("__test__KyVnHhSBWlCxa2cx")
            .fromSite("mannar")
            .request();

        ResourceMigration resourceMigration = result.resourceMigration();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.customer.params.CustomerMoveParams;
import com.chargebee.v4.models.customer.responses.CustomerMoveResponse;
import com.chargebee.v4.models.resourceMigration.ResourceMigration;

public class CustomerMove {

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

        CustomerMoveParams params = CustomerMoveParams.builder()
            .idAtFromSite("__test__KyVnHhSBWlCxa2cx")
            .fromSite("mannar")
            .build();

        CustomerMoveResponse response = client.customers().move(params);

        ResourceMigration resourceMigration = response.getResourceMigration();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.customer.move({
        id_at_from_site: "__test__KyVnHhSBWlCxa2cx",
        from_site: "mannar"
    });

    console.log(result);
    const resourceMigration = result.resource_migration;
} 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()->move([
    "id_at_from_site" => "__test__KyVnHhSBWlCxa2cx",
    "from_site" => "mannar"
]);
$resourceMigration = $result->resource_migration;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Customer.move(
    cb_client.Customer.MoveParams(
        id_at_from_site="__test__KyVnHhSBWlCxa2cx",
        from_site="mannar"
    )
)
resource_migration = response.resource_migration
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Customer.move({
  :id_at_from_site => "__test__KyVnHhSBWlCxa2cx",
  :from_site => "mannar"
})

resource_migration = result.resource_migration
```

## Sample Response

```json
{
  "resource_migration": {
    "created_at": 1517505751,
    "entity_id": "__test__KyVnHhSBWlCxa2cx",
    "entity_type": "customer",
    "from_site": "mannar",
    "object": "resource_migration",
    "status": "scheduled",
    "updated_at": 1517505751
  }
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/customers/move

## Input Parameters

- `id_at_from_site` (required, string, max chars=100)
  Id of the customer to be copied.

- `from_site` (required, string, max chars=50)
  Name of the site from which this customer need to be copied.

## Returns

- `resource_migration` (Resource migration object)
  Resource object representing resource\_migration
