---
title: "Create (overwrite) variants for a feature flag in multiple environments"
method: PUT
path: "/api/admin/projects/{projectId}/features/{featureName}/variants-batch"
tags: ["Features"]
---

# Create (overwrite) variants for a feature flag in multiple environments

`PUT /api/admin/projects/{projectId}/features/{featureName}/variants-batch`

This overwrites the current variants for the feature flag in the :featureName parameter for the :environment parameter.

## Path parameters

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

## Request body

- PushVariantsSchema — Data used when copying variants into a new environment.
  - `variants` VariantSchema[] — The variants to write to the provided environments
    - `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
  - `environments` string[] — The enviromnents to write the provided variants to

## 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

---

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