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

# List the segments of a card definition

> Lists the segments of a card definition; archived ones are left out. Filters combine with AND; keep them when following `after`. 404: the card definition doesn't exist.



## OpenAPI

````yaml /api-reference/openapi/configuration.json get /v1/card-definitions/{cardId}/segments
openapi: 3.2.0
info:
  title: Configuration API
  description: >-
    Manages applications, sources, source properties, source folders, managed
    tags and their values, card definitions, their segments and relation
    definitions; manages destinations, their versions and endpoints, and
    publishes versions; and authors, previews and activates card lifecycles.
    Card property changes are saved as pending changes and take effect when the
    card definition is activated. Source property changes and source deletion
    can finish asynchronously. The tenant comes from the access token.
    Successful responses return the resource itself; lists return a page with
    `items`, the `after` cursor for the next page and, when asked for,
    `totalCount` (`limit` default 50, max 200; lifecycle lists default 25, max
    100). Application updates replace the settings and need the latest `etag`;
    secrets are returned only when created. Errors are problem details
    (`application/problem+json`). Values are PascalCase in REST and UPPER_CASE
    in GraphQL.
  version: 1.0.0
servers:
  - url: https://api.occtoo.com
security: []
tags:
  - name: Applications
  - name: Card definitions
  - name: Card exports
  - name: Destination endpoints
  - name: Destination versions
  - name: Destinations
  - name: Languages
  - name: Lifecycles
  - name: Managed tag values
  - name: Managed tags
  - name: Relation definitions
  - name: Segments
  - name: Sources
paths:
  /v1/card-definitions/{cardId}/segments:
    get:
      tags:
        - Segments
      summary: List the segments of a card definition
      description: >-
        Lists the segments of a card definition; archived ones are left out.
        Filters combine with AND; keep them when following `after`. 404: the
        card definition doesn't exist.
      operationId: ListSegments
      parameters:
        - name: cardId
          in: path
          description: Raw id of the card definition (e.g. `products`).
          required: true
          schema:
            type: string
        - name: type
          in: query
          description: Only segments of this type. See `SegmentType`.
          schema:
            $ref: '#/components/schemas/SegmentType'
        - name: status
          in: query
          description: Only segments in this state. See `SegmentStatus`.
          schema:
            $ref: '#/components/schemas/SegmentStatus'
        - name: name
          in: query
          description: Only items whose name contains this text, ignoring case.
          schema:
            type: string
        - name: createdFrom
          in: query
          description: Only items created at or after this time.
          schema:
            type: string
            format: date-time
        - name: createdTo
          in: query
          description: >-
            Only items created at or before this time. Can't be before
            `createdFrom`.
          schema:
            type: string
            format: date-time
        - name: updatedFrom
          in: query
          description: Only items last changed at or after this time.
          schema:
            type: string
            format: date-time
        - name: updatedTo
          in: query
          description: >-
            Only items last changed at or before this time. Can't be before
            `updatedFrom`.
          schema:
            type: string
            format: date-time
        - name: after
          in: query
          description: >-
            Cursor from the previous page's `after`. Omit it for the first page;
            pages only go forward.
          schema:
            type: string
        - name: limit
          in: query
          description: Number of items to return. Default 50, max 200.
          schema:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int32
        - name: includeTotalCount
          in: query
          description: >-
            Include `totalCount`, the number of all matching items. Costs an
            extra count; default `false`, and `totalCount` is null without it.
          schema:
            type: boolean
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForwardPageOfSegmentResponse'
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/HttpValidationProblemDetails'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '409':
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '429':
          description: Too Many Requests
          headers:
            Retry-After:
              description: Number of seconds to wait before retrying.
              schema:
                minimum: 1
                type: integer
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
      security:
        - kindeOAuth: []
        - bearerAuth: []
        - apiKey: []
