---
title: "Change a feature environment safeguard"
method: PUT
path: "/api/admin/projects/{project}/features/{featureName}/environments/{environment}/safeguards"
tags: ["Features"]
---

# Change a feature environment safeguard

`PUT /api/admin/projects/{project}/features/{featureName}/environments/{environment}/safeguards`

**Enterprise feature**

Creates or updates a safeguard for a specific feature and environment.

## Path parameters

- `project` string, required
- `featureName` string, required
- `environment` string, required

## Request body

- CreateSafeguardSchema — Request body to create a safeguard with metric-based alert condition.
  - `impactMetric` object, required — Metric configuration that should be evaluated for the safeguard.
    - `metricName` string, required — The Prometheus metric series to query. It includes both unleash prefix and metric type and display name
    - `timeRange` 'hour' | 'day' | 'week' | 'month', required — The time range for the metric data.
    - `aggregationMode` 'rps' | 'count' | 'avg' | 'sum' | 'p95' | 'p99' | 'p50', required — The aggregation mode for the metric data.
    - `labelSelectors` object, required — The selected labels and their values for filtering the metric data.
    - `source` 'internal' | 'external' — The Prometheus data source for this metric. Internal is the Unleash-managed Prometheus, external is a customer-provided Prometheus instance. Defaults to internal if not specified.
  - `triggerCondition` SafeguardTriggerConditionSchema, required — The condition that triggers the safeguard.
    - `operator` '>' | '<', required — The comparison operator for the threshold check.
    - `threshold` number, required — The threshold value to compare against.

## Response `204`

This response has no body.

## Other responses

- `401` — Authorization information is missing or invalid. Provide a valid API token as the `authorization` header, e.g. `authorization:*.*.my-admin-token`.
- `403` — The provided user credentials are valid, but the user does not have the necessary permissions to perform this operation

## Changes

- **2026-06-15** `774670258f04` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/unleash/apis/unleash-api-3/changes/api/admin/projects/:project/features/:featureName/environments/:environment/safeguards/put.md)

---

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