---
title: list-segments
product: vercel
url: /docs/rest-api/feature-flags/list-segments
type: reference
prerequisites:
  []
related:
  - /docs/rest-api
summary: Learn about list-segments on Vercel.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# List segments

```http
GET /v1/projects/{projectIdOrName}/feature-flags/segments
```

List all feature flag segments for a project.

## Authentication

**bearerToken**: HTTP bearer

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `projectIdOrName` | string | Yes | The project id or name |


## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `withMetadata` | boolean. default: false | No | Whether to include metadata |
| `teamId` | string | No | The Team identifier to perform the request on behalf of. |
| `slug` | string | No | The Team slug to perform the request on behalf of. |


## Responses

### 200: No description

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "data"
  ],
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "createdAt",
          "data",
          "hint",
          "id",
          "label",
          "projectId",
          "slug",
          "typeName",
          "updatedAt"
        ],
        "properties": {
          "description": {
            "type": "string"
          },
          "createdBy": {
            "type": "string"
          },
          "usedByFlags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "usedBySegments": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "createdAt": {
            "type": "number"
          },
          "updatedAt": {
            "type": "number"
          },
          "projectId": {
            "type": "string"
          },
          "typeName": {
            "type": "string",
            "enum": [
              "segment"
            ]
          },
          "data": {
            "type": "object",
            "properties": {
              "rules": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "conditions",
                    "id",
                    "outcome"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "outcome": {
                      "oneOf": [
                        {
                          "type": "object",
                          "required": [
                            "type"
                          ],
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "all"
                              ]
                            }
                          }
                        },
                        {
                          "type": "object",
                          "required": [
                            "base",
                            "passPromille",
                            "type"
                          ],
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "split"
                              ]
                            },
                            "base": {
                              "type": "object",
                              "required": [
                                "attribute",
                                "kind",
                                "type"
                              ],
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "entity"
                                  ]
                                },
                                "kind": {
                                  "type": "string"
                                },
                                "attribute": {
                                  "type": "string"
                                }
                              }
                            },
                            "passPromille": {
                              "type": "number"
                            }
                          }
                        }
                      ]
                    },
                    "conditions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "cmp",
                          "lhs"
                        ],
                        "properties": {
                          "rhs": {
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "number"
                              },
                              {
                                "type": "object",
                                "required": [
                                  "items",
                                  "type"
                                ],
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "list/inline",
                                      "list"
                                    ]
                                  },
                                  "items": {
                                    "type": "array",
                                    "items": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "required": [
                                            "value"
                                          ],
                                          "properties": {
                                            "label": {
                                              "type": "string"
                                            },
                                            "note": {
                                              "type": "string"
                                            },
                                            "value": {
                                              "type": "number"
                                            }
                                          }
                                        },
                                        {
                                          "type": "object",
                                          "required": [
                                            "value"
                                          ],
                                          "properties": {
                                            "label": {
                                              "type": "string"
                                            },
                                            "note": {
                                              "type": "string"
                                            },
                                            "value": {
                                              "type": "string"
                                            }
                                          }
                                        }
                                      ]
                                    }
                                  }
                                }
                              },
                              {
                                "type": "object",
                                "required": [
                                  "flags",
                                  "pattern",
                                  "type"
                                ],
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "regex"
                                    ]
                                  },
                                  "pattern": {
                                    "type": "string"
                                  },
                                  "flags": {
                                    "type": "string"
                                  }
                                }
                              },
                              {
                                "type": "boolean",
                                "enum": [
                                  false,
                                  true
                                ]
                              }
                            ]
                          },
                          "cmpOptions": {
                            "type": "object",
                            "properties": {
                              "ignoreCase": {
                                "type": "boolean",
                                "enum": [
                                  false,
                                  true
                                ]
                              }
                            }
                          },
                          "lhs": {
                            "oneOf": [
                              {
                                "type": "object",
                                "required": [
                                  "type"
                                ],
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "segment"
                                    ]
                                  }
                                }
                              },
                              {
                                "type": "object",
                                "required": [
                                  "attribute",
                                  "kind",
                                  "type"
                                ],
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "entity"
                                    ]
                                  },
                                  "kind": {
                                    "type": "string"
                                  },
                                  "attribute": {
                                    "type": "string"
                                  }
                                }
                              }
                            ]
                          },
                          "cmp": {
                            "type": "string",
                            "enum": [
                              "eq",
                              "!eq",
                              "oneOf",
                              "!oneOf",
                              "containsAllOf",
                              "containsAnyOf",
                              "containsNoneOf",
                              "startsWith",
                              "!startsWith",
                              "endsWith",
                              "!endsWith",
                              "contains",
                              "!contains",
                              "ex",
                              "!ex",
                              "gt",
                              "gte",
                              "lt",
                              "lte",
                              "regex",
                              "!regex",
                              "before",
                              "after"
                            ]
                          }
                        }
                      }
                    }
                  }
                }
              },
              "include": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "value"
                      ],
                      "properties": {
                        "note": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              "exclude": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "value"
                      ],
                      "properties": {
                        "note": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "hint": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "properties": {
              "creator": {
                "type": "object",
                "required": [
                  "id",
                  "name"
                ],
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
```

### 400: One of the provided values in the request query is invalid.

### 401: The request is not authorized.

### 402: The account was soft-blocked for an unhandled reason.
The account is missing a payment so payment method must be updated

### 403: You do not have permission to access this resource.

### 404: No description

---

## Related

- [feature-flags endpoints](/docs/rest-api#feature-flags)

- [REST API overview](/docs/rest-api)

- [OpenAPI spec](https://openapi.vercel.sh/) (machine-readable, all endpoints)

---

[View full sitemap](/docs/sitemap)
