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

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

# Function: createEnv()

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

Defined in: [packages/b2c-tooling-sdk/src/operations/mrt/env.ts:139](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/operations/mrt/env.ts#L139)

Creates a new environment (target) in an MRT project.

## Parameters

### options

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

Environment creation options

### auth

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

Authentication strategy (ApiKeyStrategy)

## Returns

`Promise`\<\{ \}\>

The full environment object from the API

## Throws

Error if creation fails

## Example

```typescript
import { ApiKeyStrategy } from '@salesforce/b2c-tooling-sdk/auth';
import { createEnv } from '@salesforce/b2c-tooling-sdk/operations/mrt';

const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization');

const env = await createEnv({
  projectSlug: 'my-storefront',
  slug: 'staging',
  name: 'Staging Environment',
  region: 'us-east-1',
  isProduction: false
}, auth);

console.log(`Environment ${env.slug} created`);
```
