ackDB

Create a segment

Creates a saved Segment from a name plus optional description, entityKind, filter, sort, and columns. The owner is stamped server-side from the caller's JWT (a client-supplied owner is ignored) and the segment is private to the owner by default (#284).

post/api/v1/ackdb/observe/segments

Request

  • Base URL
    http://localhost:3009
  • Auth
    HTTP bearer

Request body

namestring required
descriptionstring
entityKind'company' | 'contact' | 'person'
isDefaultboolean

Create as the default for its kind (clears any prior default). When true, name defaults to 'Default view' if omitted.

baseSegmentIdstring

Make this a DERIVED segment built on the given base segment: filter is the render-grain filter layered on top of the base's pivoted set. The base must exist and be a ROOT segment (no chains) - else 400. The render grain is an explicit entityKind when passed (must differ from the base's grain - else 400), otherwise the legacy company<->contact derivation. A base on the PERSON grain REQUIRES an explicit entityKind ('company' or 'contact') since either render grain is possible.

Example request

{
  "name": "Active paying companies",
  "description": "Companies with a paid Stripe invoice",
  "entityKind": "company",
  "filter": {
    "children": [
      {
        "traitKey": "hubspot_lifecycle_stage"
      }
    ]
  },
  "sort": [
    {
      "field": "event_count"
    }
  ],
  "columns": [
    {
      "field": "name",
      "frozen": true,
      "width": 200
    }
  ],
  "baseSegmentId": "01J9Z8Q3K2X7M4N5P6R7S8T9V0"
}

Response

Segment created.

Example response

{
  "data": {
    "id": "01J9Z8Q3K2X7M4N5P6R7S8T9V0",
    "name": "Active paying companies",
    "description": "Companies with a paid Stripe invoice",
    "entityKind": "company",
    "filter": {
      "children": [
        {
          "traitKey": "hubspot_lifecycle_stage"
        }
      ]
    },
    "sort": [
      {
        "field": "event_count"
      }
    ],
    "columns": [
      {
        "field": "name",
        "frozen": true,
        "width": 200
      }
    ],
    "ownerEmail": "rep@acme.com",
    "access": "owner"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.