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

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

async function run() {
  const result = await vercel.featureFlags.getFlagSegment({
    projectIdOrName: "<value>",
    segmentIdOrSlug: "<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>"
  ],
  "metadata": {
    "creator": {
      "id": "<string>",
      "name": "<string>"
    }
  }
}

Authorizations

Authorization
string
header
required

Default authentication mechanism

Path Parameters

projectIdOrName
string
required

The project id or name

segmentIdOrSlug
string
required

The segment slug

Query Parameters

withMetadata
boolean
default:false

Whether to include metadata

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"

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[]
metadata
object