---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../../modules.md) / [operations/mrt](../index.md) / cloneEnv

# Function: cloneEnv()

> **cloneEnv**(`options`, `auth`): `Promise`\<\{ \}\>

Defined in: [packages/b2c-tooling-sdk/src/operations/mrt/env.ts:575](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/5f9b348d598ad92ddf670da42e944b204395bdc8/packages/b2c-tooling-sdk/src/operations/mrt/env.ts#L575)

Clones an environment (target) from an existing source environment.

The new environment receives the source's configuration (excluding proxies and
production flag) and is automatically deployed with the same bundle as the
source target's current deployment (if any).

## Parameters

### options

[`CloneEnvOptions`](../interfaces/CloneEnvOptions.md)

Clone options

### auth

[`AuthStrategy`](../../../auth/interfaces/AuthStrategy.md)

Authentication strategy (ApiKeyStrategy)

## Returns

`Promise`\<\{ \}\>

The newly created environment

## Throws

Error if the clone fails

## Example

```typescript
const env = await cloneEnv({
  projectSlug: 'my-storefront',
  slug: 'staging-copy',
  fromSlug: 'staging',
  cloneRedirects: true,
  cloneEnvironmentVariables: true
}, auth);
```
