Treasure Data Segments API

In marketing, a segment is a container that groups profiles (usually people) who share one or more common characteristics. In Treasure Data, the parent segment is your total population of people, accounts, or other type of collection and can be both existing and potential customers. You create segments to divide the population into subgroups of consumers based on some type of shared characteristics. Segments and subsegments enable more specific targeting for your marketing campaigns. _Treasure Data is making an effort to use more inclusive language in its product, content, and customer solutions. As we gradually make the move to replace insensitive language beginning in our UI, you may continue to see parent segments in the UI, for example, referenced as master segment in portions of Treasure Data APIs._

Operations 16

GET /audiences/{audienceId}/segments Retrieve list of segments #
POST /audiences/{audienceId}/segments Create new segment #
GET /audiences/{audienceId}/folders/{folderId}/segments Retrieve list of segments in a folder #
POST /audiences/{audienceId}/segments/query Retrieve SQL from segment rule #
POST /audiences/{audienceId}/segments/queries Retrieve number of profiles based on set of segment rules #
GET /audiences/{audienceId}/segments/{segmentId} Retrieve segment by ID #
PUT /audiences/{audienceId}/segments/{segmentId} Update segment #
DELETE /audiences/{audienceId}/segments/{segmentId} Delete segment (legacy) #
GET /audiences/{audienceId}/segments/queries/{queryId} Retrieve status of query #
POST /audiences/{audienceId}/segments/queries/{queryId}/kill Kill current running query of segment #
GET /audiences/{audienceId}/segments/queries/{queryId}/customers Retrieve profiles of query #
GET /audiences/{audienceId}/segments/{segmentId}/statistics Retrieve population statistics of segment #
POST /entities/segments Create segment
GET /entities/segments/{id} Retrieve segment by ID
PATCH /entities/segments/{id} Update segment
DELETE /entities/segments/{id} Delete segment

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/treasure-data-segments-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no email required.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

treasure-data-segments-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: cdp-api Segments API
  description: All of the CDP APIs are organized around REST - if you've interacted with a RESTful API already, many of the concepts will be familiar to you. All API calls to CDP API should be made to the following endpoints depending on the [region](https://docs.treasuredata.com/display/public/PD/Sites+and+Endpoints#SitesandEndpoints-Endpoints). For historical reasons there are REST API endpoints and JSON:API endpoints. JSON:API endpoints are located under "/entities".
  termsOfService: https://www.treasuredata.com/terms/
  version: 1.0.0
servers:
- url: https://api-cdp.treasuredata.com
- url: https://api-cdp.treasuredata.co.jp
- url: https://api-cdp.eu01.treasuredata.com
- url: https://api-cdp.ap02.treasuredata.com
- url: https://api-cdp.ap03.treasuredata.com
tags:
- name: Segments
  description: In marketing, a segment is a container that groups profiles (usually people) who share one or more common characteristics. In Treasure Data, the parent segment is your total population of people, accounts, or other type of collection and can be both existing and potential customers. <br> <br>You create segments to divide the population into subgroups of consumers based on some type of shared characteristics. Segments and subsegments enable more specific targeting for your marketing campaigns. <br> <br> <br>_Treasure Data is making an effort to use more inclusive language in its product, content, and customer solutions. As we gradually make the move to replace insensitive language beginning in our UI, you may continue to see parent segments in the UI, for example, referenced as master segment in portions of Treasure Data APIs._
