NNotifyy CRM

Segments

Create a segment

Create an ACTIVE or STATIC CRM segment in the tenant and project derived from the access token.

Overview

Use this endpoint to create a CRM segment for one supported object type. ACTIVE segments require a filters payload. STATIC segments can be created without filters, and if filters are supplied, member resolution runs during creation. The public segment create flow routes by the segment objectType and reuses the shared BAU segment engine instead of a separate public-only implementation. It requires public api oauth access token authentication and the crm.segments.write scope.

POST/api/segments

cURL

POST
bash
curl --request POST \  --url 'https://crm.notifyy.io/api/segments' \  --header 'Authorization: Bearer nfy_public_api_access_token' \  --header 'Content-Type: application/json' \  --header 'Accept: application/json' \  --data '{  "name": "High value contacts",  "objectType": "contact",  "segmentType": "ACTIVE",  "description": "Segment for high intent contacts",  "filters": {    "logic": "AND",    "groups": [      {        "logic": "AND",        "filters": [          {            "propertyId": 101,            "property": "lifecyclestage",            "operator": "equals",            "value": "customer"          },          {            "propertyId": 102,            "property": "created_ts",            "operator": "LAST_N_DAYS",            "value": "30"          }        ]      }    ]  }}'

Authorization

Public API OAuth access token

crm.segments.write

Sample Request Body

json
{  "name": "High value contacts",  "objectType": "contact",  "segmentType": "ACTIVE",  "description": "Segment for high intent contacts",  "filters": {    "logic": "AND",    "groups": [      {        "logic": "AND",        "filters": [          {            "propertyId": 101,            "property": "lifecyclestage",            "operator": "equals",            "value": "customer"          },          {            "propertyId": 102,            "property": "created_ts",            "operator": "LAST_N_DAYS",            "value": "30"          }        ]      }    ]  }}

Additional Examples

Equality filter

json
{  "logic": "AND",  "groups": [    {      "logic": "AND",      "filters": [        {          "propertyId": 101,          "property": "lifecyclestage",          "operator": "EQUALS",          "value": "customer"        }      ]    }  ]}

Numeric comparison filter

json
{  "logic": "AND",  "groups": [    {      "logic": "AND",      "filters": [        {          "propertyId": 201,          "property": "amount",          "operator": "GT",          "value": "1000"        }      ]    }  ]}

String contains filter

json
{  "logic": "AND",  "groups": [    {      "logic": "AND",      "filters": [        {          "propertyId": 301,          "property": "email",          "operator": "CONTAINS",          "value": "@notifyy.io"        }      ]    }  ]}

IN list matching filter

json
{  "logic": "AND",  "groups": [    {      "logic": "AND",      "filters": [        {          "propertyId": 401,          "property": "status",          "operator": "IN",          "values": [            "OPEN",            "WON",            "QUALIFIED"          ]        }      ]    }  ]}

BETWEEN range filter

json
{  "logic": "AND",  "groups": [    {      "logic": "AND",      "filters": [        {          "propertyId": 501,          "property": "amount",          "operator": "BETWEEN",          "from": 100,          "to": 500        }      ]    }  ]}

BETWEEN using legacy values array

json
{  "logic": "AND",  "groups": [    {      "logic": "AND",      "filters": [        {          "propertyId": 502,          "property": "amount",          "operator": "BETWEEN",          "values": [            "100",            "500"          ]        }      ]    }  ]}

Null check filter

json
{  "logic": "AND",  "groups": [    {      "logic": "AND",      "filters": [        {          "propertyId": 601,          "property": "phone",          "operator": "IS_NULL"        }      ]    }  ]}

Boolean convenience filter

json
{  "logic": "AND",  "groups": [    {      "logic": "AND",      "filters": [        {          "propertyId": 701,          "property": "is_active",          "operator": "IS_TRUE"        }      ]    }  ]}

Relative date filter

json
{  "logic": "AND",  "groups": [    {      "logic": "AND",      "filters": [        {          "propertyId": 801,          "property": "created_ts",          "operator": "LAST_N_DAYS",          "value": "30"        }      ]    }  ]}

