Skip to content

Create segment

Request

Create a new segment.

Bodyapplication/vnd.treasuredata.v1+json
idstring[1-9][0-9]*
typestring
Enum:"segment-batch""segment-realtime""segment-funnel-stage"
attributesobject
relationshipsobject
curl -i -X POST \
  https://api-cdp.treasuredata.com/entities/segments \
  -H 'Content-Type: application/vnd.treasuredata.v1+json' \
  -d '{
    "id": "string",
    "type": "segment-batch",
    "attributes": {
      "name": "string",
      "description": "string",
      "rule": {
        "conditions": [
          {
            "conditions": [
              {
                "exclude": true,
                "id": "string",
                "type": "FunnelStageReference"
              }
            ],
            "description": "string",
            "expr": "string",
            "type": "Or"
          }
        ],
        "expr": "string",
        "limit": {
          "number": 0,
          "orderColumns": [
            {
              "column": "string",
              "order": "ascending",
              "type": "Column"
            }
          ],
          "type": "Count"
        },
        "type": "Or"
      },
      "funnel_stage": {
        "funnel_id": 0,
        "stage_id": 0
      },
      "segmentInsightDashboardId": 0
    },
    "relationships": {
      "parentFolder": {
        "data": {
          "id": "string",
          "type": "folder-segment"
        }
      }
    }
  }'

Responses

Create a segment

Bodyapplication/vnd.treasuredata.v1+json
dataBatchSegmentJsonApiResource (object) or RealtimeSegmentJsonApiResource (object) or FunnelStageSegmentJsonApiResource (object)required
One of:
includedArray of objects(UserJsonApiResource)required
Response
{ "data": { "id": "string", "type": "segment-batch", "attributes": {}, "relationships": {} }, "included": [ {} ] }