---
title: "Create Segment"
method: POST
path: "/console/v1/segments"
tags: ["Segments"]
---

# Create Segment

`POST /console/v1/segments`

## Request body

- SegmentCreateContractDto
  - `name` string, required — name of the segment
  - `id` string — optional id of the segment (defaults to name)
  - `description` string — description of the segment
  - `type` 'id_list' | 'rule_based' | 'analysis_list' | 'user_store_id_list', required — type of the segment
  - `idType` string — type of id
  - `tags` string[] — optional tags for categorization
  - `creatorID` string, nullable — the Statsig ID of the creator of this segment
  - `creatorEmail` string, nullable — the email of the creator of this segment
  - `team` string, nullable — optional name identifier for the responsible team (enterprise only)
  - `teamID` string, nullable — optional identifier for the responsible team (enterprise only)
  - `rules` object[] — Rule Object
    - `name` string, required — The name of this rule.
    - `passPercentage` number, required — Of the users that meet the conditions of this rule, what percent should return true.
    - `conditions` object[], required
      - `targetValue` union
        - string[]
        - number[]
        - string
        - number
      - `operator` string
      - `field` string, nullable
      - `customID` string, nullable
      - `type` 'app_version' | 'browser_name' | 'browser_version' | 'country' | 'custom_field' | 'email' | 'environment_tier' | 'fails_segment' | 'ip_address' | 'os_name' | 'os_version' | 'passes_segment' | 'unit_id' | 'user_id', required
    - `environments` string[], nullable — The environments this rule is enabled for.
    - `id` string — The Statsig ID of this rule.
    - `baseID` string — The base ID of this rule, i.e. without any added metadata. Will remain the exact same throughout
    - `returnValue` object — The return value of the rule.
    - `completedAutomatedRollouts` object[] — Read-only: Automated rollout phases that have already completed.
      - `time` number
      - `passPercent` number, required
    - `pendingAutomatedRollouts` object[] — Read-only: Automated rollout phases that are scheduled but not yet complete.
      - `time` number
      - `passPercent` number, required

## Response `201`

Create Segment Success

- object
  - `message` string, required — A simple string explaining the result of the operation.
  - `data` object, required — A single result.
    - `isEnabled` boolean, required — Is the segment enabled.
    - `type` 'id_list' | 'rule_based' | 'analysis_list' | 'user_store_id_list', required
    - `count` number, double — For id_list segments: the length of the ID list
    - `rules` object[] — Rule Object
      - `name` string, required — The name of this rule.
      - `passPercentage` number, required — Of the users that meet the conditions of this rule, what percent should return true.
      - `conditions` object[], required — An array of Condition objects.
        - `targetValue` union
          - string[]
          - number[]
          - string
          - number
        - `operator` string
        - `field` string, nullable
        - `customID` string, nullable
        - `type` 'app_version' | 'browser_name' | 'browser_version' | 'country' | 'custom_field' | 'email' | 'environment_tier' | 'fails_gate' | 'fails_segment' | 'ip_address' | 'locale' | 'os_name' | 'os_version' | 'passes_gate' | 'passes_segment' | 'public' | 'time' | 'unit_id' | 'user_id' | 'user_agent' | 'url' | 'javascript' | 'device_model' | 'target_app' | 'experiment_group', required
      - `environments` string[], nullable — The environments this rule is enabled for.
      - `id` string — The Statsig ID of this rule.
      - `baseID` string — The base ID of this rule, i.e. without any added metadata. Will remain the exact same throughout
      - `returnValue` object — The return value of the rule.
    - `tags` string[] — Optional tags for categorization.
    - `id` string, required — ID
    - `name` string — Optional name for the configuration.
    - `idType` string, required — Type of ID
    - `description` string, required — Detailed description of the configuration’s purpose.
    - `lastModifierID` string, nullable, required — ID of the last modifier.
    - `lastModifiedTime` number, double, nullable, required — Time of the last modification.
    - `lastModifierEmail` string, nullable, required — Email of the last modifier.
    - `lastModifierName` string, nullable, required — Name of the last modifier.
    - `creatorID` string, nullable, required — ID of the user who created the entity.
    - `createdTime` number, double, required — Timestamp when the entity was created.
    - `creatorName` string, nullable, required — Name of the creator.
    - `creatorEmail` string, nullable, required — Email of the creator.
    - `targetApps` string[] — List of target applications associated with this configuration.
    - `holdoutIDs` string[] — Holdouts applied to this configuration.
    - `team` string, nullable — Optional name for the responsible team.
    - `teamID` string, nullable — Optional ID of the responsible team.
    - `version` number, double — Version number

## Other responses

- `401` — This endpoint only accepts an active CONSOLE key, but an invalid key was sent. Key: console-xxxXXXxxxXXXxxx

---

[API](https://skmtc.net/statsig/apis/console-api.md) · [All operations](https://skmtc.net/statsig/apis/console-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/statsig/console-api/versions/3189f450c93b/schema)
