---
title: "Update Environment"
method: PATCH
path: "/v1/environments/{id}"
tags: ["Environments"]
---

# Update Environment

`PATCH /v1/environments/{id}`

Updates a non-global environment. Only provided fields are changed. `PATCH /v1/environments/global` returns 400 with a pointer to the nested resource endpoints (variables, files, skills, MCPs, warm hooks) — the Global env's metadata cannot be edited directly. Source-backed personal environments cannot change `repository_id`, `repository_set_id`, or `system_prompt`, but may set `personal_preferences`, instructions appended after the inherited system prompt. Returns 409 when an automation still references the environment in a way that blocks the requested change.

## Path parameters

- `id` string, required

## Request body

- UpdateEnvironmentRequest — Request body for updating an environment. Only provided fields are changed. `repository_id` and `repository_set_id` remain mutually exclusive when both are supplied.
  - `name` string
  - `description` string, nullable
  - `repository_id` string, uuid, nullable
  - `repository_set_id` string, uuid, nullable
  - `system_prompt` string, nullable
  - `mobile_testing_enabled` boolean — Enable or disable mobile testing. Only valid on team environments; enabling requires a Team or Enterprise plan and otherwise returns `PLAN_UPGRADE_REQUIRED`.
  - `personal_preferences` string, nullable — Only settable on personal environments. Appended after the (inherited) system prompt.

## Response `200`

Environment updated

- EnvironmentResponse
  - `environment` Environment, required — An environment — the config bundle workspaces are created from. Holds an optional repository binding plus the runtime variables, files, skills, MCPs, and warm hook applied to every workspace built from it. Every organization has a singleton Global environment (`is_global: true`) whose values are layered onto every other environment. Personal environments have `user_id` set and are visible only to their owner. Source-backed personal environments expose source-derived repository binding and system prompt values while keeping the source link in `source_environment_id`.
    - `id` string, uuid, required — Unique identifier
    - `organization_id` string, uuid, required — Owning organization
    - `user_id` string, uuid, nullable, required — Owning user for personal environments. Null for team environments.
    - `name` string, required — Human-readable name
    - `description` string, nullable, required — Optional description
    - `is_global` boolean, required — True for the org's singleton Global environment, whose values apply to every workspace. Global envs cannot be deleted, cannot be edited via PATCH, and have no repository binding.
    - `repository_id` string, uuid, nullable, required — Bound repository ID. Mutually exclusive with `repository_set_id`. Both null = unbound repo-less workspace.
    - `repository_set_id` string, uuid, nullable, required — Bound repository set ID. Mutually exclusive with `repository_id`.
    - `system_prompt` string, nullable, required — Optional system prompt prepended to every workspace's coding agent.
    - `mobile_testing_enabled` boolean, required — Whether workspaces from this environment receive mobile simulator access. Available on Team and Enterprise plans and configurable only on team environments.
    - `personal_preferences` string, nullable, required — User-authored instructions appended after the (inherited) system prompt. Only settable on personal environments, and editable even when source-backed.
    - `source_environment_id` string, uuid, nullable, required — Source team environment for source-backed personal environments. Null for standalone personal environments and team environments.
    - `variable_count` integer — Number of variables attached to this environment
    - `file_count` integer — Number of files
    - `skill_count` integer — Number of enabled skills
    - `mcp_count` integer — Number of MCPs
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required

## Other responses

- `400` — Bad request - Missing or invalid parameters
- `401` — Unauthorized - Invalid or missing API key
- `404` — Resource not found
- `409` — Conflict - Resource already exists or operation conflicts with current state
- `500` — Internal server error

---

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