Skip to main content
PUT
/
v1
/
projects
/
{projectIdOrName}
/
feature-flags
/
flags
createFlag
import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.featureFlags.createFlag({
    projectIdOrName: "<value>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();
{
  "variants": [
    {
      "value": "<string>",
      "id": "<string>",
      "description": "<string>",
      "label": "<string>"
    }
  ],
  "id": "<string>",
  "environments": {},
  "kind": "string",
  "revision": 123,
  "seed": 123,
  "state": "active",
  "slug": "<string>",
  "createdAt": 123,
  "updatedAt": 123,
  "createdBy": "<string>",
  "ownerId": "<string>",
  "projectId": "<string>",
  "typeName": "flag",
  "description": "<string>"
}

Authorizations

Authorization
string
header
required

Default authentication mechanism

Path Parameters

projectIdOrName
string
required

The project id or name

Query Parameters

teamId
string

The Team identifier to perform the request on behalf of.

Example:

"team_1a2b3c4d5e6f7g8h9i0j1k2l"

slug
string

The Team slug to perform the request on behalf of.

Example:

"my-team-url-slug"

Body

application/json
slug
string
required

A unique (per project) key for the flag, composed of letters, numbers, dashes, and underscores

kind
enum<string>
required

The kind of flag

Available options:
boolean,
string,
number
environments
object
required

The configuration for the flag in different environments

variants
object[]

The variants of the flag

seed
number

A random seed to prevent split points in different flags from having the same targets

Required range: 0 <= x <= 100000
description
string

A description of the flag

state
enum<string>
Available options:
active,
archived

Response

variants
object[]
required
id
string
required
environments
object
required
kind
enum<string>
required
Available options:
string,
number,
boolean
revision
number
required
seed
number
required
state
enum<string>
required
Available options:
active,
archived
slug
string
required
createdAt
number
required
updatedAt
number
required
createdBy
string
required
ownerId
string
required
projectId
string
required
typeName
enum<string>
required
Available options:
flag
description
string