---
title: "Create environment"
method: POST
path: "/v1/workspaces/{workspaceId}/environments"
---

# Create environment

`POST /v1/workspaces/{workspaceId}/environments`

## Path parameters

- `workspaceId` string, required

## Request body

- CreateEnvironmentRequest
  - `description` string
  - `metadata` object
  - `name` string, required
  - `resourceSelector` string — CEL expression to determine if the environment should be used

## Response `202`

Accepted response

- EnvironmentRequestAccepted
  - `id` string, required
  - `message` string, required

## Other responses

- `400` — Invalid request
- `409` — Environment name already exists in this workspace

## Changes

- **2026-04-23** `0cff1d88d064` — 2 info
  - added the non-success response with the status `400`
  - added the non-success response with the status `409`
- **2026-03-11** `ac4f338f40a7` — 2 breaking
  - removed `#/components/schemas/JsonSelector, #/components/schemas/CelSelector` from the `resourceSelector` request property `oneOf` list
  - the `resourceSelector` request property type/format changed from ``/`` to `string`/``
- **2026-02-19** `e61389fc98ac` — 1 breaking, 3 info
  - the `resourceSelector` request property type/format changed from `string`/`` to ``/``
  - added `#/components/schemas/JsonSelector, #/components/schemas/CelSelector` to the `resourceSelector` request property `oneOf` list
  - removed the non-success response with the status `400`
  - removed the non-success response with the status `409`

[Change history](https://skmtc.dev/ctrlplanedev/apis/ctrlplane-api/changes/v1/workspaces/:workspaceId/environments/post.md)

---

[API](https://skmtc.dev/ctrlplanedev/apis/ctrlplane-api.md) · [All operations](https://skmtc.dev/ctrlplanedev/apis/ctrlplane-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ctrlplanedev/ctrlplane-api/revisions/156e0d264995/schema)