paths:
  /audiences/{audienceId}/segments:
    x-external: true
    get:
      tags:
      - Segments
      summary: Retrieve list of segments
      description: Retrieve a list of segments.
      operationId: segments#index
      parameters:
      - name: audienceId
        in: path
        description: Master Segment id of the segment
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Segment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        4XX:
          $ref: '#/components/responses/ClientError'
        5XX:
          $ref: '#/components/responses/ServerError'
      security:
      - TdApikeyAuth: []
    post:
      tags:
      - Segments
      summary: Create new segment
      description: Create a new segment.
      operationId: segments#create
      parameters:
      - name: audienceId
        in: path
        description: Master Segment id of the segment
        required: true
        schema:
          type: integer
          format: int64
      requestBody:
        description: Segment parameters to create
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SegmentParameters'
        required: true
      responses:
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        4XX:
          $ref: '#/components/responses/ClientError'
        5XX:
          $ref: '#/components/responses/ServerError'
      security:
      - TdApikeyAuth: []
  /audiences/{audienceId}/folders/{folderId}/segments:
    x-external: true
    get:
      tags:
      - Segments
      summary: Retrieve list of segments in a folder
      description: Retrieve a list of segments in a folder.
      operationId: segment_folders#segments
      parameters:
      - name: audienceId
        in: path
        description: Master Segment id of the segment
        required: true
        schema:
          type: integer
          format: int64
      - name: folderId
        in: path
        description: Segment Folder ID
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Segment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        4XX:
          $ref: '#/components/responses/ClientError'
        5XX:
          $ref: '#/components/responses/ServerError'
      security:
      - TdApikeyAuth: []
  /audiences/{audienceId}/segments/query:
    x-external: true
    post:
      tags:
      - Segments
      summary: Retrieve SQL from segment rule
      description: Retrieve a SQL from a segment rule.
      operationId: segments#query
      parameters:
      - name: audienceId
        in: path
        description: Master Segment id of the segment
        required: true
        schema:
          type: integer
          format: int64
      requestBody:
        description: Segment parameters to create
        content:
          application/json:
            schema:
              type: object
              properties:
                format:
                  type: string
                  enum:
                  - sql
                realtime:
                  type: boolean
                  deprecated: true
                  description: use `kind` instead
                kind:
                  type: integer
                  description: '0: batch, 1: realtime, 2: funnel_stage'
                rule:
                  $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule'
                funnel_stage:
                  type: object
                  properties:
                    funnel_id:
                      type: integer
                      format: int64
                    stage_id:
                      type: integer
                      format: int64
                  description: required if creating segment as a rule of funnel_stage
        required: true
      responses:
        '200':
          description: batch segment query
          content:
            application/json:
              schema:
                oneOf:
                - type: object
                  description: batch segment query; return if the requestBody is realtime=false
                  additionalProperties: false
                  properties:
                    sql:
                      type: string
                - type: object
                  description: realtime segment query; return if the requestBody is realtime=true
                  required:
                  - sql
                  - statement
                  - batch_workflows
                  properties:
                    sql:
                      type: string
                    statement:
                      type: object
                      description: an object tree which will be sent to cdp-kvs-server
                    batch_workflows:
                      type: object
                      description: workflow definition; key is file namd and value is file content of the generating workflow.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        4XX:
          $ref: '#/components/responses/ClientError'
        5XX:
          $ref: '#/components/responses/ServerError'
      security:
      - TdApikeyAuth: []
  /audiences/{audienceId}/segments/queries:
    x-external: true
    post:
      tags:
      - Segments
      summary: Retrieve number of profiles based on set of segment rules
      description: Retrieve the number of profiles produced by a set of segment rules.
      operationId: segments#new_query
      parameters:
      - name: audienceId
        in: path
        description: Master Segment id of the segment
        required: true
        schema:
          type: integer
          format: int64
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                columns:
                  type: array
                  items:
                    type: string
                realtime:
                  type: boolean
                  deprecated: true
                  description: use `kind` instead
                kind:
                  type: integer
                  description: '0: batch, 1: realtime, 2: funnel_stage'
                rule:
                  $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule'
                funnel_stage:
                  type: object
                  properties:
                    funnel_id:
                      type: integer
                      format: int64
                    stage_id:
                      type: integer
                      format: int64
                  description: required if creating segment as a rule of funnel_stage
                pageSize:
                  type: integer
                maxPage:
                  type: integer
                enableMv:
                  type: string
                  description: '"true", "false"'
                filterString:
                  type: string
                  example: Alex
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentQueryStatus'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        4XX:
          $ref: '#/components/responses/ClientError'
        5XX:
          $ref: '#/components/responses/ServerError'
      security:
      - TdApikeyAuth: []
  /audiences/{audienceId}/segments/{segmentId}:
    x-external: true
    get:
      tags:
      - Segments
      summary: Retrieve segment by ID
      description: Retrieve a segment based on its identifier.
      operationId: segments#show
      parameters:
      - name: audienceId
        in: path
        description: Master Segment id of the segment
        required: true
        schema:
          type: integer
          format: int64
      - name: segmentId
        in: path
        description: ID of Segment to return
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Segment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        4XX:
          $ref: '#/components/responses/ClientError'
        5XX:
          $ref: '#/components/responses/ServerError'
      security:
      - TdApikeyAuth: []
    put:
      tags:
      - Segments
      summary: Update segment
      description: Update a segment.
      operationId: segments#update
      parameters:
      - name: audienceId
        in: path
        description: Master Segment id of the segment
        required: true
        schema:
          type: integer
          format: int64
      - name: segmentId
        in: path
        description: ID of Segment that needs to be updated
        required: true
        schema:
          type: integer
          format: int64
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SegmentParameters'
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Segment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        4XX:
          $ref: '#/components/responses/ClientError'
        5XX:
          $ref: '#/components/responses/ServerError'
      security:
      - TdApikeyAuth: []
    delete:
      tags:
      - Segments
      summary: Delete segment (legacy)
      description: Delete a segment. <br> <br> <br> _This endpoint is for Audience Studio legacy. For the latest Audience Studio, contact your Customer Success Representative._
      operationId: segments#delete
      parameters:
      - name: audienceId
        in: path
        description: Master Segment id of the segment
        required: true
        schema:
          type: integer
          format: int64
      - name: segmentId
        in: path
        description: Segment id to delete
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        4XX:
          $ref: '#/components/responses/ClientError'
        5XX:
          $ref: '#/components/responses/ServerError'
      security:
      - TdApikeyAuth: []
  /audiences/{audienceId}/segments/queries/{queryId}:
    x-external: true
    get:
      tags:
      - Segments
      summary: Retrieve status of query
      description: Retrieve the status of a query.
      operationId: segments#query_status
      parameters:
      - name: audienceId
        in: path
        description: Audience ID of the segment
        required: true
        schema:
          type: integer
          format: int64
      - name: queryId
        in: path
        description: ID of query
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentQueryStatus'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        4XX:
          $ref: '#/components/responses/ClientError'
        5XX:
          $ref: '#/components/responses/ServerError'
      security:
      - TdApikeyAuth: []
  /audiences/{audienceId}/segments/queries/{queryId}/kill:
    x-external: true
    post:
      tags:
      - Segments
      summary: Kill current running query of segment
      description: Kill the current running query associated with the segment.
      operationId: segments#kill_query
      parameters:
      - name: audienceId
        in: path
        description: Audience ID of the segment
        required: true
        schema:
          type: integer
          format: int64
      - name: queryId
        in: path
        description: ID of query
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: A message indicates canceling query didn't complete successfully
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        4XX:
          $ref: '#/components/responses/ClientError'
        5XX:
          $ref: '#/components/responses/ServerError'
      security:
      - TdApikeyAuth: []
  /audiences/{audienceId}/segments/queries/{queryId}/customers:
    x-external: true
    get:
      tags:
      - Segments
      summary: Retrieve profiles of query
      description: Retrieve the profiles of a query.
      operationId: segments#index_query_customers
      parameters:
      - name: audienceId
        in: path
        description: Audience ID of the segment
        required: true
        schema:
          type: integer
          format: int64
      - name: queryId
        in: path
        description: ID of query
        required: true
        schema:
          type: string
      - name: page
        in: query
        schema:
          type: number
          minimum: 1
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SegmentQueryCustomers'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        4XX:
          $ref: '#/components/responses/ClientError'
        5XX:
          $ref: '#/components/responses/ServerError'
      security:
      - TdApikeyAuth: []
  /audiences/{audienceId}/segments/{segmentId}/statistics:
    x-external: true
    get:
      tags:
      - Segments
      summary: Retrieve population statistics of segment
      description: Retrieve the population history of the segment. The history is returned per day and those days are calculated in the timezone of the audience. Note that funnel_stage kind doesn't have statistics via this endpoint.
      operationId: segments#statistics
      parameters:
      - name: audienceId
        in: path
        description: Audience ID of the segment
        required: true
        schema:
          type: integer
          format: int64
      - name: segmentId
        in: path
        description: ID of Segment to return
        required: true
        schema:
          type: integer
          format: int64
      - name: from
        in: query
        description: from date
        schema:
          type: string
          format: date
          example: '2019-01-01'
      - name: to
        in: query
        description: to date (inclusive)
        schema:
          type: string
          format: date
          example: '2019-04-30'
      responses:
        '200':
          description: array of tuple of statistics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Statistic'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        4XX:
          $ref: '#/components/responses/ClientError'
        5XX:
          $ref: '#/components/responses/ServerError'
      security:
      - TdApikeyAuth: []
  /entities/segments:
    x-external: true
    post:
      tags:
      - Segments
      summary: Create segment
      description: Create a new segment.
      requestBody:
        content:
          application/vnd.treasuredata.v1+json:
            schema:
              $ref: '#/components/schemas/EntitiesSegmentUpdateRepresentation'
      responses:
        '200':
          description: Create a segment
          content:
            application/vnd.treasuredata.v1+json:
              schema:
                $ref: '#/components/schemas/EntitiesGetSegmentJsonApiResponse'
  /entities/segments/{id}:
    x-external: true
    get:
      tags:
      - Segments
      summary: Retrieve segment by ID
      description: Retrieve a segment by ID.
      parameters:
      - name: id
        in: path
        description: Segment ID
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: Returns a segment by ID
          content:
            application/vnd.treasuredata.v1+json:
              schema:
                $ref: '#/components/schemas/EntitiesGetSegmentJsonApiResponse'
    patch:
      tags:
      - Segments
      summary: Update segment
      description: Update a segment.
      parameters:
      - name: id
        in: path
        description: Segment to update
        required: true
        schema:
          type: integer
          format: int64
      requestBody:
        content:
          application/vnd.treasuredata.v1+json:
            schema:
              $ref: '#/components/schemas/EntitiesSegmentUpdateRepresentation'
      responses:
        '200':
          description: Update a segment
          content:
            application/vnd.treasuredata.v1+json:
              schema:
                $ref: '#/components/schemas/EntitiesGetSegmentJsonApiResponse'
    delete:
      tags:
      - Segments
      summary: Delete segment
      description: Delete a segment.
      parameters:
      - name: id
        in: path
        description: Delete a segment
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: Delete a segment
          content:
            application/vnd.treasuredata.v1+json:
              schema:
                $ref: '#/components/schemas/EntitiesGetSegmentJsonApiResponse'
