Update a segment
PATCH
https://api.vercel.com/v1/projects/{projectIdOrName}/feature-flags/segments/{segmentIdOrSlug}Update an existing feature flag segment.
https://api.vercel.com/v1/projects/{projectIdOrName}/feature-flags/segments/{segmentIdOrSlug}
const response = await fetch('https://api.vercel.com/v1/projects/projectIdOrName/feature-flags/segments/segmentIdOrSlug?withMetadata=true&teamId=string&slug=string', { method: 'PATCH', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', }, body: JSON.stringify({ "operations": [ { "action": "add", "field": "include", "entity": "string", "attribute": "string", "value": { "note": "string", "value": "string" } } ], "label": "string", "description": "string", "data": { "rules": [ { "id": "icfg_1234567890", "conditions": [ { "lhs": { "type": "value" }, "cmp": "eq", "rhs": { "type": "list/inline", "items": [ { "label": "string", "note": "string", "value": "123" } ] }, "cmpOptions": { "ignoreCase": "true" } } ], "outcome": { "type": "value" } } ], "include": "value", "exclude": "value" }, "hint": "string" }),});
const data = await response.json();console.log(data);Response
{ "description": "string", "createdBy": "string", "usedByFlags": [], "usedBySegments": [], "data": { "rules": [ { "id": "icfg_1234567890", "outcome": { "type": "all" }, "conditions": [ { "rhs": "string", "cmpOptions": { "ignoreCase": "false" }, "lhs": { "type": "segment" }, "cmp": "!contains" } ] } ], "include": "value", "exclude": "value" }, "id": "icfg_1234567890", "label": "string", "slug": "string", "createdAt": "123", "updatedAt": "123", "projectId": "example_id", "typeName": "segment", "hint": "string"}AuthorizationbearerToken
Default authentication mechanism
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