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

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

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

  console.log(result);
}

run();
{
  "id": "<string>",
  "label": "<string>",
  "slug": "<string>",
  "createdAt": 123,
  "updatedAt": 123,
  "projectId": "<string>",
  "typeName": "segment",
  "data": {
    "rules": [
      {
        "id": "<string>",
        "outcome": {
          "type": "all"
        },
        "conditions": [
          {
            "lhs": {
              "type": "segment"
            },
            "cmp": "eq",
            "rhs": "<string>"
          }
        ]
      }
    ],
    "include": {},
    "exclude": {}
  },
  "hint": "<string>",
  "description": "<string>",
  "createdBy": "<string>",
  "usedByFlags": [
    "<string>"
  ],
  "usedBySegments": [
    "<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
label
string
required
data
object
required

The data of the segment

hint
string
required
createdBy
string

The entity who created the segment

description
string

Response

id
string
required
label
string
required
slug
string
required
createdAt
number
required
updatedAt
number
required
projectId
string
required
typeName
enum<string>
required
Available options:
segment
data
object
required
hint
string
required
description
string
createdBy
string
usedByFlags
string[]
usedBySegments
string[]