components:
  schemas:
    EntitiesSegmentUpdateRepresentation:
      type: object
      properties:
        id:
          type: string
          pattern: '[1-9][0-9]*'
        type:
          type: string
          enum:
          - segment-batch
          - segment-realtime
          - segment-funnel-stage
        attributes:
          type: object
          properties:
            name:
              type: string
            description:
              type:
              - string
              - 'null'
            rule:
              $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule'
            funnel_stage:
              type: object
              properties:
                funnel_id:
                  type: integer
                  format: int64
                stage_id:
                  type: integer
                  format: int64
              description: required if type is segment-funnel-stage to create segment as a rule of funnel_stage
            segmentInsightDashboardId:
              type:
              - integer
              - 'null'
              format: int64
        relationships:
          type: object
          properties:
            parentFolder:
              $ref: '#/components/schemas/RelationshipsFolderJsonApiResource'
    partial_v5_rule.yaml-v5IonRule-ionRule:
      properties:
        conditions:
          items:
            oneOf:
            - $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-valueConditionSet'
          type: array
        expr:
          type: string
        limit:
          $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-valueLimit'
        type:
          enum:
          - Or
          - And
          - Composite
          type: string
      required:
      - conditions
      - type
      type: object
    partial_v5_rule.yaml-v5IonRule:
      oneOf:
      - $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-ionRule'
      - additionalProperties: false
        maxProperties: 0
        minProperties: 0
        type:
        - object
        - 'null'
    UserJsonApiResource:
      type: object
      required:
      - id
      - type
      - attributes
      properties:
        id:
          type: string
          pattern: '[1-9][0-9]*'
        type:
          type: string
          enum:
          - user
        attributes:
          type: object
          required:
          - tdUserId
          - name
          properties:
            tdUserId:
              type: string
              pattern: '[1-9][0-9]*'
            name:
              type: string
    partial_v5_rule.yaml-v5IonRule-attributeNameValue:
      properties:
        name:
          type: string
      required:
      - name
      type: object
    partial_v5_rule.yaml-v5IonRule-valueOperator:
      oneOf:
      - properties:
          not:
            type: boolean
          rightValue:
            properties:
              last:
                oneOf:
                - type: number
                - $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-localDuration'
              unit:
                $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-unit'
            required:
            - last
            - unit
            type: object
          type:
            enum:
            - GreaterEqual
            type: string
        required:
        - not
        - rightValue
        - type
        type: object
      - anyOf:
        - properties:
            duration:
              $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-duration'
            from:
              properties:
                last:
                  oneOf:
                  - type: number
                  - $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-localDuration'
                unit:
                  $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-unit'
              required:
              - last
              - unit
              type: object
            not:
              type: boolean
            reverse:
              type: boolean
            type:
              enum:
              - TimeRange
              type: string
          required:
          - duration
          - from
          - not
          - reverse
          - type
          type: object
        - properties:
            from:
              properties:
                unit:
                  $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-unit'
              required:
              - unit
              type: object
            not:
              enum:
              - false
              type: boolean
            type:
              enum:
              - TimeRange
              type: string
          required:
          - from
          - not
          - type
          type: object
        - properties:
            type:
              enum:
              - TimeToday
              type: string
          required:
          - type
          type: object
        - properties:
            from:
              properties:
                unit:
                  $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-unit'
              required:
              - unit
              type: object
            type:
              enum:
              - TimeThis
              type: string
          required:
          - from
          - type
          type: object
        - properties:
            from:
              properties:
                unit:
                  $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-unit'
              required:
              - unit
              type: object
            type:
              enum:
              - TimeNext
              type: string
          required:
          - from
          - type
          type: object
        - properties:
            type:
              enum:
              - TimeWithinNext
              type: string
            unit:
              $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-unit'
            value:
              type: string
          required:
          - type
          - unit
          - value
          type: object
        - properties:
            type:
              enum:
              - TimeWithinPast
              type: string
            unit:
              $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-unit'
            value:
              type: string
          required:
          - type
          - unit
          - value
          type: object
        - properties:
            from:
              properties:
                next:
                  oneOf:
                  - type: number
                  - $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-localDuration'
                unit:
                  $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-unit'
              required:
              - next
              - unit
              type: object
            not:
              enum:
              - false
              type: boolean
            to:
              properties:
                next:
                  oneOf:
                  - type: number
                  - $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-localDuration'
                unit:
                  $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-unit'
              required:
              - next
              - unit
              type: object
            type:
              enum:
              - TimeInBetweenNext
              type: string
          required:
          - from
          - not
          - to
          - type
          type: object
      - properties:
          not:
            type: boolean
          rightValue:
            properties:
              timestamp:
                type: string
            required:
            - timestamp
            type: object
          type:
            enum:
            - Equal
            type: string
        required:
        - not
        - rightValue
        - type
        type: object
      - properties:
          not:
            enum:
            - false
            type: boolean
          rightValue:
            oneOf:
            - properties:
                timestamp:
                  type: string
              required:
              - timestamp
              type: object
            - properties:
                last:
                  oneOf:
                  - type: number
                  - $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-localDuration'
                unit:
                  $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-unit'
              required:
              - last
              - unit
              type: object
          type:
            enum:
            - Greater
            type: string
        required:
        - not
        - rightValue
        - type
        type: object
      - properties:
          not:
            enum:
            - false
            type: boolean
          rightValue:
            properties:
              timestamp:
                type: string
            required:
            - timestamp
            type: object
          type:
            enum:
            - GreaterEqual
            type: string
        required:
        - not
        - rightValue
        - type
        type: object
      - properties:
          not:
            enum:
            - false
            type: boolean
          rightValue:
            oneOf:
            - properties:
                timestamp:
                  type: string
              required:
              - timestamp
              type: object
            - properties:
                last:
                  oneOf:
                  - type: number
                  - $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-localDuration'
                unit:
                  $ref: '#/components/schemas/partial_v5_rule.yaml-v5IonRule-unit'
              required:
              - last
              - unit
              type: object
          type:
            enum:
     

# --- truncated at 32 KB (76 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/treasure-data/refs/heads/main/openapi/treasure-data-segments-api-openapi.yml