---
title: "Create environment"
method: POST
path: "/api/v1/environments"
tags: ["Environments"]
---

# Create environment

`POST /api/v1/environments`

Creates a server-owned environment definition in the environment catalog.
REST environment requests only accept inline Dockerfile content; local
Dockerfile paths are supported by workflow/settings files but rejected
by this API.

## Request body

- CreateEnvironmentRequest — Request body for creating a server-managed environment.
  - `id` string, required
  - `provider` 'local' | 'docker' | 'daytona', required — Desired environment provider.
  - `cwd` string, nullable — Local-provider command working directory for this environment. Docker and Daytona ignore this value.
  - `image` EnvironmentApiImageSettings, required — REST-safe environment image settings. Dockerfile sources are inline-only; local paths are rejected by the REST API.
    - `docker` string, nullable, required
    - `dockerfile` EnvironmentApiDockerfileSourceInline, required
      - `type` 'inline', required
      - `value` string, required
  - `resources` EnvironmentResourcesSettings, required
    - `cpu` integer, nullable, required
    - `memory` string, nullable, required
    - `disk` string, nullable, required
  - `network` EnvironmentNetworkSettings, required
    - `mode` 'allow_all' | 'block' | 'cidr_allow_list', required
    - `allow` string[], required
  - `lifecycle` EnvironmentLifecycleSettings, required
    - `preserve` boolean, required
    - `stop_on_terminal` boolean, required
    - `auto_stop` string, nullable, required
  - `labels` StringMap, required
  - `env` object, required

## Response `201`

Environment created

- Environment — Public server-managed environment definition.
  - `id` string, required
  - `revision` string, required — Stable revision used with `If-Match` for optimistic concurrency.
  - `provider` 'local' | 'docker' | 'daytona', required — Desired environment provider.
  - `cwd` string, nullable — Local-provider command working directory for this environment. Docker and Daytona ignore this value.
  - `image` EnvironmentApiImageSettings, required — REST-safe environment image settings. Dockerfile sources are inline-only; local paths are rejected by the REST API.
    - `docker` string, nullable, required
    - `dockerfile` EnvironmentApiDockerfileSourceInline, required
      - `type` 'inline', required
      - `value` string, required
  - `resources` EnvironmentResourcesSettings, required
    - `cpu` integer, nullable, required
    - `memory` string, nullable, required
    - `disk` string, nullable, required
  - `network` EnvironmentNetworkSettings, required
    - `mode` 'allow_all' | 'block' | 'cidr_allow_list', required
    - `allow` string[], required
  - `lifecycle` EnvironmentLifecycleSettings, required
    - `preserve` boolean, required
    - `stop_on_terminal` boolean, required
    - `auto_stop` string, nullable, required
  - `labels` StringMap, required
  - `env` object, required

## Other responses

- `400` — Malformed JSON request body
- `409` — Environment id already exists
- `422` — Environment failed domain validation
- `500` — Environment store operation failed

---

[API](https://skmtc.net/fabro-sh/apis/fabro-run-api.md) · [All operations](https://skmtc.net/fabro-sh/apis/fabro-run-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/fabro-sh/fabro-run-api/versions/bee030053823/schema)
