---
title: "ezgh flags segments create"
description: "Create a segment."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ezgh flags segments create

{/* Generated by ezgh-cli's internal/tools/clidocs from the ezgh command tree. Don't edit: change the command's help in ezgh-cli and regenerate. */}

```sh
ezgh flags segments create <key> [--name n] [--description d] [--include id…] [--exclude id…] [--rules-file rules.json] [flags]
```

Create a segment: a reusable audience flag rules target with segmentMatch, in every environment. A context is in it when its targetingKey is included (`--include`, up to 10,000), or it matches any of the rules (`--rules-file`, a JSON list of &#123;"clauses": \[...\]&#125;), and its targetingKey isn't excluded (`--exclude`). Its key can't change; `--name` defaults to it.

Part of [`ezgh flags segments`](/cli/reference/flags-segments).

## Examples

```sh
ezgh flags segments create beta-testers --include user-7 --include user-9
```

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--description` | string |  | what it's for |
| `--exclude` | string, repeatable |  | a targetingKey never in it (repeat) |
| `--include` | string, repeatable |  | a targetingKey always in it (repeat) |
| `--name` | string |  | a display name (default: the key) |
| `--rules-file` | string |  | its rules, a JSON list |

This command also takes the [global flags](/cli/reference#global-flags).

Source: https://docs.ezghcloud.com/cli/reference/flags-segments-create/index.mdx
