Update a flag
PATCH
https://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
application/json
A random seed to prevent split points in different flags from having the same targets
200Success
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