v7

latestOpenAPI 3.0.3raw.githubusercontent.com2026-08-013764062.2 MB
Segments

Create a new segment

Creates a new segment using the payload provided

post/api/admin/segments

Request body

namestring required

The name of the segment

descriptionstring nullable

A description of what the segment is for

projectstring nullable

The project the segment belongs to if any.

Example request

{
  "name": "beta-users",
  "description": "Users willing to help us test and build new features.",
  "project": "red-vista",
  "constraints": [
    {
      "contextName": "appName",
      "operator": "IN",
      "values": [
        "my-app",
        "my-other-app"
      ],
      "value": "my-app"
    }
  ]
}

Response

The resource was successfully created.

idinteger required

The ID of this segment

namestring required

The name of this segment

descriptionstring nullable

The description for this segment

usedInFeaturesinteger nullable

The number of feature flags that use this segment. The number also includes the any flags with pending change requests that would add this segment.

usedInProjectsinteger nullable

The number of projects that use this segment. The number includes any projects with pending change requests that would add this segment.

projectstring nullable

The project the segment belongs to. Only present if the segment is a project-specific segment.

createdBystring nullable

The creator's email or username

createdAtstring date-time required

When the segment was created

Example response

{
  "id": 2,
  "name": "ios-users",
  "description": "IOS users segment",
  "constraints": [
    {
      "contextName": "appName",
      "operator": "IN",
      "values": [
        "my-app",
        "my-other-app"
      ],
      "value": "my-app"
    }
  ],
  "usedInFeatures": 3,
  "usedInProjects": 2,
  "project": "red-vista",
  "createdBy": "someone@example.com",
  "createdAt": "2023-04-12T11:13:31.960Z"
}