Skip to content
Docs

List segments

GEThttps://api.vercel.com/v1/projects/{projectIdOrName}/feature-flags/segments
List all feature flag segments for a project.
Request
import { Vercel } from "@vercel/sdk";
const vercel = new Vercel({
bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await vercel.featureFlags.listFlagSegments({
projectIdOrName: "<value>",
teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
slug: "my-team-url-slug",
});
console.log(result);
}
run();
Response
{
"data": [
{
"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",
"metadata": {
"creator": {
"id": "icfg_1234567890",
"name": "Example Name"
}
}
}
]
}
AuthorizationbearerToken

Default authentication mechanism

projectIdOrNamestringRequired
The project id or name
withMetadatabooleanOptional
Whether to include metadata
teamIdstringOptional
The Team identifier to perform the request on behalf of.
slugstringOptional
The Team slug to perform the request on behalf of.
200Success
dataarrayRequired
400One 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
410Error