Skip to content
Docs

Update a flag

PATCHhttps://api.vercel.com/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.
https://api.vercel.com/v1/projects/{projectIdOrName}/feature-flags/flags/{flagIdOrSlug}
const response = await fetch('https://api.vercel.com/v1/projects/projectIdOrName/feature-flags/flags/flagIdOrSlug?ifMatch=string&withMetadata=true&teamId=string&slug=string', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"createdBy": "string",
"message": "string",
"variants": [
{
"id": "icfg_1234567890",
"label": "string",
"description": "string",
"value": "string"
}
],
"environments": "value",
"seed": "123",
"description": "string",
"state": "active",
"maintainerIds": [],
"permanent": "true",
"tags": []
}),
});
const data = await response.json();
console.log(data);
Response
{
"createdAt": "123",
"createdBy": "string",
"description": "string",
"environments": "value",
"id": "icfg_1234567890",
"kind": "boolean",
"maintainerIds": [],
"ownerId": "example_id",
"permanent": "false",
"projectId": "example_id",
"revision": "123",
"seed": "123",
"slug": "string",
"state": "active",
"tags": [],
"typeName": "flag",
"updatedAt": "123",
"updatedBy": "string",
"variants": [
{
"description": "string",
"id": "icfg_1234567890",
"label": "string",
"value": "string"
}
]
}
AuthorizationbearerToken

Default authentication mechanism

projectIdOrNamestringRequired
The project id or name
flagIdOrSlugstringRequired
The flag id or name
ifMatchstringOptional
Etag to match, can be used interchangeably with the if-match header
withMetadatabooleanOptional
Whether to include metadata in the response
teamIdstringOptional
The Team identifier to perform the request on behalf of.
slugstringOptional
The Team slug to perform the request on behalf of.
application/json
createdBystringOptional
The user who created this patch
messagestringOptional
Additional message for this version
variantsarrayOptional
The variants of the flag
environmentsobjectOptional
The configuration for the flag in different environments
seednumberOptional
A random seed to prevent split points in different flags from having the same targets
descriptionstringOptional
A description of the flag
statestringOptional
maintainerIdsarrayOptional
The user ids of the maintainers of the flag
permanentbooleanOptional
Whether this flag is marked as permanent, indicating it should not be removed
tagsarrayOptional
Tags for categorizing the flag
200Success
createdAtnumberRequired
createdBystringRequired
descriptionstringOptional
environmentsobjectRequired
idstringRequired
kindstringRequired
maintainerIdsarrayOptional
ownerIdstringRequired
permanentbooleanOptional
projectIdstringRequired
revisionnumberRequired
seednumberRequired
slugstringRequired
statestringRequired
tagsarrayOptional
typeNamestringRequired
updatedAtnumberRequired
updatedBystringOptional
variantsarrayRequired
400One of the provided values in the request body is invalid. One of the provided values in the request query is invalid.
401The request is not authorized.
402The account is missing a payment so payment method must be updated
403You do not have permission to access this resource.
404Error
409Error
410Error