---
title: "Patch a feature's variants in an environment"
method: PATCH
path: "/api/admin/projects/{projectId}/features/{featureName}/environments/{environment}/variants"
tags: ["Features"]
---

# Patch a feature's variants in an environment

`PATCH /api/admin/projects/{projectId}/features/{featureName}/environments/{environment}/variants`

Apply a list of patches to the features environments in the specified environment. The patch objects should conform to the [JSON-patch format (RFC 6902)](https://www.rfc-editor.org/rfc/rfc6902).

## Path parameters

- `projectId` string, required
- `featureName` string, required
- `environment` string, required

## Request body

- PatchSchema[] — A list of patches
  - `path` string, required — The path to the property to operate on
  - `op` 'add' | 'remove' | 'replace' | 'copy' | 'move' | 'test', required — The kind of operation to perform
  - `from` string — The target to move or copy from, if performing one of those operations
  - `value` string — The value to add or replace, if performing one of those operations

## Response `200`

featureVariantsSchema

- FeatureVariantsSchema — A versioned collection of feature flag variants.
  - `version` integer, required — The version of the feature variants schema.
  - `variants` VariantSchema[], required — All variants defined for a specific feature flag.
    - `name` string, required — The variants name. Is unique for this feature flag
    - `weight` number, required — The weight is the likelihood of any one user getting this variant. It is a number between 0 and 1000. See the section on [variant weights](https://docs.getunleash.io/concepts/feature-flag-variants#variant-weight) for more information
    - `weightType` 'variable' | 'fix' — Set to fix if this variant must have exactly the weight allocated to it. If the type is variable, the weight will adjust so that the total weight of all variants adds up to 1000
    - `stickiness` string — [Stickiness](https://docs.getunleash.io/concepts/feature-flag-variants#variant-stickiness) is how Unleash guarantees that the same user gets the same variant every time
    - `payload` object — Extra data configured for this variant
      - `type` 'json' | 'csv' | 'string' | 'number', required — The type of the value. Commonly used types are string, number, json and csv.
      - `value` string, required — The actual value of payload
    - `overrides` OverrideSchema[] — Overrides assigning specific variants to specific users. The weighting system automatically assigns users to specific groups for you, but any overrides in this list will take precedence.
      - `contextName` string, required — The name of the context field used to determine overrides
      - `values` string[], required — Which values that should be overriden

## Other responses

- `400` — The request data does not match what we expect.
- `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
- `404` — The requested resource was not found.

---

[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)
