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

# Fetch segment data

> Fetch data for a segment



## OpenAPI

````yaml https://api.getcargo.io/openapi.json post /segmentation/segments/fetch
openapi: 3.1.0
info:
  title: Cargo API
  version: 1.0.0
  description: Cargo Platform API v1
servers:
  - url: https://api.getcargo.io/v1
    description: Cargo API
security:
  - bearerAuth: []
paths:
  /segmentation/segments/fetch:
    post:
      tags:
        - Segmentation - Segments
      summary: Fetch segment data
      description: Fetch data for a segment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                modelUuid:
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$
                  title: Model UUID
                  description: Model identifier.
                filter:
                  title: Filter
                  description: Segment filter criteria.
                  type: object
                  properties:
                    conjonction:
                      type: string
                      enum:
                        - or
                        - and
                    groups:
                      type: array
                      items:
                        type: object
                        properties:
                          conjonction:
                            type: string
                            enum:
                              - or
                              - and
                          conditions:
                            type: array
                            items:
                              anyOf:
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      const: sql
                                    name:
                                      type: string
                                    clause:
                                      type: string
                                  required:
                                    - kind
                                    - name
                                    - clause
                                - allOf:
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          const: string
                                        relatedModelUuid:
                                          type: string
                                        columnSlug:
                                          type: string
                                      required:
                                        - kind
                                        - columnSlug
                                    - anyOf:
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              enum:
                                                - is
                                                - isNot
                                                - contains
                                                - doesNotContain
                                                - startsWith
                                                - endsWith
                                            values:
                                              anyOf:
                                                - type: string
                                                - type: array
                                                  items:
                                                    type: string
                                          required:
                                            - operator
                                            - values
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              enum:
                                                - isNull
                                                - isNotNull
                                                - isEmpty
                                                - isNotEmpty
                                          required:
                                            - operator
                                - allOf:
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          const: number
                                        relatedModelUuid:
                                          type: string
                                        columnSlug:
                                          type: string
                                      required:
                                        - kind
                                        - columnSlug
                                    - anyOf:
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              enum:
                                                - is
                                                - isNot
                                                - greaterThan
                                                - lowerThan
                                            value:
                                              type: number
                                          required:
                                            - operator
                                            - value
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              const: between
                                            firstValue:
                                              type: number
                                            lastValue:
                                              type: number
                                          required:
                                            - operator
                                            - firstValue
                                            - lastValue
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              enum:
                                                - isNull
                                                - isNotNull
                                          required:
                                            - operator
                                - allOf:
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          const: objectProperty
                                        relatedModelUuid:
                                          type: string
                                        columnSlug:
                                          type: string
                                        propertyName:
                                          type: string
                                      required:
                                        - kind
                                        - columnSlug
                                        - propertyName
                                    - anyOf:
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              enum:
                                                - is
                                                - isNot
                                                - contains
                                                - greaterThan
                                                - lowerThan
                                                - doesNotContain
                                                - startsWith
                                                - endsWith
                                            value:
                                              type: string
                                          required:
                                            - operator
                                            - value
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              enum:
                                                - isNull
                                                - isNotNull
                                                - isEmpty
                                                - isNotEmpty
                                          required:
                                            - operator
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              const: between
                                            value:
                                              type: string
                                            otherValue:
                                              type: string
                                          required:
                                            - operator
                                            - value
                                            - otherValue
                                - allOf:
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          const: object
                                        relatedModelUuid:
                                          type: string
                                        columnSlug:
                                          type: string
                                      required:
                                        - kind
                                        - columnSlug
                                    - anyOf:
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              const: isNull
                                          required:
                                            - operator
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              const: isNotNull
                                          required:
                                            - operator
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              const: matchConditions
                                            conjonction:
                                              type: string
                                              enum:
                                                - or
                                                - and
                                            propertyConditions:
                                              type: array
                                              items:
                                                allOf:
                                                  - type: object
                                                    properties:
                                                      kind:
                                                        type: string
                                                        const: objectProperty
                                                      relatedModelUuid:
                                                        type: string
                                                      columnSlug:
                                                        type: string
                                                      propertyName:
                                                        type: string
                                                    required:
                                                      - kind
                                                      - columnSlug
                                                      - propertyName
                                                  - anyOf:
                                                      - type: object
                                                        properties:
                                                          operator:
                                                            type: string
                                                            enum:
                                                              - is
                                                              - isNot
                                                              - contains
                                                              - greaterThan
                                                              - lowerThan
                                                              - doesNotContain
                                                              - startsWith
                                                              - endsWith
                                                          value:
                                                            type: string
                                                        required:
                                                          - operator
                                                          - value
                                                      - type: object
                                                        properties:
                                                          operator:
                                                            type: string
                                                            enum:
                                                              - isNull
                                                              - isNotNull
                                                              - isEmpty
                                                              - isNotEmpty
                                                        required:
                                                          - operator
                                                      - type: object
                                                        properties:
                                                          operator:
                                                            type: string
                                                            const: between
                                                          value:
                                                            type: string
                                                          otherValue:
                                                            type: string
                                                        required:
                                                          - operator
                                                          - value
                                                          - otherValue
                                          required:
                                            - operator
                                            - conjonction
                                            - propertyConditions
                                - allOf:
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          const: array
                                        relatedModelUuid:
                                          type: string
                                        columnSlug:
                                          type: string
                                      required:
                                        - kind
                                        - columnSlug
                                    - anyOf:
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              const: isNull
                                          required:
                                            - operator
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              const: isNotNull
                                          required:
                                            - operator
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              const: matchConditions
                                            conjonction:
                                              type: string
                                              enum:
                                                - or
                                                - and
                                            propertyConditions:
                                              type: array
                                              items:
                                                allOf:
                                                  - type: object
                                                    properties:
                                                      kind:
                                                        type: string
                                                        const: objectProperty
                                                      relatedModelUuid:
                                                        type: string
                                                      columnSlug:
                                                        type: string
                                                      propertyName:
                                                        type: string
                                                    required:
                                                      - kind
                                                      - columnSlug
                                                      - propertyName
                                                  - anyOf:
                                                      - type: object
                                                        properties:
                                                          operator:
                                                            type: string
                                                            enum:
                                                              - is
                                                              - isNot
                                                              - contains
                                                              - greaterThan
                                                              - lowerThan
                                                              - doesNotContain
                                                              - startsWith
                                                              - endsWith
                                                          value:
                                                            type: string
                                                        required:
                                                          - operator
                                                          - value
                                                      - type: object
                                                        properties:
                                                          operator:
                                                            type: string
                                                            enum:
                                                              - isNull
                                                              - isNotNull
                                                              - isEmpty
                                                              - isNotEmpty
                                                        required:
                                                          - operator
                                                      - type: object
                                                        properties:
                                                          operator:
                                                            type: string
                                                            const: between
                                                          value:
                                                            type: string
                                                          otherValue:
                                                            type: string
                                                        required:
                                                          - operator
                                                          - value
                                                          - otherValue
                                          required:
                                            - operator
                                            - conjonction
                                            - propertyConditions
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      const: any
                                    relatedModelUuid:
                                      type: string
                                    columnSlug:
                                      type: string
                                    operator:
                                      type: string
                                      enum:
                                        - isNull
                                        - isNotNull
                                  required:
                                    - kind
                                    - columnSlug
                                    - operator
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      const: vector
                                    relatedModelUuid:
                                      type: string
                                    columnSlug:
                                      type: string
                                    operator:
                                      type: string
                                      enum:
                                        - isNull
                                        - isNotNull
                                  required:
                                    - kind
                                    - columnSlug
                                    - operator
                                - allOf:
                                    - type: object
                                      properties:
                                        kind:
                                          type: string
                                          const: date
                                        relatedModelUuid:
                                          type: string
                                        columnSlug:
                                          type: string
                                      required:
                                        - kind
                                        - columnSlug
                                    - anyOf:
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              enum:
                                                - is
                                                - isNot
                                                - greaterThan
                                                - lowerThan
                                            value:
                                              type: string
                                          required:
                                            - operator
                                            - value
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              const: between
                                            firstValue:
                                              type: string
                                            lastValue:
                                              type: string
                                          required:
                                            - operator
                                            - firstValue
                                            - lastValue
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              enum:
                                                - isNull
                                                - isNotNull
                                          required:
                                            - operator
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      const: boolean
                                    relatedModelUuid:
                                      type: string
                                    columnSlug:
                                      type: string
                                    operator:
                                      type: string
                                      enum:
                                        - isTrue
                                        - isFalse
                                        - isNull
                                        - isNotNull
                                  required:
                                    - kind
                                    - columnSlug
                                    - operator
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      const: occurrence
                                    relatedModelUuid:
                                      type: string
                                    frequency:
                                      anyOf:
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              const: not
                                          required:
                                            - operator
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              enum:
                                                - moreThan
                                                - lessThan
                                                - exactly
                                            value:
                                              type: number
                                          required:
                                            - operator
                                            - value
                                    period:
                                      type: object
                                      properties:
                                        operator:
                                          type: string
                                          enum:
                                            - lessThan
                                            - moreThan
                                            - exactly
                                        value:
                                          type: number
                                        unit:
                                          type: string
                                          const: day
                                      required:
                                        - operator
                                        - value
                                        - unit
                                    conjonction:
                                      type: string
                                      enum:
                                        - or
                                        - and
                                    conditions:
                                      type: array
                                      items:
                                        anyOf:
                                          - allOf:
                                              - type: object
                                                properties:
                                                  kind:
                                                    type: string
                                                    const: string
                                                  relatedModelUuid:
                                                    type: string
                                                  columnSlug:
                                                    type: string
                                                required:
                                                  - kind
                                                  - columnSlug
                                              - anyOf:
                                                  - type: object
                                                    properties:
                                                      operator:
                                                        type: string
                                                        enum:
                                                          - is
                                                          - isNot
                                                          - contains
                                                          - doesNotContain
                                                          - startsWith
                                                          - endsWith
                                                      values:
                                                        anyOf:
                                                          - type: string
                                                          - type: array
                                                            items:
                                                              type: string
                                                    required:
                                                      - operator
                                                      - values
                                                  - type: object
                                                    properties:
                                                      operator:
                                                        type: string
                                                        enum:
                                                          - isNull
                                                          - isNotNull
                                                          - isEmpty
                                                          - isNotEmpty
                                                    required:
                                                      - operator
                                          - allOf:
                                              - type: object
                                                properties:
                                                  kind:
                                                    type: string
                                                    const: number
                                                  relatedModelUuid:
                                                    type: string
                                                  columnSlug:
                                                    type: string
                                                required:
                                                  - kind
                                                  - columnSlug
                                              - anyOf:
                                                  - type: object
                                                    properties:
                                                      operator:
                                                        type: string
                                                        enum:
                                                          - is
                                                          - isNot
                                                          - greaterThan
                                                          - lowerThan
                                                      value:
                                                        type: number
                                                    required:
                                                      - operator
                                                      - value
                                                  - type: object
                                                    properties:
                                                      operator:
                                                        type: string
                                                        const: between
                                                      firstValue:
                                                        type: number
                                                      lastValue:
                                                        type: number
                                                    required:
                                                      - operator
                                                      - firstValue
                                                      - lastValue
                                                  - type: object
                                                    properties:
                                                      operator:
                                                        type: string
                                                        enum:
                                                          - isNull
                                                          - isNotNull
                                                    required:
                                                      - operator
                                          - allOf:
                                              - type: object
                                                properties:
                                                  kind:
                                                    type: string
                                                    const: object
                                                  relatedModelUuid:
                                                    type: string
                                                  columnSlug:
                                                    type: string
                                                required:
                                                  - kind
                                                  - columnSlug
                                              - anyOf:
                                                  - type: object
                                                    properties:
                                                      operator:
                                                        type: string
                                                        const: isNull
                                                    required:
                                                      - operator
                                                  - type: object
                                                    properties:
                                                      operator:
                                                        type: string
                                                        const: isNotNull
                                                    required:
                                                      - operator
                                                  - type: object
                                                    properties:
                                                      operator:
                                                        type: string
                                                        const: matchConditions
                                                      conjonction:
                                                        type: string
                                                        enum:
                                                          - or
                                                          - and
                                                      propertyConditions:
                                                        type: array
                                                        items:
                                                          allOf:
                                                            - type: object
                                                              properties:
                                                                kind:
                                                                  type: string
                                                                  const: objectProperty
                                                                relatedModelUuid:
                                                                  type: string
                                                                columnSlug:
                                                                  type: string
                                                                propertyName:
                                                                  type: string
                                                              required:
                                                                - kind
                                                                - columnSlug
                                                                - propertyName
                                                            - anyOf:
                                                                - type: object
                                                                  properties:
                                                                    operator:
                                                                      type: {}
                                                                      enum: {}
                                                                    value:
                                                                      type: {}
                                                                  required:
                                                                    - operator
                                                                    - value
                                                                - type: object
                                                                  properties:
                                                                    operator:
                                                                      type: {}
                                                                      enum: {}
                                                                  required:
                                                                    - operator
                                                                - type: object
                                                                  properties:
                                                                    operator:
                                                                      type: {}
                                                                      const: {}
                                                                    value:
                                                                      type: {}
                                                                    otherValue:
                                                                      type: {}
                                                                  required:
                                                                    - operator
                                                                    - value
                                                                    - otherValue
                                                    required:
                                                      - operator
                                                      - conjonction
                                                      - propertyConditions
                                          - allOf:
                                              - type: object
                                                properties:
                                                  kind:
                                                    type: string
                                                    const: array
                                                  relatedModelUuid:
                                                    type: string
                                                  columnSlug:
                                                    type: string
                                                required:
                                                  - kind
                                                  - columnSlug
                                              - anyOf:
                                                  - type: object
                                                    properties:
                                                      operator:
                                                        type: string
                                                        const: isNull
                                                    required:
                                                      - operator
                                                  - type: object
                                                    properties:
                                                      operator:
                                                        type: string
                                                        const: isNotNull
                                                    required:
                                                      - operator
                                                  - type: object
                                                    properties:
                                                      operator:
                                                        type: string
                                                        const: matchConditions
                                                      conjonction:
                                                        type: string
                                                        enum:
                                                          - or
                                                          - and
                                                      propertyConditions:
                                                        type: array
                                                        items:
                                                          allOf:
                                                            - type: object
                                                              properties:
                                                                kind:
                                                                  type: string
                                                                  const: objectProperty
                                                                relatedModelUuid:
                                                                  type: string
                                                                columnSlug:
                                                                  type: string
                                                                propertyName:
                                                                  type: string
                                                              required:
                                                                - kind
                                                                - columnSlug
                                                                - propertyName
                                                            - anyOf:
                                                                - type: object
                                                                  properties:
                                                                    operator:
                                                                      type: {}
                                                                      enum: {}
                                                                    value:
                                                                      type: {}
                                                                  required:
                                                                    - operator
                                                                    - value
                                                                - type: object
                                                                  properties:
                                                                    operator:
                                                                      type: {}
                                                                      enum: {}
                                                                  required:
                                                                    - operator
                                                                - type: object
                                                                  properties:
                                                                    operator:
                                                                      type: {}
                                                                      const: {}
                                                                    value:
                                                                      type: {}
                                                                    otherValue:
                                                                      type: {}
                                                                  required:
                                                                    - operator
                                                                    - value
                                                                    - otherValue
                                                    required:
                                                      - operator
                                                      - conjonction
                                                      - propertyConditions
                                          - type: object
                                            properties:
                                              kind:
                                                type: string
                                                const: any
                                              relatedModelUuid:
                                                type: string
                                              columnSlug:
                                                type: string
                                              operator:
                                                type: string
                                                enum:
                                                  - isNull
                                                  - isNotNull
                                            required:
                                              - kind
                                              - columnSlug
                                              - operator
                                          - type: object
                                            properties:
                                              kind:
                                                type: string
                                                const: vector
                                              relatedModelUuid:
                                                type: string
                                              columnSlug:
                                                type: string
                                              operator:
                                                type: string
                                                enum:
                                                  - isNull
                                                  - isNotNull
                                            required:
                                              - kind
                                              - columnSlug
                                              - operator
                                          - allOf:
                                              - type: object
                                                properties:
                                                  kind:
                                                    type: string
                                                    const: date
                                                  relatedModelUuid:
                                                    type: string
                                                  columnSlug:
                                                    type: string
                                                required:
                                                  - kind
                                                  - columnSlug
                                              - anyOf:
                                                  - type: object
                                                    properties:
                                                      operator:
                                                        type: string
                                                        enum:
                                                          - is
                                                          - isNot
                                                          - greaterThan
                                                          - lowerThan
                                                      value:
                                                        type: string
                                                    required:
                                                      - operator
                                                      - value
                                                  - type: object
                                                    properties:
                                                      operator:
                                                        type: string
                                                        const: between
                                                      firstValue:
                                                        type: string
                                                      lastValue:
                                                        type: string
                                                    required:
                                                      - operator
                                                      - firstValue
                                                      - lastValue
                                                  - type: object
                                                    properties:
                                                      operator:
                                                        type: string
                                                        enum:
                                                          - isNull
                                                          - isNotNull
                                                    required:
                                                      - operator
                                          - type: object
                                            properties:
                                              kind:
                                                type: string
                                                const: boolean
                                              relatedModelUuid:
                                                type: string
                                              columnSlug:
                                                type: string
                                              operator:
                                                type: string
                                                enum:
                                                  - isTrue
                                                  - isFalse
                                                  - isNull
                                                  - isNotNull
                                            required:
                                              - kind
                                              - columnSlug
                                              - operator
                                  required:
                                    - kind
                                    - relatedModelUuid
                                    - frequency
                                    - period
                                    - conjonction
                                    - conditions
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      const: enrollment
                                    workflowUuid:
                                      type: string
                                    activityKind:
                                      type: string
                                      enum:
                                        - workflowEntered
                                        - workflowNodeExecuted
                                        - workflowLeft
                                    nodeSlug:
                                      type: string
                                    frequency:
                                      anyOf:
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              const: not
                                          required:
                                            - operator
                                        - type: object
                                          properties:
                                            operator:
                                              type: string
                                              enum:
                                                - moreThan
                                                - lessThan
                                                - exactly
                                            value:
                                              type: number
                                          required:
                                            - operator
                                            - value
                                    period:
                                      type: object
                                      properties:
                                        operator:
                                          type: string
                                          enum:
                                            - lessThan
                                            - moreThan
                                            - exactly
                                        value:
                                          type: number
                                        unit:
                                          type: string
                                          const: day
                                      required:
                                        - operator
                                        - value
                                        - unit
                                  required:
                                    - kind
                                    - workflowUuid
                                    - activityKind
                                    - frequency
                                    - period
                                - type: object
                                  properties:
                                    kind:
                                      type: string
                                      const: segment
                                    segmentUuid:
                                      type: string
                                    operator:
                                      type: string
                                      enum:
                                        - in
                                        - notIn
                                  required:
                                    - kind
                                    - segmentUuid
                                    - operator
                        required:
                          - conjonction
                          - conditions
                  required:
                    - conjonction
                    - groups
                sort:
                  title: Sort
                  description: Sort criteria for the segment.
                  type: array
                  items:
                    type: object
                    properties:
                      columnSlug:
                        type: string
                      kind:
                        type: string
                        enum:
                          - asc
                          - desc
                    required:
                      - columnSlug
                      - kind
                limit:
                  title: Limit
                  description: Maximum number of records to include.
                  type: number
                fetchingLimit:
                  title: Fetching limit
                  description: Number of records to fetch per batch.
                  type: number
                fetchingOffset:
                  title: Fetching offset
                  description: Offset for fetching records.
                  type: number
                enrich:
                  title: Enrich
                  description: >-
                    Whether to enrich records with segment membership (adds a
                    `_segments` column).
                  type: boolean
                sync:
                  title: Sync
                  description: Whether to sync before fetching.
                  type: boolean
              required:
                - modelUuid
                - filter
              additionalProperties: false
              title: Request body
              description: Request body schema.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  records:
                    type: array
                    items:
                      type: object
                      propertyNames:
                        type: string
                      additionalProperties: {}
                    title: Records
                    description: Fetched segment records.
                  columns:
                    type: array
                    items:
                      type: object
                      properties:
                        slug:
                          type: string
                        type:
                          type: string
                          enum:
                            - string
                            - number
                            - object
                            - array
                            - date
                            - boolean
                            - vector
                            - any
                        label:
                          type: string
                        modelUuid:
                          type: string
                      required:
                        - slug
                        - type
                        - label
                        - modelUuid
                      additionalProperties: false
                    title: Columns
                    description: Segment columns.
                  count:
                    type: number
                    title: Count
                    description: Total number of records.
                required:
                  - records
                  - columns
                  - count
                additionalProperties: false
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '404':
          description: Not found
        '500':
          description: Internal server error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````