Skip to main content
POST
Create segment definition
Required scopes: customers:rw

Authorizations

Authorization
string
header
required

Use your account ID as the username and your personal access token (PAT) as the password, or pass a Base64-encoded value directly in the Authorization header. For more information, see the personal access tokens guide.

Body

application/json

The custom segment definition to create. The service assigns an ID starting at 2 and always assigns the custom type. The request cannot include segment_id or segment_type; supplying either field, including a built-in ID of 0 or 1, returns a validation error.

definition
object
required

A node in a segment definition tree: one of two operators (and, or) or one of five conditions (name_set, email_set, phone_number_set, customer_property_set, last_active_days_ago). Every node type rejects unknown fields, including fields that are valid on a different node type.

Response

The created segment definition.

A segment definition.

segment_id
integer<int64>
required

The definition ID, unique within the organization. The built-in definitions use 0 (lead) and 1 (qualified lead). Custom definitions receive IDs starting at 2.

Example:

2

segment_type
enum<string>
required

The server-assigned segment type. It cannot be set or changed through the API.

  • lead — the built-in definition with ID 0.
  • qualified_lead — the built-in definition with ID 1.
  • custom — a definition created through create_segment_definition.
Available options:
lead,
qualified_lead,
custom
definition
object
required

A node in a segment definition tree: one of two operators (and, or) or one of five conditions (name_set, email_set, phone_number_set, customer_property_set, last_active_days_ago). Every node type rejects unknown fields, including fields that are valid on a different node type.

last_updated_at
string<date-time> | null
required

The date and time when the definition was most recently created or updated. This value records request-handling time, not commit order, and is not a concurrency token. Returns null for a built-in definition before its first update.

agent_account_id
string | null
required

The account ID of the agent who last created or updated the definition. Returns null for a built-in definition before its first update.

agent_client_id
string | null
required

The client ID of the app that last created or updated the definition. Returns null for a built-in definition before its first update.

referenced_customer_properties_definitions_ids
string<uuid>[]

Customer property definition IDs referenced in definition, deduplicated in definition order. Omitted when the tree has no customer_property_set node. The array includes IDs for properties archived or deleted after the segment definition was saved.