> For the complete documentation index, see [llms.txt](https://docs.reflag.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.reflag.com/product-handbook/concepts/segment.md).

# Segment

### Definition

A segment in Reflag is a dynamic audience built from companies, users, or both together.

Segments use [filters](/product-handbook/concepts/filter.md) to evaluate which companies and users are included.

### Filters

Segment filters can be constructed using any combination of the following rules:

* [company attributes](/product-handbook/concepts/company.md#attributes)
* [user attributes](/product-handbook/concepts/user.md)
* [flag access](/product-handbook/concepts/feature.md#access)
* [flag metrics](/product-handbook/concepts/feature.md#metrics)
* other segments

{% hint style="info" %}
Segments with a filter that uses `First Seen`, `Last Seen`, or flag metric rules cannot be used in [targeting rules](/product-handbook/concepts/targeting-rules.md). Segments that depend on those segments also cannot be used in targeting rules.
{% endhint %}

### Environments

All segments in Reflag are [app](/product-handbook/concepts/app.md)-wide. This means the same segment shares the same settings, including filters, across all [environments](/product-handbook/concepts/environment.md) in the app.

It is up to you to populate each environment with the right company and user data so segments evaluate correctly. Another option is to create separate segments for different environments.

### Next steps

* Learn about [users](/product-handbook/concepts/user.md), [filters](/product-handbook/concepts/filter.md), and [targeting rules](/product-handbook/concepts/targeting-rules.md).
* Learn how to [create segments](/product-handbook/creating-segments.md) in Reflag.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.reflag.com/product-handbook/concepts/segment.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