Recurring date filter

json
{  "logic": "AND",  "groups": [    {      "logic": "AND",      "filters": [        {          "propertyId": 802,          "property": "renewal_date",          "operator": "RECURS_MONTHS_AFTER",          "value": "1"        }      ]    }  ]}

Multi-select array filter

json
{  "logic": "AND",  "groups": [    {      "logic": "AND",      "filters": [        {          "propertyId": 901,          "property": "tags",          "operator": "HAS_ALL",          "values": [            "vip",            "newsletter"          ]        }      ]    }  ]}

OR across groups filter

json
{  "logic": "OR",  "groups": [    {      "logic": "AND",      "filters": [        {          "propertyId": 101,          "property": "lifecyclestage",          "operator": "EQ",          "value": "customer"        }      ]    },    {      "logic": "AND",      "filters": [        {          "propertyId": 102,          "property": "email",          "operator": "CONTAINS",          "value": "@notifyy.io"        }      ]    }  ]}

Sample Response

json
{  "success": true,  "message": "Segment created successfully",  "data": {    "id": 999,    "name": "High value contacts",    "objectType": "contact",    "segmentType": "ACTIVE",    "description": "Segment for high intent contacts",    "currentVersion": 1,    "createdAt": "2026-08-01T09:15:30Z",    "updatedAt": "2026-08-01T09:15:30Z"  }}

Status Codes

CodeDescription
201Segment was created.
400Request body is invalid, objectType is unsupported, filters is missing for ACTIVE segments, or a filter payload does not match the current public contract.
401Public API access token is missing, invalid, expired, or revoked.

Headers

AuthorizationstringRequired

Public API OAuth bearer token.

Example: Bearer nfy_public_api_access_token

Content-TypestringRequired

Request body media type.

Example: application/json

AcceptstringRequired

Expected response media type.

Example: application/json

Request body

namestringRequired

Segment name. Duplicate names within the same tenant, project, and object type are rejected.

Example: High value contacts

objectTypestringRequired

Lowercase CRM object type. Only object types wired into the current segment filter execution context are supported.

Example: contact

segmentTypestringRequired

Segment type. Supported values are ACTIVE and STATIC.

Example: ACTIVE

descriptionstringOptional

Free-text segment description.

Example: Segment for high intent contacts

filtersobjectRequired

Filter definition for dynamic segment membership. Required for ACTIVE segments and optional for STATIC segments.

filters.logicstringRequired

Top-level group combiner. Supported values are AND and OR.

Example: AND

filters.groupsobject[]Required

One or more filter groups.

filters.groups[].logicstringOptional

Per-group combiner. Supported values are AND and OR. Defaults to AND in execution if omitted.

Example: AND

filters.groups[].filtersobject[]Required

Individual filter conditions.

filters.groups[].filters[].objectstringOptional

Optional object hint field exposed by the BAU DTO. The public create flow routes by the segment objectType rather than this field.

filters.groups[].filters[].propertyIdintegerRequired

Property ID used for property accessibility validation.

Example: 101

filters.groups[].filters[].propertystringRequired

Property internal name or hot-field name.

Example: lifecyclestage

filters.groups[].filters[].operatorstringRequired

Filter operator. Accepted canonical operators and aliases are documented in the operator matrix below.

Example: EQUALS

filters.groups[].filters[].valuescalarOptional

Single comparison value used by single-value operators such as EQ, GT, CONTAINS, and LAST_N_DAYS.

Example: customer

filters.groups[].filters[].valuesarrayOptional

Multi-value list used by operators such as IN, NOT_IN, CONTAINS_ANY, and HAS_ALL.

Example: ["OPEN","WON","QUALIFIED"]

filters.groups[].filters[].fromscalarOptional

Lower bound for BETWEEN and NOT_BETWEEN.

Example: 100

filters.groups[].filters[].toscalarOptional

Upper bound for BETWEEN and NOT_BETWEEN.

Example: 500

Supported Object Types

