Update an environment
Changes the key, name, color, or production setting of an environment. Omitted fields keep their current values. To change the order of environments, use the reorder environments endpoint.
Requires a management key.
Returns 404 if the environment does not exist and 409 if the new key is already in use.
bearerAuthorizationBearer <token>Send a credential in the Authorization header: Authorization: Bearer <token>.
Each credential belongs to one environment of one workspace, so the API never takes a workspace or environment in the URL.
- Management key (
ffk_…, secret): manages flags, segments, environments, and API keys, and reads the audit log and analytics. It can also do everything an evaluation key can. - Evaluation key (
ffk_…, secret): for server SDKs. It evaluates flags, reads flag definitions for local evaluation, and sends telemetry. - Public token (
ffp_…, not secret): for browser and mobile apps. It evaluates flags through OFREP and sends telemetry. It cannot read flag definitions.
Keep secret keys on your server. A 401 response means the credential is missing or not valid. A 403 response means the credential is valid but its role cannot perform the operation.
environmentId*stringThe environment ID, such as env_….
application/json- body
The fields to change. Omitted fields keep their current values.
key?|A new environment key, unique in the workspace.
name?|A new display name.
isProduction?|Whether the environment serves production traffic.
color?|The environment's display color in the dashboard. Defaults to gray.
OK
application/json- response
A deployment stage in a workspace, such as development or production. Each environment has its own flag values, enabled states, and targeting rules. Every API key belongs to one environment.
id*stringThe environment ID, such as env_….
tenantId*stringThe ID of the workspace that owns the environment.
isProduction?|Whether the environment serves production traffic.
position*integerThe environment's place in the workspace order, ascending. The dashboard lists environments in this order. A new environment goes last and copies flag values from the environment before it.
-9007199254740991 <= value <= 9007199254740991color?|The environment's display color in the dashboard. Defaults to gray.
key*stringThe environment key, unique in the workspace, such as production.
name*stringA display name for the environment.
createdAt*stringWhen the environment was created, as an ISO 8601 timestamp.
curl -X PATCH 'https://api.toggld.io/api/v1/environments/string' \ -H 'Content-Type: application/json' \ -d '{ "name": "Staging (EU)"}'{ "id": "env_3f6b2a9c-1d4e-4f7a-8b2c-5e9d0a1f3c7b", "tenantId": "t_5b9e2c4a-8f1d-4a7c-b3e6-9d0c2f5a8b1e", "isProduction": true, "position": 1, "color": "red", "key": "production", "name": "Production", "createdAt": "2026-05-01T12:00:00.000Z"}Create an environment POST
Creates an environment and its public token. The new environment goes last in the workspace order. Every existing flag gets a copy of its values from the environment before it, but starts off, with no targeting rules. Later changes in that environment do not affect the copy. Requires a management key. Returns `409` if the key is already in use.
Delete an environment DELETE
Permanently deletes an environment, with its flag configuration, API keys, and public token. Requests that use those credentials then fail with `401`. Requires a management key. Returns `404` if the environment does not exist. Returns `409` if it is the only environment in the workspace.