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

# Audience segments

> Read and create audience segments.

The `audience-segments` command reads and creates audience segments, which are used to target [campaigns](/docs/cli/campaigns) and for filtering inside [workflows](/docs/cli/workflows).

## `create`

Create a new audience segment. Provide the audience filter inline with `--filter` or from a JSON file with `--filter-file`.

Set the filter inline with `--filter`:

```bash theme={"dark"}
loops audience-segments create \
  --name "Pro plan contacts" \
  --filter '{"match":"all","conditions":[{"type":"property","key":"plan","operator":"equals","value":"pro"}]}'
```

Alternatively, load the filter from a JSON file with `--filter-file`:

```json filter.json theme={"dark"}
{
  "match": "all",
  "conditions": [
    { "type": "property", "key": "plan", "operator": "equals", "value": "pro" }
  ]
}
```

```bash theme={"dark"}
loops audience-segments create \
  --name "Pro plan contacts" \
  --filter-file ./filter.json
```

The full audience filter schema is documented in the [API reference](/docs/api-reference/create-audience-segment).

### Flags

| Flag            | Short | Description                                                |
| --------------- | ----- | ---------------------------------------------------------- |
| `--name`        | `-n`  | Segment name <Badge color="red" size="sm">Required</Badge> |
| `--description` |       | Segment description                                        |
| `--filter`      |       | Audience filter as an inline JSON string                   |
| `--filter-file` |       | Path to a JSON file with the audience filter               |

## `get`

Get an audience segment by ID.

```bash theme={"dark"}
loops audience-segments get cln0y4p6r003yl70i1j2k3l4m
```

## `list`

List audience segments.

```bash theme={"dark"}
loops audience-segments list
```

Pass `--pick` to filter the list interactively with [fzf](https://github.com/junegunn/fzf) and copy the selected audience segment ID to your clipboard. Requires `fzf` to be installed and on your `PATH`.

```bash theme={"dark"}
loops audience-segments list --pick
```

### Flags

| Flag         | Description                                                                                                               |
| ------------ | ------------------------------------------------------------------------------------------------------------------------- |
| `--pick`     | Interactively pick an audience segment and copy its ID to the clipboard. Requires [fzf](https://github.com/junegunn/fzf). |
| `--per-page` | Results per page (10–50, default 20)                                                                                      |
| `--cursor`   | Pagination cursor for a specific page                                                                                     |


## Related topics

- [Filters and Segments](/docs/contacts/filters-segments.md)
- [API Introduction](/docs/api-reference/intro.md)
- [Create an audience segment](/docs/api-reference/create-audience-segment.md)
- [Get an audience segment](/docs/api-reference/get-audience-segment.md)
- [List audience segments](/docs/api-reference/list-audience-segments.md)
