Create a flag
PUT
/__remote/api.vercel.com/v1/projects/{projectIdOrName}/feature-flags/flagsCreate a new feature flag for a project. The flag must have a unique slug within the project and specify its kind (boolean, string, number, or json).
/__remote/api.vercel.com/v1/projects/{projectIdOrName}/feature-flags/flags
const response = await fetch('/__remote/api.vercel.com/v1/projects/projectIdOrName/feature-flags/flags?teamId=string&slug=string', { method: 'PUT', headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json', }, body: JSON.stringify({ "slug": "string", "kind": "boolean", "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", "seenInProduction": "false", "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 unique (per project) key for the flag, composed of letters, numbers, dashes, and underscores
A random seed to prevent split points in different flags from having the same targets
201Success
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