---
title: "Update a workspace flag"
method: POST
path: "/v2/workspace.updateFlag"
tags: ["workspace"]
---

# Update a workspace flag

`POST /v2/workspace.updateFlag`

## Request

- Base URL: `https://api.unkey.com`
- URL: `https://api.unkey.com/v2/workspace.updateFlag`
- Auth: HTTP bearer

Enable or disable a flag for your workspace. Use `workspace.getFlags` to
find flag slugs and check whether they can be enabled or disabled.

**Required Permissions**

Your root key must have the following permission:
- `unkey:v1:<workspace_id>:flags#write`

## Request body

- V2WorkspaceUpdateFlagRequestBody
  - `slug` string, required: Lowercase snake_case slug of the flag to update, as returned by `workspace.getFlags`.
  - `enabled` boolean, required: Set to true to enable the flag or false to disable it, regardless of the flag's default.

## Response `200`

Flag updated successfully. The data object is empty.

- V2WorkspaceUpdateFlagResponseBody
  - `meta` Meta, required: Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
    - `requestId` string, required: A unique id for this request. Always include this ID when contacting support about a specific API request. This identifier allows Unkey's support team to trace the exact request through logs and diagnostic systems to provide faster assistance.
  - `data` EmptyResponse, required: Empty response object by design. A successful response indicates this operation was successfully executed.

## Other responses

- `400`: Invalid request.
- `401`: Unauthorized.
- `403`: Missing write permission, or the flag cannot be enabled or disabled as requested.
- `404`: No flag exists with the supplied slug.
- `429`: Too Many Requests.
- `500`: Internal server error.

## Changes

- **2026-10-13** `ea655ceb16a3`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/unkeyed/apis/unkey-api/changes/v2/workspace.updateFlag/post.md)

---

[API](https://skmtc.dev/unkeyed/apis/unkey-api.md) - [All operations](https://skmtc.dev/unkeyed/apis/unkey-api/llms.txt) - [OpenAPI document](https://skmtc.dev/unkeyed/apis/unkey-api/revisions/6fbaa27f19e0?raw)