The current segment filter execution path is wired only for the object types listed here. objectType must be lowercase.

Object Type

contact

Support Notes

Supported by the current public segment filter execution path.

Object Type

company

Support Notes

Supported by the current public segment filter execution path.

Object Type

deal

Support Notes

Supported by the current public segment filter execution path.

Object Type

ticket

Support Notes

Supported by the current public segment filter execution path.

Object Type

appointment

Support Notes

Supported by the current public segment filter execution path.

Object Type

meeting

Support Notes

Supported by the current public segment filter execution path.

Object Type

product

Support Notes

Supported by the current public segment filter execution path.

Object Type

order

Support Notes

Supported by the current public segment filter execution path.

Object Type

lead

Support Notes

Supported by the current public segment filter execution path.

Object Type

payment

Support Notes

Supported by the current public segment filter execution path.

Object Type

call

Support Notes

Supported by the current public segment filter execution path.

Supported Segment Types

ACTIVE and STATIC have different filter requirements during create.

Segment Type

ACTIVE

Behavior

filters is required.

Segment Type

STATIC

Behavior

filters is optional. If filters is supplied, member resolution runs during creation.

Filter Operator Matrix

These are the canonical operators explicitly documented in the current segment create flow. Common aliases listed here are accepted by the shared BAU executor.

Operator

EQ

Accepted Aliases

IS, EQUALS, ON

Payload Field(s)

value

Functionality

Matches records where the field equals the supplied value.

Operator

NEQ

Accepted Aliases

NOT_EQUALS, NOT_EQUAL

Payload Field(s)

value

Functionality

Matches records where the field does not equal the supplied value.

Operator

GT

Accepted Aliases

GREATER_THAN, AFTER

Payload Field(s)

value

Functionality

Matches records where the field is greater than the supplied value.

Operator

GTE

Accepted Aliases

GREATER_THAN_OR_EQUAL

Payload Field(s)

value

Functionality

Matches records where the field is greater than or equal to the supplied value.

Operator

LT

Accepted Aliases

LESS_THAN, BEFORE

Payload Field(s)

value

Functionality

Matches records where the field is less than the supplied value.

Operator

LTE

Accepted Aliases

LESS_THAN_OR_EQUAL

Payload Field(s)

value

Functionality

Matches records where the field is less than or equal to the supplied value.

Operator

IN

Accepted Aliases

None

Payload Field(s)

values

Functionality

Matches records where the field equals any value in the provided list.

Operator

NOT_IN

Accepted Aliases

None

Payload Field(s)

values

Functionality

Matches records where the field does not equal any value in the provided list.

Operator

CONTAINS

Accepted Aliases

None

Payload Field(s)

value

Functionality

Case-insensitive substring match.

Operator

NOT_CONTAINS

Accepted Aliases

DOES_NOT_CONTAIN

Payload Field(s)

value

Functionality

Case-insensitive negative substring match.

Operator

STARTS_WITH

Accepted Aliases

BEGINS_WITH

Payload Field(s)

value

Functionality

Case-insensitive prefix match.

Operator

NOT_STARTS_WITH

Accepted Aliases

DOES_NOT_BEGIN_WITH

Payload Field(s)

N/A in current strategy set

Functionality

Alias is normalized by the executor, but there is no corresponding strategy implementation in the current filter registry.

Operator

ENDS_WITH

Accepted Aliases

None

Payload Field(s)

value

Functionality

Case-insensitive suffix match.

Operator

CONTAINS_ANY

Accepted Aliases

None

Payload Field(s)

values or value

Functionality

Case-insensitive substring match against any supplied candidate.

Operator

NOT_CONTAINS_ANY

Accepted Aliases

None

Payload Field(s)

values or value

Functionality

Case-insensitive negative substring match against all supplied candidates.

Operator

STARTS_WITH_ANY

Accepted Aliases

None

Payload Field(s)

values or value

Functionality

Case-insensitive prefix match against any supplied candidate.

Operator

ENDS_WITH_ANY

Accepted Aliases

None

Payload Field(s)

values or value

Functionality