components:
  schemas:
    SegmentType:
      enum:
        - Query
        - Fixed
      description: Sets how a segment picks its cards.
      x-enum-descriptions:
        Query: Cards that match the search criteria.
        Fixed: A fixed list of card ids.
    SegmentStatus:
      enum:
        - Initializing
        - Active
        - Scheduled
        - Archived
      description: >-
        Gives the lifecycle state of a segment. A new segment is scheduled, then
        initializing, then active, and is archived when its `endTime` passes.
        There's no failed state.
      x-enum-descriptions:
        Initializing: >-
          In progress: cards are being matched against the criteria, after the
          segment starts, its criteria or language change, or it's restored.
          Criteria and tags can't change until it's active.
        Active: 'Live: matching is done and the segment is within its time window.'
        Scheduled: Waiting for `startTime`; no cards are matched yet.
        Archived: >-
          `endTime` has passed: the segment no longer matches cards and counts
          as archived.
    ForwardPageOfSegmentResponse:
      required:
        - items
        - after
        - totalCount
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/SegmentResponse'
          description: Items on this page.
        after:
          type:
            - 'null'
            - string
          description: 'Cursor for the next page: pass it as `after`. Null on the last page.'
        totalCount:
          type:
            - 'null'
            - integer
          description: Number of all matching items. Null unless `includeTotalCount=true`.
          format: int64
      description: Holds one page of a list.
    HttpValidationProblemDetails:
      type: object
      properties:
        type:
          type:
            - 'null'
            - string
        title:
          type:
            - 'null'
            - string
        status:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          format: int32
        detail:
          type:
            - 'null'
            - string
        instance:
          type:
            - 'null'
            - string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
    ProblemDetails:
      type: object
      properties:
        type:
          type:
            - 'null'
            - string
        title:
          type:
            - 'null'
            - string
        status:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          format: int32
        detail:
          type:
            - 'null'
            - string
        instance:
          type:
            - 'null'
            - string
    SegmentResponse:
      required:
        - id
        - segmentDefinitionId
        - cardId
        - type
        - status
        - name
        - description
        - language
        - image
        - tags
        - where
        - startTime
        - endTime
        - createdAt
        - updatedAt
      type: object
      properties:
        id:
          type: string
          description: >-
            Raw id of the segment (e.g. `summer26`). Use with
            `/v1/card-definitions/{cardId}/segments/{segmentId}`.
        segmentDefinitionId:
          type: string
          description: Raw id of the segment definition the segment belongs to.
        cardId:
          type: string
          description: >-
            Raw id of the card definition whose cards the segment picks (e.g.
            `products`).
        type:
          $ref: '#/components/schemas/SegmentType'
          description: How the segment picks its cards. See `SegmentType`.
        status:
          $ref: '#/components/schemas/SegmentStatus'
          description: Lifecycle state of the segment. See `SegmentStatus`.
        name:
          type: string
          description: Name of the segment.
        description:
          type:
            - 'null'
            - string
          description: Free-text note about the segment.
        language:
          type: string
          description: >-
            Language code `where` uses for localized card properties (e.g.
            `en`).
        image:
          type:
            - 'null'
            - string
          description: Image key, lowercase letters a-z only. Null when not set.
        tags:
          type: array
          items:
            type: string
          description: >-
            Labels for grouping and filtering segments. Alphanumeric, no
            duplicates.
        where:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SearchPredicate'
              description: >-
                Filter that picks the segment's cards, as stored. It can differ
                in form from what was sent, never in meaning.
          description: >-
            Filter that picks the segment's cards, as stored. It can differ in
            form from what was sent, never in meaning.
        startTime:
          type:
            - 'null'
            - string
          description: >-
            When the segment becomes active, on the hour (UTC). Null = active as
            soon as it's created.
          format: date-time
        endTime:
          type:
            - 'null'
            - string
          description: >-
            When the segment is archived, on the hour (UTC). Null = never
            archived on a schedule.
          format: date-time
        createdAt:
          type: string
          description: When the segment was created (UTC).
          format: date-time
        updatedAt:
          type: string
          description: When the segment last changed (UTC).
          format: date-time
      description: >-
        Names a set of cards of one card definition, picked by a `where` filter
        or by a fixed list of card ids.
    SearchPredicate:
      type: object
      properties:
        and:
          type:
            - 'null'
            - array
          items:
            $ref: '#/components/schemas/SearchPredicate'
          description: Every child condition must match.
        or:
          type:
            - 'null'
            - array
          items:
            $ref: '#/components/schemas/SearchPredicate'
          description: At least one child condition must match.
        not:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SearchPredicate'
              description: The child condition must not match.
          description: The child condition must not match.
        text:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TextPredicate'
              description: >-
                A condition on text, including substring, RE2 regex and length
                checks.
          description: >-
            A condition on text, including substring, RE2 regex and length
            checks.
        integer:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/IntegerPredicate'
              description: A condition on an integer property.
          description: A condition on an integer property.
        decimal:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/DecimalPredicate'
              description: A condition on a decimal property.
          description: A condition on a decimal property.
        timestamp:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TimestampPredicate'
              description: A condition on a timestamp property.
          description: A condition on a timestamp property.
        boolean:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/BooleanPredicate'
              description: A condition on a boolean property.
          description: A condition on a boolean property.
        list:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/ListPredicate'
              description: A condition on list elements or length.
          description: A condition on list elements or length.
        hasValue:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/PropertyReference'
              description: >-
                True when a value exists. Empty text, whitespace and empty lists
                count as values.
          description: >-
            True when a value exists. Empty text, whitespace and empty lists
            count as values.
        segment:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SegmentPredicate'
              description: Membership in a segment.
          description: Membership in a segment.
        relation:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/RelationPredicate'
              description: >-
                Tests distinct live related entries. All nested conditions apply
                to the same child.
          description: >-
            Tests distinct live related entries. All nested conditions apply to
            the same child.
        lifecycle:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/LifecyclePredicate'
              description: Saved readiness of the entry under an active lifecycle.
          description: Saved readiness of the entry under an active lifecycle.
      description: >-
        Holds a typed condition on an entry. Set exactly one branch; `and` and
        `or` need at least one child.
    TextPredicate:
      required:
        - property
      type: object
      properties:
        property:
          $ref: '#/components/schemas/PropertyId'
          description: Id of the card property.
        eq:
          type:
            - 'null'
            - string
          description: Equal to this value.
        neq:
          type:
            - 'null'
            - string
          description: Different from this value.
        in:
          type:
            - 'null'
            - array
          items:
            type: string
          description: Equal to any listed value.
        contains:
          type:
            - 'null'
            - string
          description: A literal substring.
        pattern:
          type:
            - 'null'
            - string
          description: A whole-value wildcard pattern using * and ?.
        ignoreCase:
          type: boolean
          description: Whether matching ignores case.
          default: false
        languages:
          type:
            - 'null'
            - array
          description: Every listed language must match. There is no language fallback.
        regex:
          type:
            - 'null'
            - string
          description: >-
            A substring pattern using the supported RE2 subset, validated
            locally.
        length:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/CountBounds'
              description: Bounds on the number of Unicode code points.
          description: Bounds on the number of Unicode code points.
      description: Tests a text card property.
    IntegerPredicate:
      required:
        - property
      type: object
      properties:
        property:
          $ref: '#/components/schemas/PropertyId'
          description: Id of the card property.
        eq:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: Equal to this value.
          format: int64
        neq:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: Different from this value.
          format: int64
        in:
          type:
            - 'null'
            - array
          items:
            pattern: ^-?(?:0|[1-9]\d*)$
            type:
              - integer
              - string
            format: int64
          description: Equal to any listed value.
        lt:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: Less than this value.
          format: int64
        lte:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: Less than or equal to this value.
          format: int64
        gt:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: Greater than this value.
          format: int64
        gte:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: Greater than or equal to this value.
          format: int64
      description: Tests an integer card property.
    DecimalPredicate:
      required:
        - property
      type: object
      properties:
        property:
          $ref: '#/components/schemas/PropertyId'
          description: Id of the card property.
        eq:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: Equal to this value.
          format: double
        neq:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: Different from this value.
          format: double
        in:
          type:
            - 'null'
            - array
          items:
            pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
            type:
              - number
              - string
            format: double
          description: Equal to any listed value.
        lt:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: Less than this value.
          format: double
        lte:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: Less than or equal to this value.
          format: double
        gt:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: Greater than this value.
          format: double
        gte:
          pattern: ^-?(?:0|[1-9]\d*)(?:\.\d+)?$
          type:
            - 'null'
            - number
            - string
          description: Greater than or equal to this value.
          format: double
      description: Tests a decimal card property.
    TimestampPredicate:
      required:
        - property
      type: object
      properties:
        property:
          $ref: '#/components/schemas/PropertyId'
          description: Id of the card property.
        eq:
          type:
            - 'null'
            - string
          description: Equal to this value.
          format: date-time
        neq:
          type:
            - 'null'
            - string
          description: Different from this value.
          format: date-time
        in:
          type:
            - 'null'
            - array
          items:
            type: string
            format: date-time
          description: Equal to any listed value.
        lt:
          type:
            - 'null'
            - string
          description: Less than this value.
          format: date-time
        lte:
          type:
            - 'null'
            - string
          description: Less than or equal to this value.
          format: date-time
        gt:
          type:
            - 'null'
            - string
          description: Greater than this value.
          format: date-time
        gte:
          type:
            - 'null'
            - string
          description: Greater than or equal to this value.
          format: date-time
      description: Tests a timestamp card property.
    BooleanPredicate:
      required:
        - property
      type: object
      properties:
        property:
          $ref: '#/components/schemas/PropertyId'
          description: Id of the card property.
        eq:
          type:
            - 'null'
            - boolean
          description: Equal to this value.
        neq:
          type:
            - 'null'
            - boolean
          description: Different from this value.
        in:
          type:
            - 'null'
            - array
          items:
            type: boolean
          description: Equal to any listed value.
      description: Tests a boolean card property.
    ListPredicate:
      required:
        - property
      type: object
      properties:
        property:
          $ref: '#/components/schemas/PropertyId'
          description: Id of the card property.
        contains:
          type:
            - 'null'
            - string
          description: An exact list element to match.
        pattern:
          type:
            - 'null'
            - string
          description: A wildcard pattern applied to each element.
        ignoreCase:
          type: boolean
          description: Whether element matching ignores case.
          default: false
        languages:
          type:
            - 'null'
            - array
          description: Every listed language must match. There is no language fallback.
        length:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/CountBounds'
              description: Bounds on list length, including duplicate and empty elements.
          description: Bounds on list length, including duplicate and empty elements.
        only:
          type:
            - 'null'
            - array
          items:
            type: string
          description: >-
            Every list element must be one of these values. An empty or missing
            list doesn't match.
      description: Tests a list card property.
    PropertyReference:
      required:
        - property
      type: object
      properties:
        property:
          $ref: '#/components/schemas/PropertyId'
          description: Id of the card property.
        languages:
          type:
            - 'null'
            - array
          description: Every listed language must match. There is no language fallback.
      description: Tests that a card property has a value.
    SegmentPredicate:
      required:
        - definitionId
        - id
      type: object
      properties:
        definitionId:
          $ref: '#/components/schemas/SegmentDefinitionId'
          description: Raw id of the segment definition (e.g. `campaigns`).
        id:
          $ref: '#/components/schemas/SegmentId'
          description: Raw id of the segment within that segment definition.
      description: Describes membership in a segment.
    RelationPredicate:
      required:
        - id
      type: object
      properties:
        id:
          $ref: '#/components/schemas/RelationId'
          description: Id of the relation. The current card determines its direction.
        where:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SearchPredicate'
              description: >-
                The condition each counted child must satisfy. Null includes all
                live children.
          description: >-
            The condition each counted child must satisfy. Null includes all
            live children.
        count:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/CountBounds'
              description: >-
                Bounds on distinct matching children. Null requires at least one
                match.
          description: >-
            Bounds on distinct matching children. Null requires at least one
            match.
      description: Tests live related entries.
    LifecyclePredicate:
      required:
        - id
      type: object
      properties:
        id:
          type: string
          description: Id of the lifecycle (a UUID).
          format: uuid
        state:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/LifecycleReadinessState'
              description: Readiness of the whole lifecycle for the entry.
          description: Readiness of the whole lifecycle for the entry.
        step:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/LifecycleStepPredicate'
              description: Condition on one step.
          description: Condition on one step.
        firstIncompleteStepId:
          type:
            - 'null'
            - string
          description: Id of the first step that's incomplete for the entry.
          format: uuid
      description: >-
        Matches entries by their saved readiness under an active lifecycle. Set
        exactly one of `state`, `step` or `firstIncompleteStepId`. Entries
        without a saved assessment stay unknown, even under `not`.
    PropertyId:
      type: string
      description: Identifies a card property (e.g. `title`).
    CountBounds:
      type: object
      properties:
        eq:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: Exactly this many.
          format: int64
        gt:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: Greater than this value.
          format: int64
        gte:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: Greater than or equal to this value.
          format: int64
        lt:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: Less than this value.
          format: int64
        lte:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          description: Less than or equal to this value.
          format: int64
      description: Sets an exact count or a range of nonnegative counts.
    SegmentDefinitionId:
      type: string
      description: Identifies a segment definition by its raw id (e.g. `campaigns`).
    SegmentId:
      type: string
      description: Identifies a segment by its raw id within its segment definition.
    RelationId:
      type: string
      description: Identifies a relation definition by its raw id.
    LifecycleReadinessState:
      enum:
        - Complete
        - Incomplete
        - NotApplicable
        - null
      description: Saved readiness of an assessed entry. Missing assessments have no state.
      x-enum-descriptions:
        Complete: The lifecycle applies to the entry and every step is complete.
        Incomplete: >-
          The lifecycle applies to the entry and at least one step is
          incomplete.
        NotApplicable: The entry doesn't match the lifecycle's applicability.
    LifecycleStepPredicate:
      required:
        - id
      type: object
      properties:
        id:
          type: string
          description: Id of the step in the active revision (a UUID).
          format: uuid
        requirements:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/LifecycleRequirementsFilter'
              description: >-
                Whether the step's own blocking rules pass, whatever earlier
                steps say.
          description: >-
            Whether the step's own blocking rules pass, whatever earlier steps
            say.
        completion:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/LifecycleCompletionFilter'
              description: Whether the step and every earlier step are complete.
          description: Whether the step and every earlier step are complete.
      description: >-
        Matches one step of a lifecycle. Set exactly one of `requirements` or
        `completion`.
    LifecycleRequirementsFilter:
      enum:
        - Satisfied
        - Failed
        - null
      description: >-
        Matches a step by its own blocking (error) rules, whatever earlier steps
        say.
      x-enum-descriptions:
        Satisfied: The step's applicable blocking (error) rules are satisfied.
        Failed: At least one applicable blocking (error) rule of the step failed.
    LifecycleCompletionFilter:
      enum:
        - Complete
        - Incomplete
        - null
      description: Matches a step by whether it and every earlier step are complete.
      x-enum-descriptions:
        Complete: The step and every earlier step are complete.
        Incomplete: The step or an earlier step is incomplete.
  securitySchemes:
    kindeOAuth:
      type: oauth2
      description: >-
        Sign in with the existing Occtoo Studio identity and selected
        organization.
      flows:
        authorizationCode:
          authorizationUrl: >-
            https://auth.occtoo.com/oauth2/auth?audience=https%3A%2F%2Fapi-weu.occtoo.com
          tokenUrl: https://auth.occtoo.com/oauth2/token
          scopes:
            openid: Authenticate the user with OpenID Connect.
            profile: Read the user's basic profile.
            email: Read the user's email address.
            offline: Refresh the access token without another interactive sign-in.
          x-usePkce: SHA-256
          x-scalar-redirect-uri: https://api.occtoo.com/docs/
    bearerAuth:
      type: http
      description: >-
        Tenant-scoped Occtoo access token, including Kinde machine-to-machine
        application tokens.
      scheme: bearer
      bearerFormat: JWT
    apiKey:
      type: apiKey
      description: Occtoo organization API key.
      name: x-api-key
      in: header

````

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