---
title: "Update a flag"
method: PATCH
path: "/v1/projects/{projectIdOrName}/feature-flags/flags/{flagIdOrSlug}"
tags: ["feature-flags"]
---

# Update a flag

`PATCH /v1/projects/{projectIdOrName}/feature-flags/flags/{flagIdOrSlug}`

Update an existing feature flag. This endpoint supports partial updates, allowing you to modify specific properties like variants, environments, or state without providing the full flag configuration.

## Path parameters

- `projectIdOrName` string, required — The project id or name
- `flagIdOrSlug` string, required — The flag id or name

## Query parameters

- `ifMatch` string — Etag to match, can be used interchangeably with the `if-match` header
- `withMetadata` boolean — Whether to include metadata in the response
- `teamId` string
- `slug` string

## Request body

- object
  - `createdBy` string — The user who created this patch
  - `message` string — Additional message for this version
  - `variants` object[] — The variants of the flag
    - `id` string, required — The id of the variant
    - `label` string — A label for the variant
    - `description` string — A description of the variant
    - `value` union, required
      - string
      - number
      - boolean
      - object
      - unknown[]
        - unknown
      - string
  - `environments` object — The configuration for the flag in different environments
  - `seed` number — A random seed to prevent split points in different flags from having the same targets
  - `description` string — A description of the flag
  - `state` 'active' | 'archived'
  - `maintainerIds` string[] — The user ids of the maintainers of the flag
  - `permanent` boolean — Whether this flag is marked as permanent, indicating it should not be removed
  - `tags` string[] — Tags for categorizing the flag

## Response `200`

- union
  - object
    - `description` string
    - `maintainerIds` string[]
    - `permanent` false | true
    - `tags` string[]
    - `experiment` object
      - `id` string
      - `name` string
      - `numVariants` number
      - `surfaceArea` string
      - `stickyRequirement` false | true
      - `layer` string
      - `guardrailMetrics` object[]
        - `description` string
        - `metricFormula` string
        - `name` string, required
        - `metricType` 'count' | 'currency' | 'percentage', required
        - `metricUnit` 'session' | 'user' | 'visitor', required
        - `directionality` 'decreaseIsGood' | 'increaseIsGood', required
      - `hypothesis` string
      - `device` 'android' | 'desktop' | 'ios' | 'mweb'
      - `controlVariantId` string
      - `startedAt` number
      - `endedAt` number
      - `decision` string
      - `decisionReason` string
      - `duration` number
      - `durationUnit` 'days' | 'exposures'
      - `allocationPercent` number
      - `allocationUnit` 'cookieId' | 'userId' | 'visitorId', required
      - `primaryMetrics` object[], required
        - `description` string
        - `metricFormula` string
        - `name` string, required
        - `metricType` 'count' | 'currency' | 'percentage', required
        - `metricUnit` 'session' | 'user' | 'visitor', required
        - `directionality` 'decreaseIsGood' | 'increaseIsGood', required
      - `status` 'closed' | 'draft' | 'paused' | 'running', required
    - `updatedBy` string
    - `variants` object[], required
    - `id` string, required
    - `environments` object, required
    - `kind` 'boolean' | 'json' | 'number' | 'string', required
    - `revision` number, required
    - `seed` number, required
    - `state` 'active' | 'archived', required
    - `slug` string, required
    - `createdAt` number, required
    - `updatedAt` number, required
    - `createdBy` string, required
    - `ownerId` string, required
    - `projectId` string, required
    - `typeName` 'flag', required
  - Flag
    - `description` string
    - `maintainerIds` string[]
    - `permanent` false | true
    - `tags` string[]
    - `experiment` object
      - `id` string
      - `name` string
      - `numVariants` number
      - `surfaceArea` string
      - `stickyRequirement` false | true
      - `layer` string
      - `guardrailMetrics` object[]
        - `description` string
        - `metricFormula` string
        - `name` string, required
        - `metricType` 'count' | 'currency' | 'percentage', required
        - `metricUnit` 'session' | 'user' | 'visitor', required
        - `directionality` 'decreaseIsGood' | 'increaseIsGood', required
      - `hypothesis` string
      - `device` 'android' | 'desktop' | 'ios' | 'mweb'
      - `controlVariantId` string
      - `startedAt` number
      - `endedAt` number
      - `decision` string
      - `decisionReason` string
      - `duration` number
      - `durationUnit` 'days' | 'exposures'
      - `allocationPercent` number
      - `allocationUnit` 'cookieId' | 'userId' | 'visitorId', required
      - `primaryMetrics` object[], required
        - `description` string
        - `metricFormula` string
        - `name` string, required
        - `metricType` 'count' | 'currency' | 'percentage', required
        - `metricUnit` 'session' | 'user' | 'visitor', required
        - `directionality` 'decreaseIsGood' | 'increaseIsGood', required
      - `status` 'closed' | 'draft' | 'paused' | 'running', required
    - `updatedBy` string
    - `variants` object[], required
    - `id` string, required
    - `environments` object, required
    - `kind` 'boolean' | 'json' | 'number' | 'string', required
    - `revision` number, required
    - `seed` number, required
    - `state` 'active' | 'archived', required
    - `slug` string, required
    - `createdAt` number, required
    - `updatedAt` number, required
    - `createdBy` string, required
    - `ownerId` string, required
    - `projectId` string, required
    - `typeName` 'flag', required
    - `metadata` object
      - `creator` object
        - `id` string, required
        - `name` string, required

## Other responses

- `304`
- `400` — One of the provided values in the request body is invalid. One of the provided values in the request query is invalid.
- `401` — The request is not authorized.
- `402` — The account is missing a payment so payment method must be updated
- `403` — You do not have permission to access this resource.
- `404`
- `409`
- `410`

---

[API](https://skmtc.net/vercel/apis/api.md) · [All operations](https://skmtc.net/vercel/apis/api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/vercel/api/versions/61d1ba3f6dac/schema)