Case-insensitive suffix match against any supplied candidate.

Operator

IS_NULL

Accepted Aliases

IS_EMPTY, NO_VALUE

Payload Field(s)

none

Functionality

Matches records where the field is null or not present.

Operator

IS_NOT_NULL

Accepted Aliases

IS_NOT_EMPTY, HAS_VALUE

Payload Field(s)

none

Functionality

Matches records where the field exists or has a value.

Operator

NOT_HAS_PROPERTY

Accepted Aliases

None

Payload Field(s)

none

Functionality

Matches records where the field row is absent in the EAV store.

Operator

BETWEEN

Accepted Aliases

None

Payload Field(s)

from and to, or legacy values[0..1]

Functionality

Matches records where the field falls inside the supplied range.

Operator

NOT_BETWEEN

Accepted Aliases

None

Payload Field(s)

from and to, or legacy values[0..1]

Functionality

Matches records where the field falls outside the supplied range.

Operator

EQ_ALL

Accepted Aliases

None

Payload Field(s)

values

Functionality

Matches multi-select fields containing all supplied values.

Operator

NEQ_ALL

Accepted Aliases

None

Payload Field(s)

values

Functionality

Matches multi-select fields whose array value is not equal to the supplied set.

Operator

HAS_ALL

Accepted Aliases

None

Payload Field(s)

values

Functionality

Matches multi-select fields that contain all supplied values.

Operator

NOT_HAS_ALL

Accepted Aliases

None

Payload Field(s)

values

Functionality

Matches multi-select fields that do not contain all supplied values.

Operator

IS_TRUE

Accepted Aliases

None

Payload Field(s)

none

Functionality

Convenience boolean operator normalized to equality with true.

Operator

IS_FALSE

Accepted Aliases

None

Payload Field(s)

none

Functionality

Convenience boolean operator normalized to equality with false.

Operator

IS_TODAY

Accepted Aliases

None

Payload Field(s)

none

Functionality

Matches date or datetime fields whose date value is today.

Operator

WAS_YESTERDAY

Accepted Aliases

None

Payload Field(s)

none

Functionality

Matches date or datetime fields whose date value was yesterday.

Operator

IS_TOMORROW

Accepted Aliases

None

Payload Field(s)

none

Functionality

Matches date or datetime fields whose date value is tomorrow.

Operator

LAST_N_DAYS

Accepted Aliases

None

Payload Field(s)

value

Functionality

Matches date or datetime fields falling within the last N days, inclusive of today.

Operator

NEXT_N_DAYS

Accepted Aliases

None

Payload Field(s)

value

Functionality

Matches date or datetime fields falling within the next N days, inclusive of today.

Operator

UPDATED_IN_LAST

Accepted Aliases

None

Payload Field(s)

value

Functionality

Matches EAV-backed fields updated within the last N days.

Operator

NOT_UPDATED_IN_LAST

Accepted Aliases

None

Payload Field(s)

value

Functionality

Matches EAV-backed fields not updated within the last N days.

Operator

RECURS_TODAY

Accepted Aliases

None

Payload Field(s)

none

Functionality

Matches date or datetime fields whose month and day equal today, ignoring year.

Operator

RECURS_DAYS_BEFORE

Accepted Aliases

None

Payload Field(s)

value

Functionality

Matches month/day values equal to N days before today, ignoring year.

Operator

RECURS_WEEKS_BEFORE

Accepted Aliases

None

Payload Field(s)

value

Functionality

Matches month/day values equal to N weeks before today, ignoring year.

Operator

RECURS_MONTHS_BEFORE

Accepted Aliases

None

Payload Field(s)

value

Functionality

Matches month/day values equal to N months before today, ignoring year.

Operator

RECURS_DAYS_AFTER

Accepted Aliases

None

Payload Field(s)

value

Functionality

Matches month/day values equal to N days after today, ignoring year.

Operator

RECURS_WEEKS_AFTER

Accepted Aliases

None

Payload Field(s)

value

Functionality

Matches month/day values equal to N weeks after today, ignoring year.

Operator

