> ## Documentation Index
> Fetch the complete documentation index at: https://infisical.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an environment

> Add an environment to a project with the Node.js SDK.

`client.environments().create()` adds an [environment](https://infisical.com/docs/documentation/platform/secrets-mgmt/project.md#project-environments) to a project.

## Parameters

**options** `CreateEnvironmentOptions` *required*

**properties**

**projectId** `string` *required*

The ID of the project.

**name** `string` *required*

The name of the environment.

**slug** `string` *required*

The environment's slug, which you use to select the environment in other calls.

**position** `number`

The environment's position in the project's list of environments, where `1` is first.

## Returns

**environment** `Environment`

The new environment, with its `id`, `name`, `slug`, and `position`.

```typescript Basic theme={"dark"}
const environment = await client.environments().create({
  projectId: "<project-id>",
  name: "QA",
  slug: "qa",
});
```

```typescript At a position theme={"dark"}
const environment = await client.environments().create({
  projectId: "<project-id>",
  name: "QA",
  slug: "qa",
  position: 2,
});
```

```json Response theme={"dark"}
{
  "id": "f7b5d4e2-0a6c-4d9b-2e1f-8c3b4a5f6e7d",
  "name": "QA",
  "slug": "qa",
  "position": 2,
  "projectId": "5e8d7c6b-4a3f-4e2d-9c1b-0a9f8e7d6c5b",
  "createdAt": "2026-12-02T10:47:55.318Z",
  "updatedAt": "2026-12-02T10:47:55.318Z"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.