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

# Preview a segment definition

> Preview an unsaved or edited segment definition (matched, reachable, channel, per-rule, and exclusion counts plus optional sample users).



## OpenAPI

````yaml post /api/admin/segments/preview
openapi: 3.1.0
info:
  title: Tranthor API
  description: Tranthor API Swagger Documentation
  version: 0.0.1
servers: []
security: []
paths:
  /api/admin/segments/preview:
    post:
      tags:
        - Segments
      description: >-
        Preview an unsaved or edited segment definition (matched, reachable,
        channel, per-rule, and exclusion counts plus optional sample users).
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                workspaceId:
                  type: string
                definition:
                  type: object
                  properties:
                    entryNode:
                      anyOf:
                        - anyOf:
                            - allOf:
                                - type: object
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - CustomerInsight
                                    id:
                                      type: string
                                  required:
                                    - type
                                    - id
                                - anyOf:
                                    - type: object
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - rfm.segment
                                        modelVersion:
                                          type: string
                                          enum:
                                            - rfm_engagement_v1
                                        operator:
                                          anyOf:
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - Equals
                                                value:
                                                  anyOf:
                                                    - type: string
                                                      enum:
                                                        - Champions
                                                    - type: string
                                                      enum:
                                                        - Loyal Customers
                                                    - type: string
                                                      enum:
                                                        - Potential Loyalists
                                                    - type: string
                                                      enum:
                                                        - At-Risk
                                                    - type: string
                                                      enum:
                                                        - Lost
                                                    - type: string
                                                      enum:
                                                        - New
                                              required:
                                                - type
                                                - value
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - NotEquals
                                                value:
                                                  anyOf:
                                                    - type: string
                                                      enum:
                                                        - Champions
                                                    - type: string
                                                      enum:
                                                        - Loyal Customers
                                                    - type: string
                                                      enum:
                                                        - Potential Loyalists
                                                    - type: string
                                                      enum:
                                                        - At-Risk
                                                    - type: string
                                                      enum:
                                                        - Lost
                                                    - type: string
                                                      enum:
                                                        - New
                                              required:
                                                - type
                                                - value
                                            - additionalProperties: false
                                              type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - IsUnavailable
                                              required:
                                                - type
                                      required:
                                        - field
                                        - modelVersion
                                        - operator
                                    - type: object
                                      properties:
                                        field:
                                          anyOf:
                                            - type: string
                                              enum:
                                                - rfm.recencyScore
                                            - type: string
                                              enum:
                                                - rfm.frequencyScore
                                            - type: string
                                              enum:
                                                - rfm.monetaryScore
                                        modelVersion:
                                          type: string
                                          enum:
                                            - rfm_engagement_v1
                                        operator:
                                          anyOf:
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - Equals
                                                value:
                                                  minimum: 1
                                                  maximum: 5
                                                  type: integer
                                              required:
                                                - type
                                                - value
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - GreaterThanOrEqual
                                                value:
                                                  minimum: 1
                                                  maximum: 5
                                                  type: integer
                                              required:
                                                - type
                                                - value
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - LessThan
                                                value:
                                                  minimum: 1
                                                  maximum: 5
                                                  type: integer
                                              required:
                                                - type
                                                - value
                                            - additionalProperties: false
                                              type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - IsUnavailable
                                              required:
                                                - type
                                      required:
                                        - field
                                        - modelVersion
                                        - operator
                                    - type: object
                                      properties:
                                        field:
                                          type: string
                                          enum:
                                            - lifecycle.riskBucket
                                        modelVersion:
                                          type: string
                                          enum:
                                            - lifecycle_cadence_v1
                                        operator:
                                          anyOf:
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - Equals
                                                value:
                                                  anyOf:
                                                    - type: string
                                                      enum:
                                                        - healthy
                                                    - type: string
                                                      enum:
                                                        - on-cadence
                                                    - type: string
                                                      enum:
                                                        - approaching-lapse
                                                    - type: string
                                                      enum:
                                                        - lapsed
                                                    - type: string
                                                      enum:
                                                        - deep-lapse
                                              required:
                                                - type
                                                - value
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - NotEquals
                                                value:
                                                  anyOf:
                                                    - type: string
                                                      enum:
                                                        - healthy
                                                    - type: string
                                                      enum:
                                                        - on-cadence
                                                    - type: string
                                                      enum:
                                                        - approaching-lapse
                                                    - type: string
                                                      enum:
                                                        - lapsed
                                                    - type: string
                                                      enum:
                                                        - deep-lapse
                                              required:
                                                - type
                                                - value
                                            - additionalProperties: false
                                              type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - IsUnavailable
                                              required:
                                                - type
                                      required:
                                        - field
                                        - modelVersion
                                        - operator
                                    - type: object
                                      properties:
                                        field:
                                          anyOf:
                                            - type: string
                                              enum:
                                                - lifecycle.daysSinceLastOrder
                                            - type: string
                                              enum:
                                                - lifecycle.expectedReorderDays
                                        modelVersion:
                                          type: string
                                          enum:
                                            - lifecycle_cadence_v1
                                        operator:
                                          anyOf:
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - Equals
                                                value:
                                                  minimum: 0
                                                  type: number
                                              required:
                                                - type
                                                - value
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - GreaterThanOrEqual
                                                value:
                                                  minimum: 0
                                                  type: number
                                              required:
                                                - type
                                                - value
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - LessThan
                                                value:
                                                  minimum: 0
                                                  type: number
                                              required:
                                                - type
                                                - value
                                            - additionalProperties: false
                                              type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - IsUnavailable
                                              required:
                                                - type
                                      required:
                                        - field
                                        - modelVersion
                                        - operator
                                    - type: object
                                      properties:
                                        field:
                                          anyOf:
                                            - type: string
                                              enum:
                                                - purchase.orderCount
                                            - type: string
                                              enum:
                                                - purchase.daysSinceLastOrder
                                        modelVersion:
                                          type: string
                                          enum:
                                            - completed_orders_v1
                                        operator:
                                          anyOf:
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - Equals
                                                value:
                                                  minimum: 0
                                                  type: number
                                              required:
                                                - type
                                                - value
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - GreaterThanOrEqual
                                                value:
                                                  minimum: 0
                                                  type: number
                                              required:
                                                - type
                                                - value
                                            - type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - LessThan
                                                value:
                                                  minimum: 0
                                                  type: number
                                              required:
                                                - type
                                                - value
                                            - additionalProperties: false
                                              type: object
                                              properties:
                                                type:
                                                  type: string
                                                  enum:
                                                    - IsUnavailable
                                              required:
                                                - type
                                      required:
                                        - field
                                        - modelVersion
                                        - operator
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - Trait
                                id:
                                  type: string
                                path:
                                  type: string
                                operator:
                                  anyOf:
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - Within
                                        windowSeconds:
                                          type: number
                                      required:
                                        - type
                                        - windowSeconds
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - Equals
                                        value:
                                          anyOf:
                                            - type: string
                                            - type: number
                                      required:
                                        - type
                                        - value
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - NotEquals
                                        value:
                                          anyOf:
                                            - type: string
                                            - type: number
                                      required:
                                        - type
                                        - value
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - HasBeen
                                        comparator:
                                          anyOf:
                                            - type: string
                                              enum:
                                                - GTE
                                            - type: string
                                              enum:
                                                - LT
                                        value:
                                          anyOf:
                                            - type: string
                                            - type: number
                                        windowSeconds:
                                          type: number
                                      required:
                                        - type
                                        - comparator
                                        - value
                                        - windowSeconds
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - Exists
                                      required:
                                        - type
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - GreaterThanOrEqual
                                        value:
                                          type: number
                                      required:
                                        - type
                                        - value
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - LessThan
                                        value:
                                          type: number
                                      required:
                                        - type
                                        - value
                                    - type: object
                                      properties:
                                        type:
                                          anyOf:
                                            - type: string
                                              enum:
                                                - Contains
                                            - type: string
                                              enum:
                                                - NotContains
                                            - type: string
                                              enum:
                                                - StartsWith
                                            - type: string
                                              enum:
                                                - EndsWith
                                        value:
                                          type: string
                                      required:
                                        - type
                                        - value
                              required:
                                - type
                                - id
                                - path
                                - operator
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - And
                                id:
                                  type: string
                                children:
                                  type: array
                                  items:
                                    type: string
                              required:
                                - type
                                - id
                                - children
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - Or
                                id:
                                  type: string
                                children:
                                  type: array
                                  items:
                                    type: string
                              required:
                                - type
                                - id
                                - children
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - Not
                                id:
                                  type: string
                                child:
                                  type: string
                              required:
                                - type
                                - id
                                - child
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - Performed
                                id:
                                  type: string
                                event:
                                  type: string
                                times:
                                  type: number
                                timesOperator:
                                  anyOf:
                                    - type: string
                                      enum:
                                        - '='
                                    - type: string
                                      enum:
                                        - '>='
                                    - type: string
                                      enum:
                                        - <
                                withinSeconds:
                                  type: number
                                properties:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      path:
                                        type: string
                                      operator:
                                        anyOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - Within
                                              windowSeconds:
                                                type: number
                                            required:
                                              - type
                                              - windowSeconds
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - Equals
                                              value:
                                                anyOf:
                                                  - type: string
                                                  - type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - NotEquals
                                              value:
                                                anyOf:
                                                  - type: string
                                                  - type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - HasBeen
                                              comparator:
                                                anyOf:
                                                  - type: string
                                                    enum:
                                                      - GTE
                                                  - type: string
                                                    enum:
                                                      - LT
                                              value:
                                                anyOf:
                                                  - type: string
                                                  - type: number
                                              windowSeconds:
                                                type: number
                                            required:
                                              - type
                                              - comparator
                                              - value
                                              - windowSeconds
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - Exists
                                            required:
                                              - type
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - GreaterThanOrEqual
                                              value:
                                                type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - LessThan
                                              value:
                                                type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                anyOf:
                                                  - type: string
                                                    enum:
                                                      - Contains
                                                  - type: string
                                                    enum:
                                                      - NotContains
                                                  - type: string
                                                    enum:
                                                      - StartsWith
                                                  - type: string
                                                    enum:
                                                      - EndsWith
                                              value:
                                                type: string
                                            required:
                                              - type
                                              - value
                                    required:
                                      - path
                                      - operator
                              required:
                                - type
                                - id
                                - event
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - LastPerformed
                                id:
                                  type: string
                                event:
                                  type: string
                                whereProperties:
                                  description: >-
                                    Used to select which events are eligible to
                                    be considered.
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      path:
                                        type: string
                                      operator:
                                        anyOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - Within
                                              windowSeconds:
                                                type: number
                                            required:
                                              - type
                                              - windowSeconds
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - Equals
                                              value:
                                                anyOf:
                                                  - type: string
                                                  - type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - NotEquals
                                              value:
                                                anyOf:
                                                  - type: string
                                                  - type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - HasBeen
                                              comparator:
                                                anyOf:
                                                  - type: string
                                                    enum:
                                                      - GTE
                                                  - type: string
                                                    enum:
                                                      - LT
                                              value:
                                                anyOf:
                                                  - type: string
                                                  - type: number
                                              windowSeconds:
                                                type: number
                                            required:
                                              - type
                                              - comparator
                                              - value
                                              - windowSeconds
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - Exists
                                            required:
                                              - type
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - GreaterThanOrEqual
                                              value:
                                                type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - LessThan
                                              value:
                                                type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                anyOf:
                                                  - type: string
                                                    enum:
                                                      - Contains
                                                  - type: string
                                                    enum:
                                                      - NotContains
                                                  - type: string
                                                    enum:
                                                      - StartsWith
                                                  - type: string
                                                    enum:
                                                      - EndsWith
                                              value:
                                                type: string
                                            required:
                                              - type
                                              - value
                                    required:
                                      - path
                                      - operator
                                hasProperties:
                                  description: >-
                                    Used to evaluate whether the user is in the
                                    segment based on the properties of the
                                    selected event.
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      path:
                                        type: string
                                      operator:
                                        anyOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - Within
                                              windowSeconds:
                                                type: number
                                            required:
                                              - type
                                              - windowSeconds
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - Equals
                                              value:
                                                anyOf:
                                                  - type: string
                                                  - type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - NotEquals
                                              value:
                                                anyOf:
                                                  - type: string
                                                  - type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - HasBeen
                                              comparator:
                                                anyOf:
                                                  - type: string
                                                    enum:
                                                      - GTE
                                                  - type: string
                                                    enum:
                                                      - LT
                                              value:
                                                anyOf:
                                                  - type: string
                                                  - type: number
                                              windowSeconds:
                                                type: number
                                            required:
                                              - type
                                              - comparator
                                              - value
                                              - windowSeconds
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - Exists
                                            required:
                                              - type
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - GreaterThanOrEqual
                                              value:
                                                type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - LessThan
                                              value:
                                                type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                anyOf:
                                                  - type: string
                                                    enum:
                                                      - Contains
                                                  - type: string
                                                    enum:
                                                      - NotContains
                                                  - type: string
                                                    enum:
                                                      - StartsWith
                                                  - type: string
                                                    enum:
                                                      - EndsWith
                                              value:
                                                type: string
                                            required:
                                              - type
                                              - value
                                    required:
                                      - path
                                      - operator
                              required:
                                - type
                                - id
                                - event
                                - hasProperties
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - Email
                                id:
                                  type: string
                                event:
                                  anyOf:
                                    - type: string
                                      enum:
                                        - TRInternalMessageSent
                                    - type: string
                                      enum:
                                        - TREmailAccepted
                                    - type: string
                                      enum:
                                        - TREmailDropped
                                    - type: string
                                      enum:
                                        - TREmailDelivered
                                    - type: string
                                      enum:
                                        - TREmailOpened
                                    - type: string
                                      enum:
                                        - TREmailClicked
                                    - type: string
                                      enum:
                                        - TREmailBounced
                                    - type: string
                                      enum:
                                        - TREmailMarkedSpam
                                times:
                                  type: number
                                templateId:
                                  type: string
                              required:
                                - type
                                - id
                                - event
                                - templateId
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - Broadcast
                                id:
                                  type: string
                              required:
                                - type
                                - id
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - SubscriptionGroup
                                id:
                                  type: string
                                subscriptionGroupId:
                                  type: string
                                subscriptionGroupType:
                                  anyOf:
                                    - type: string
                                      enum:
                                        - OptIn
                                    - type: string
                                      enum:
                                        - OptOut
                              required:
                                - type
                                - id
                                - subscriptionGroupId
                                - subscriptionGroupType
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - RandomBucket
                                id:
                                  type: string
                                percent:
                                  description: >-
                                    The percentage of users to be randomly
                                    assigned to be in the segment. Expressed as
                                    a number between 0 and 1.
                                  type: number
                              required:
                                - type
                                - id
                                - percent
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - Everyone
                                id:
                                  type: string
                              required:
                                - type
                                - id
                        - type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - Manual
                            version:
                              type: number
                            id:
                              type: string
                          required:
                            - type
                            - version
                            - id
                        - type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - Everyone
                            id:
                              type: string
                          required:
                            - type
                            - id
                        - type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - KeyedPerformed
                            id:
                              type: string
                            event:
                              type: string
                            key:
                              type: string
                            times:
                              type: number
                            timesOperator:
                              anyOf:
                                - type: string
                                  enum:
                                    - '='
                                - type: string
                                  enum:
                                    - '>='
                                - type: string
                                  enum:
                                    - <
                            properties:
                              type: array
                              items:
                                type: object
                                properties:
                                  path:
                                    type: string
                                  operator:
                                    anyOf:
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - Equals
                                          value:
                                            anyOf:
                                              - type: string
                                              - type: number
                                        required:
                                          - type
                                          - value
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - Exists
                                        required:
                                          - type
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - GreaterThanOrEqual
                                          value:
                                            type: number
                                        required:
                                          - type
                                          - value
                                      - type: object
                                        properties:
                                          type:
                                            type: string
                                            enum:
                                              - LessThan
                                          value:
                                            type: number
                                        required:
                                          - type
                                          - value
                                required:
                                  - path
                                  - operator
                          required:
                            - type
                            - id
                            - event
                            - key
                    nodes:
                      type: array
                      items:
                        anyOf:
                          - allOf:
                              - type: object
                                properties:
                                  type:
                                    type: string
                                    enum:
                                      - CustomerInsight
                                  id:
                                    type: string
                                required:
                                  - type
                                  - id
                              - anyOf:
                                  - type: object
                                    properties:
                                      field:
                                        type: string
                                        enum:
                                          - rfm.segment
                                      modelVersion:
                                        type: string
                                        enum:
                                          - rfm_engagement_v1
                                      operator:
                                        anyOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - Equals
                                              value:
                                                anyOf:
                                                  - type: string
                                                    enum:
                                                      - Champions
                                                  - type: string
                                                    enum:
                                                      - Loyal Customers
                                                  - type: string
                                                    enum:
                                                      - Potential Loyalists
                                                  - type: string
                                                    enum:
                                                      - At-Risk
                                                  - type: string
                                                    enum:
                                                      - Lost
                                                  - type: string
                                                    enum:
                                                      - New
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - NotEquals
                                              value:
                                                anyOf:
                                                  - type: string
                                                    enum:
                                                      - Champions
                                                  - type: string
                                                    enum:
                                                      - Loyal Customers
                                                  - type: string
                                                    enum:
                                                      - Potential Loyalists
                                                  - type: string
                                                    enum:
                                                      - At-Risk
                                                  - type: string
                                                    enum:
                                                      - Lost
                                                  - type: string
                                                    enum:
                                                      - New
                                            required:
                                              - type
                                              - value
                                          - additionalProperties: false
                                            type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - IsUnavailable
                                            required:
                                              - type
                                    required:
                                      - field
                                      - modelVersion
                                      - operator
                                  - type: object
                                    properties:
                                      field:
                                        anyOf:
                                          - type: string
                                            enum:
                                              - rfm.recencyScore
                                          - type: string
                                            enum:
                                              - rfm.frequencyScore
                                          - type: string
                                            enum:
                                              - rfm.monetaryScore
                                      modelVersion:
                                        type: string
                                        enum:
                                          - rfm_engagement_v1
                                      operator:
                                        anyOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - Equals
                                              value:
                                                minimum: 1
                                                maximum: 5
                                                type: integer
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - GreaterThanOrEqual
                                              value:
                                                minimum: 1
                                                maximum: 5
                                                type: integer
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - LessThan
                                              value:
                                                minimum: 1
                                                maximum: 5
                                                type: integer
                                            required:
                                              - type
                                              - value
                                          - additionalProperties: false
                                            type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - IsUnavailable
                                            required:
                                              - type
                                    required:
                                      - field
                                      - modelVersion
                                      - operator
                                  - type: object
                                    properties:
                                      field:
                                        type: string
                                        enum:
                                          - lifecycle.riskBucket
                                      modelVersion:
                                        type: string
                                        enum:
                                          - lifecycle_cadence_v1
                                      operator:
                                        anyOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - Equals
                                              value:
                                                anyOf:
                                                  - type: string
                                                    enum:
                                                      - healthy
                                                  - type: string
                                                    enum:
                                                      - on-cadence
                                                  - type: string
                                                    enum:
                                                      - approaching-lapse
                                                  - type: string
                                                    enum:
                                                      - lapsed
                                                  - type: string
                                                    enum:
                                                      - deep-lapse
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - NotEquals
                                              value:
                                                anyOf:
                                                  - type: string
                                                    enum:
                                                      - healthy
                                                  - type: string
                                                    enum:
                                                      - on-cadence
                                                  - type: string
                                                    enum:
                                                      - approaching-lapse
                                                  - type: string
                                                    enum:
                                                      - lapsed
                                                  - type: string
                                                    enum:
                                                      - deep-lapse
                                            required:
                                              - type
                                              - value
                                          - additionalProperties: false
                                            type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - IsUnavailable
                                            required:
                                              - type
                                    required:
                                      - field
                                      - modelVersion
                                      - operator
                                  - type: object
                                    properties:
                                      field:
                                        anyOf:
                                          - type: string
                                            enum:
                                              - lifecycle.daysSinceLastOrder
                                          - type: string
                                            enum:
                                              - lifecycle.expectedReorderDays
                                      modelVersion:
                                        type: string
                                        enum:
                                          - lifecycle_cadence_v1
                                      operator:
                                        anyOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - Equals
                                              value:
                                                minimum: 0
                                                type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - GreaterThanOrEqual
                                              value:
                                                minimum: 0
                                                type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - LessThan
                                              value:
                                                minimum: 0
                                                type: number
                                            required:
                                              - type
                                              - value
                                          - additionalProperties: false
                                            type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - IsUnavailable
                                            required:
                                              - type
                                    required:
                                      - field
                                      - modelVersion
                                      - operator
                                  - type: object
                                    properties:
                                      field:
                                        anyOf:
                                          - type: string
                                            enum:
                                              - purchase.orderCount
                                          - type: string
                                            enum:
                                              - purchase.daysSinceLastOrder
                                      modelVersion:
                                        type: string
                                        enum:
                                          - completed_orders_v1
                                      operator:
                                        anyOf:
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - Equals
                                              value:
                                                minimum: 0
                                                type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - GreaterThanOrEqual
                                              value:
                                                minimum: 0
                                                type: number
                                            required:
                                              - type
                                              - value
                                          - type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - LessThan
                                              value:
                                                minimum: 0
                                                type: number
                                            required:
                                              - type
                                              - value
                                          - additionalProperties: false
                                            type: object
                                            properties:
                                              type:
                                                type: string
                                                enum:
                                                  - IsUnavailable
                                            required:
                                              - type
                                    required:
                                      - field
                                      - modelVersion
                                      - operator
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - Trait
                              id:
                                type: string
                              path:
                                type: string
                              operator:
                                anyOf:
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - Within
                                      windowSeconds:
                                        type: number
                                    required:
                                      - type
                                      - windowSeconds
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - Equals
                                      value:
                                        anyOf:
                                          - type: string
                                          - type: number
                                    required:
                                      - type
                                      - value
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - NotEquals
                                      value:
                                        anyOf:
                                          - type: string
                                          - type: number
                                    required:
                                      - type
                                      - value
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - HasBeen
                                      comparator:
                                        anyOf:
                                          - type: string
                                            enum:
                                              - GTE
                                          - type: string
                                            enum:
                                              - LT
                                      value:
                                        anyOf:
                                          - type: string
                                          - type: number
                                      windowSeconds:
                                        type: number
                                    required:
                                      - type
                                      - comparator
                                      - value
                                      - windowSeconds
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - Exists
                                    required:
                                      - type
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - GreaterThanOrEqual
                                      value:
                                        type: number
                                    required:
                                      - type
                                      - value
                                  - type: object
                                    properties:
                                      type:
                                        type: string
                                        enum:
                                          - LessThan
                                      value:
                                        type: number
                                    required:
                                      - type
                                      - value
                                  - type: object
                                    properties:
                                      type:
                                        anyOf:
                                          - type: string
                                            enum:
                                              - Contains
                                          - type: string
                                            enum:
                                              - NotContains
                                          - type: string
                                            enum:
                                              - StartsWith
                                          - type: string
                                            enum:
                                              - EndsWith
                                      value:
                                        type: string
                                    required:
                                      - type
                                      - value
                            required:
                              - type
                              - id
                              - path
                              - operator
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - And
                              id:
                                type: string
                              children:
                                type: array
                                items:
                                  type: string
                            required:
                              - type
                              - id
                              - children
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - Or
                              id:
                                type: string
                              children:
                                type: array
                                items:
                                  type: string
                            required:
                              - type
                              - id
                              - children
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - Not
                              id:
                                type: string
                              child:
                                type: string
                            required:
                              - type
                              - id
                              - child
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - Performed
                              id:
                                type: string
                              event:
                                type: string
                              times:
                                type: number
                              timesOperator:
                                anyOf:
                                  - type: string
                                    enum:
                                      - '='
                                  - type: string
                                    enum:
                                      - '>='
                                  - type: string
                                    enum:
                                      - <
                              withinSeconds:
                                type: number
                              properties:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    path:
                                      type: string
                                    operator:
                                      anyOf:
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - Within
                                            windowSeconds:
                                              type: number
                                          required:
                                            - type
                                            - windowSeconds
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - Equals
                                            value:
                                              anyOf:
                                                - type: string
                                                - type: number
                                          required:
                                            - type
                                            - value
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - NotEquals
                                            value:
                                              anyOf:
                                                - type: string
                                                - type: number
                                          required:
                                            - type
                                            - value
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - HasBeen
                                            comparator:
                                              anyOf:
                                                - type: string
                                                  enum:
                                                    - GTE
                                                - type: string
                                                  enum:
                                                    - LT
                                            value:
                                              anyOf:
                                                - type: string
                                                - type: number
                                            windowSeconds:
                                              type: number
                                          required:
                                            - type
                                            - comparator
                                            - value
                                            - windowSeconds
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - Exists
                                          required:
                                            - type
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - GreaterThanOrEqual
                                            value:
                                              type: number
                                          required:
                                            - type
                                            - value
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - LessThan
                                            value:
                                              type: number
                                          required:
                                            - type
                                            - value
                                        - type: object
                                          properties:
                                            type:
                                              anyOf:
                                                - type: string
                                                  enum:
                                                    - Contains
                                                - type: string
                                                  enum:
                                                    - NotContains
                                                - type: string
                                                  enum:
                                                    - StartsWith
                                                - type: string
                                                  enum:
                                                    - EndsWith
                                            value:
                                              type: string
                                          required:
                                            - type
                                            - value
                                  required:
                                    - path
                                    - operator
                            required:
                              - type
                              - id
                              - event
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - LastPerformed
                              id:
                                type: string
                              event:
                                type: string
                              whereProperties:
                                description: >-
                                  Used to select which events are eligible to be
                                  considered.
                                type: array
                                items:
                                  type: object
                                  properties:
                                    path:
                                      type: string
                                    operator:
                                      anyOf:
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - Within
                                            windowSeconds:
                                              type: number
                                          required:
                                            - type
                                            - windowSeconds
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - Equals
                                            value:
                                              anyOf:
                                                - type: string
                                                - type: number
                                          required:
                                            - type
                                            - value
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - NotEquals
                                            value:
                                              anyOf:
                                                - type: string
                                                - type: number
                                          required:
                                            - type
                                            - value
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - HasBeen
                                            comparator:
                                              anyOf:
                                                - type: string
                                                  enum:
                                                    - GTE
                                                - type: string
                                                  enum:
                                                    - LT
                                            value:
                                              anyOf:
                                                - type: string
                                                - type: number
                                            windowSeconds:
                                              type: number
                                          required:
                                            - type
                                            - comparator
                                            - value
                                            - windowSeconds
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - Exists
                                          required:
                                            - type
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - GreaterThanOrEqual
                                            value:
                                              type: number
                                          required:
                                            - type
                                            - value
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - LessThan
                                            value:
                                              type: number
                                          required:
                                            - type
                                            - value
                                        - type: object
                                          properties:
                                            type:
                                              anyOf:
                                                - type: string
                                                  enum:
                                                    - Contains
                                                - type: string
                                                  enum:
                                                    - NotContains
                                                - type: string
                                                  enum:
                                                    - StartsWith
                                                - type: string
                                                  enum:
                                                    - EndsWith
                                            value:
                                              type: string
                                          required:
                                            - type
                                            - value
                                  required:
                                    - path
                                    - operator
                              hasProperties:
                                description: >-
                                  Used to evaluate whether the user is in the
                                  segment based on the properties of the
                                  selected event.
                                type: array
                                items:
                                  type: object
                                  properties:
                                    path:
                                      type: string
                                    operator:
                                      anyOf:
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - Within
                                            windowSeconds:
                                              type: number
                                          required:
                                            - type
                                            - windowSeconds
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - Equals
                                            value:
                                              anyOf:
                                                - type: string
                                                - type: number
                                          required:
                                            - type
                                            - value
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - NotEquals
                                            value:
                                              anyOf:
                                                - type: string
                                                - type: number
                                          required:
                                            - type
                                            - value
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - HasBeen
                                            comparator:
                                              anyOf:
                                                - type: string
                                                  enum:
                                                    - GTE
                                                - type: string
                                                  enum:
                                                    - LT
                                            value:
                                              anyOf:
                                                - type: string
                                                - type: number
                                            windowSeconds:
                                              type: number
                                          required:
                                            - type
                                            - comparator
                                            - value
                                            - windowSeconds
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - Exists
                                          required:
                                            - type
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - GreaterThanOrEqual
                                            value:
                                              type: number
                                          required:
                                            - type
                                            - value
                                        - type: object
                                          properties:
                                            type:
                                              type: string
                                              enum:
                                                - LessThan
                                            value:
                                              type: number
                                          required:
                                            - type
                                            - value
                                        - type: object
                                          properties:
                                            type:
                                              anyOf:
                                                - type: string
                                                  enum:
                                                    - Contains
                                                - type: string
                                                  enum:
                                                    - NotContains
                                                - type: string
                                                  enum:
                                                    - StartsWith
                                                - type: string
                                                  enum:
                                                    - EndsWith
                                            value:
                                              type: string
                                          required:
                                            - type
                                            - value
                                  required:
                                    - path
                                    - operator
                            required:
                              - type
                              - id
                              - event
                              - hasProperties
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - Email
                              id:
                                type: string
                              event:
                                anyOf:
                                  - type: string
                                    enum:
                                      - TRInternalMessageSent
                                  - type: string
                                    enum:
                                      - TREmailAccepted
                                  - type: string
                                    enum:
                                      - TREmailDropped
                                  - type: string
                                    enum:
                                      - TREmailDelivered
                                  - type: string
                                    enum:
                                      - TREmailOpened
                                  - type: string
                                    enum:
                                      - TREmailClicked
                                  - type: string
                                    enum:
                                      - TREmailBounced
                                  - type: string
                                    enum:
                                      - TREmailMarkedSpam
                              times:
                                type: number
                              templateId:
                                type: string
                            required:
                              - type
                              - id
                              - event
                              - templateId
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - Broadcast
                              id:
                                type: string
                            required:
                              - type
                              - id
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - SubscriptionGroup
                              id:
                                type: string
                              subscriptionGroupId:
                                type: string
                              subscriptionGroupType:
                                anyOf:
                                  - type: string
                                    enum:
                                      - OptIn
                                  - type: string
                                    enum:
                                      - OptOut
                            required:
                              - type
                              - id
                              - subscriptionGroupId
                              - subscriptionGroupType
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - RandomBucket
                              id:
                                type: string
                              percent:
                                description: >-
                                  The percentage of users to be randomly
                                  assigned to be in the segment. Expressed as a
                                  number between 0 and 1.
                                type: number
                            required:
                              - type
                              - id
                              - percent
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - Everyone
                              id:
                                type: string
                            required:
                              - type
                              - id
                  required:
                    - entryNode
                    - nodes
                segmentId:
                  type: string
                includeSampleUsers:
                  default: false
                  type: boolean
                sampleLimit:
                  minimum: 1
                  maximum: 25
                  default: 8
                  type: integer
              required:
                - workspaceId
                - definition
        required: true
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  totalCount:
                    type: number
                  matchedCount:
                    type: number
                  reachableCount:
                    type: number
                  channels:
                    type: object
                    properties:
                      email:
                        type: number
                      whatsapp:
                        type: number
                      sms:
                        type: number
                      mobilePush:
                        type: number
                    required:
                      - email
                      - whatsapp
                      - sms
                      - mobilePush
                  nodeCounts:
                    type: object
                    additionalProperties:
                      type: number
                  exclusionCounts:
                    type: object
                    additionalProperties:
                      type: number
                  includedCount:
                    type: number
                  sampleUsers:
                    type: array
                    items:
                      type: object
                      properties:
                        userId:
                          type: string
                        name:
                          type: string
                        initials:
                          type: string
                        why:
                          type: string
                        totalSpent:
                          type: number
                        currency:
                          type: string
                      required:
                        - userId
                        - name
                        - initials
                        - why
                        - totalSpent
                        - currency
                  approximate:
                    type: boolean
                required:
                  - totalCount
                  - matchedCount
                  - reachableCount
                  - channels
                  - nodeCounts
                  - exclusionCounts
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
        '404':
          description: An empty String
          content:
            application/json:
              schema:
                description: An empty String
                type: string
        '429':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '503':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
      security:
        - adminApiKey: []
components:
  securitySchemes:
    adminApiKey:
      type: http
      scheme: bearer
      description: >-
        An Admin API key, sent as `Authorization: Bearer <key>`. Create one in
        Settings.

````

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