RECURS_MONTHS_AFTER

Accepted Aliases

None

Payload Field(s)

value

Functionality

Matches month/day values equal to N months after today, ignoring year.

Operator

ROLLING_DATE_RANGE

Accepted Aliases

None

Payload Field(s)

Not exposed by current public DTO

Functionality

Exists in the shared filter engine, but the current public segment request DTO does not expose the rollingDate payload required to use it.

Filter Value Guidance

Use only the payload fields documented for each operator family. For null and presence operators, do not send value, values, from, or to.

Operator Family

Single-value equality / comparison

Operators

EQ, NEQ, GT, GTE, LT, LTE

Expected Request Field(s)

value

Notes

Numeric strings are parsed as numbers when applicable. Date strings in yyyy-MM-dd or yyyy-MM-ddTHH:mm:ss... format are routed as dates.

Operator Family

List matching

Operators

IN, NOT_IN

Expected Request Field(s)

values

Notes

Values are compared case-insensitively for string fields.

Operator Family

String pattern

Operators

CONTAINS, NOT_CONTAINS, STARTS_WITH, ENDS_WITH, CONTAINS_ANY, NOT_CONTAINS_ANY, STARTS_WITH_ANY, ENDS_WITH_ANY

Expected Request Field(s)

value or values

Notes

Pattern operators keep numeric-looking strings as strings, for example phone suffix matching.

Operator Family

Null / presence

Operators

IS_NULL, IS_NOT_NULL, NOT_HAS_PROPERTY

Expected Request Field(s)

none

Notes

Do not send value, values, from, or to.

Operator Family

Range

Operators

BETWEEN, NOT_BETWEEN

Expected Request Field(s)

from and to

Notes

Legacy values: [min, max] is still supported by BAU.

Operator Family

Multi-select arrays

Operators

EQ_ALL, NEQ_ALL, HAS_ALL, NOT_HAS_ALL

Expected Request Field(s)

values

Notes

Used for array-backed EAV fields such as tag-style multi-select values.

Operator Family

Boolean convenience

Operators

IS_TRUE, IS_FALSE

Expected Request Field(s)

none

Notes

Internally converted to equality against a boolean value.

Operator Family

Relative / recurring date

Operators

IS_TODAY, WAS_YESTERDAY, IS_TOMORROW, LAST_N_DAYS, NEXT_N_DAYS, UPDATED_IN_LAST, NOT_UPDATED_IN_LAST, RECURS_*

Expected Request Field(s)

none or value for N-based variants

Notes

For N-based date operators, send value as a numeric string such as "7".

Notes And Caveats

Area

objectType validation

Documented Behavior

objectType is enforced in lowercase by BAU segment validation.

Area

Execution engine

Documented Behavior

Public segment creation reuses BAU SegmentService.createSegment(...); there is no duplicate public-only filter engine.

Area

ROLLING_DATE_RANGE

Documented Behavior

The shared filter engine includes ROLLING_DATE_RANGE, but the current public segment create DTO does not expose a rollingDate payload, so it is not treated as usable through this endpoint.

Area

Exclusions contract

Documented Behavior

The BAU exclusion resolver currently reads exclusion keys as segments and object_ids from stored filter JSON, while the Java DTO surface exposes segmentIds and objectIds. Until those shapes are normalized end to end, exclusions are not treated as a stable public contract.

Response fields

successboolean

Whether the request succeeded.

Example: true

messagestring

Human-readable result message.

Example: Segment created successfully

data.idinteger

Segment record ID.

Example: 999

data.namestring

Segment name.

Example: High value contacts

data.objectTypestring

Segment object type.

Example: contact

data.segmentTypestring

Segment type.

Example: ACTIVE

data.descriptionstring | null

Segment description.

Example: Segment for high intent contacts

data.currentVersioninteger

Current segment version number.

Example: 1

data.createdAtstring<date-time>

Creation timestamp.

Example: 2026-08-01T09:15:30Z

data.updatedAtstring<date-time>

Last update timestamp.

Example: 2026-08-01T09:15:30Z