> For the complete documentation index, see [llms.txt](https://help.openloyalty.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.openloyalty.io/technical-guide/data-exports/data-structure-and-types/segments.md).

# Segments

Segment definitions and statistics, exported daily as a delta file.

The Segments file contains the segments defined in Open Loyalty and their latest calculated statistics.

{% hint style="info" %}
**Delta export.** Each daily file contains the segments that were created or updated during that UTC day, including a recalculation of the segment. Upsert on `segmentId` and keep the row with the latest `updatedAt`.
{% endhint %}

**File:** `analytics/Segments/segments_YYYY_MM_DD.csv`\
**Primary key:** `segmentId`

**Available data** (in column order):

<table><thead><tr><th width="238.91796875">Column</th><th width="112.33984375">Type</th><th width="125.44140625">Empty value</th><th>Description</th></tr></thead><tbody><tr><td><code>segmentId</code></td><td><code>uuid</code></td><td>No</td><td>Unique ID of the segment</td></tr><tr><td><code>storeId</code></td><td><code>uuid</code></td><td>No</td><td>ID of the tenant where the segment was created</td></tr><tr><td><code>name</code></td><td><code>string</code></td><td>Yes</td><td>Name of the segment</td></tr><tr><td><code>active</code></td><td><code>boolean</code></td><td>No</td><td>Uses the text <code>true</code> or <code>false</code></td></tr><tr><td><code>description</code></td><td><code>string</code></td><td>Yes</td><td>Description of the segment</td></tr><tr><td><code>calculatedAt</code></td><td><code>datetime</code></td><td>Yes</td><td>Date when membership was last calculated</td></tr><tr><td><code>customersCount</code></td><td><code>integer</code></td><td>No</td><td>Number of members at the last calculation</td></tr><tr><td><code>averageTransactionAmount</code></td><td><code>decimal</code></td><td>No</td><td>Average transaction value</td></tr><tr><td><code>averageTransactions</code></td><td><code>decimal</code></td><td>No</td><td>Average transactions per member</td></tr><tr><td><code>averageClv</code></td><td><code>decimal</code></td><td>No</td><td>Average customer lifetime value</td></tr><tr><td><code>updatedAt</code></td><td><code>datetime</code></td><td>No</td><td>Date when the segment was last updated</td></tr><tr><td><code>createdAt</code></td><td><code>datetime</code></td><td>No</td><td>Date when the segment was created</td></tr></tbody></table>

{% hint style="info" %}
Which members belong to which segment is exported separately. See [Members Segments](/technical-guide/data-exports/data-structure-and-types/members-segments.md).
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.openloyalty.io/technical-guide/data-exports/data-structure-and-types/segments.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
