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

# Segments

> Build a segment from traits and events, watch its count as you edit, and see the people in it.

A segment is a saved filter over your contacts: it finds people by the traits your app sends with `identify`, and by the events they did or did not send in the last 1 to 365 days. A journey can use a segment as its entry filter, so only the people in it enter. See [Journeys](https://docs.maqetin.com/messaging/journeys.md). Segments live under **Contacts**, on the **Segments** tab. Any member of the workspace can build and change them.

## Build a segment

**1. Start a segment**

Open **Contacts**, then the **Segments** tab, and select **Create segment**.

**2. Name it**

Give it a **Name**. A **Description** is optional.

**3. Add rules**

Select **Add rule**, then **Event rule** or **Trait rule**, and pick the event or the trait.

**4. Choose how rules combine**

Next to **People who match**, choose **all rules** (a contact must match every rule) or **any rule** (one is enough).

**5. Save**

Select **Save segment**.

For example, Harbour Money could find people who ordered a card but have not moved money yet: an event rule **Did** `card.ordered` in the last 30 days, an event rule **Did not do** `transfer.completed` in the last 30 days, and a trait rule `country` **is** `GB`.

## Trait rules

| Test | Matches when the trait |
| - | - |
| **is** | Equals the value: text, a number, or `true` or `false`. The type counts: if your app sends `"2"` as text, **is** `2` as a number does not match |
| **contains** | Holds the text, in any case |
| **is set** | Has a value |
| **is more than** | Is a number above the value |
| **is less than** | Is a number below the value |

The trait picker lists the standard profile fields (see [Profiles](https://docs.maqetin.com/data/profiles.md)), then the traits your app sent with `identify`. You can also type the full name of a trait your app has not sent yet.

## Event rules

An event rule asks whether a contact did, or did not do, an event within its look-back. A new rule looks back 30 days.

* The name must match what your app sends exactly, case included.
* It counts only events sent with the person's `userId`. Events from before identify show on the contact, but the rule does not count them.
* The event picker lists the names your app sent in the last 30 days, up to 200, with when each was last received. You can also type the full name of an event your app has not sent yet.

## Limits

| Limit | Value |
| - | - |
| **Name** | Up to 100 characters, unique in the workspace |
| **Description** | Up to 500 characters |
| Rules in a segment | 20 |
| An **is** value | Up to 500 characters |
| A **contains** text | 1 to 200 characters |
| A trait name | Letters, digits, `_` and `-` only, up to 100 characters |
| An event name | Up to 200 characters |
| Look-back of an event rule | 1 to 365 days |

## Counts and people

| Where | What it shows |
| - | - |
| While you edit | How many contacts the rules match now. It runs again a moment after each change, shows **Counting…** meanwhile, and waits until every rule is complete and valid |
| **People in it now** | On a saved segment: the contacts its saved rules match, the most recently updated first, 50 a page. Read again when you open or save the segment; unsaved changes do not change it |
| The **Segments** tab | Your segments, newest first, 50 a page, with their rules, their id and when they changed. **People** is the count taken when you save, then every hour |

An event rule that matches more than 10,000 people is too large to count. While you edit, the console says so, and you can still save. On a saved segment, those people are neither counted nor listed, and **People** shows **Not counted** (as it does before any count has run). Look back fewer days on that rule, or pick a rarer event.

## Delete a segment

Open the segment, select **Delete segment**, and type its name to confirm. A delete cannot be undone, and changes no contact. Maqetin refuses the delete while a journey that is not archived uses the segment as its entry filter, in its running version or in an older version that people are still in. A paused journey counts. The console names the journeys: archive them, or publish versions without the segment and wait until nobody is left on the versions that use it. Then delete again.


## Related topics

- [Events](https://docs.maqetin.com/data/events.md)
- [Maqetin documentation](https://docs.maqetin.com/index.md)
- [Profiles](https://docs.maqetin.com/data/profiles.md)
- [Journeys](https://docs.maqetin.com/messaging/journeys.md)
- [Members and roles](https://docs.maqetin.com/workspace/members-and-roles.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.