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

# Segments

> Dynamic and system segments of users

A **Segment** is a rule-based slice of your user base. Segments power audience targeting for experiments, no-code screens, remote config, and scheduled reports. v4 separates **user-defined segments** (fully editable) from **system segments** (managed by Qonversion).

## Key concepts

* **Rules** — Boolean combinations of predicates over user properties, purchases, and identity fields.
* **System segments** — Read-only, predefined segments (e.g., active subscribers, churned users).
* **Uses** — Segments can be referenced by experiments, scheduled reports, and automations.

## Condition shape

Each condition has the same four fields:

| Field        | Type    | Required | Description                                                                                                                   |
| ------------ | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `metric`     | string  | yes      | Metric identifier. Common: `environment`, `client_uid`, `custom_uid`, `client_advertiser_id`, `renewable`, `target_platform`. |
| `comparator` | string  | yes      | One of `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `contains`, `not_contains`.                                                      |
| `value`      | string  | yes      | String-encoded value compared against the metric (cast to the metric's type server-side).                                     |
| `negate`     | boolean | no       | If `true`, the single rule matches when the comparison is false. Defaults to `false`.                                         |

Rules are joined with logical AND — **every** condition must hold for a user to fall into the segment.

`PUT /segments/{segment_id}` is a full replace: pass the complete condition set you want to keep, or `[]` to clear. Omit the field entirely to leave conditions untouched.

**Example create body:**

```json theme={null}
{
  "name": "EU prod renewables",
  "conditions": [
    { "metric": "environment", "comparator": "eq", "value": "prod" },
    { "metric": "renewable",   "comparator": "eq", "value": "1"    }
  ]
}
```

## Available endpoints

| Method | Endpoint                 | Description                     | Status |
| ------ | ------------------------ | ------------------------------- | ------ |
| GET    | `/segments`              | List segments                   | New    |
| POST   | `/segments`              | Create a segment                | New    |
| GET    | `/segments/system`       | List system segments            | New    |
| DELETE | `/segments/{segment_id}` | Delete a segment                | New    |
| GET    | `/segments/{segment_id}` | Get a segment                   | New    |
| PUT    | `/segments/{segment_id}` | Update a segment (full replace) | New    |

## Authentication

All v4 endpoints require a **Secret Key**. See [Authentication](/reference/v4/authentication).
