---
title: "Update a variant"
method: PUT
path: "/api/v2/feature-flags/{feature_flag_id}/variants/{variant_id}"
tags: ["Feature Flags"]
---

# Update a variant

`PUT /api/v2/feature-flags/{feature_flag_id}/variants/{variant_id}`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/feature-flags/{feature_flag_id}/variants/{variant_id}`
- Auth: API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`

Updates the name and value of an existing variant on a feature flag.

When backend approvals are enabled and the flag requires approval, this endpoint creates and returns a `FlagSuggestion` with `201 Created` instead of applying the change immediately. Use the returned suggestion `id` to approve or reject the change. If a pending suggestion already exists for this flag's variant property, the endpoint returns `409 Conflict`.

## Path parameters

- `feature_flag_id` string, uuid, required
- `variant_id` string, uuid, required

## Request body

- UpdateVariantRequest: Request to update an existing variant's name and value.
  - `name` string: The display name of the variant.
  - `value` string: The value of the variant as a string.

## Response `200`

OK

- Variant: A variant of a feature flag.
  - `created_at` string, date-time: The timestamp when the variant was created.
  - `id` string, uuid, required: The unique identifier of the variant.
  - `key` string, required: The unique key of the variant.
  - `name` string, required: The name of the variant.
  - `updated_at` string, date-time: The timestamp when the variant was last updated.
  - `value` string, required: The value of the variant as a string.

## Other responses

- `400`: Bad Request
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict - A pending suggestion already exists for this property.
- `429`: Too many requests

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/da68bf029e4c?raw)
