Analytics building blocks tools

Event segmentations also appear under the Marketing → Customer filters and segments page, since they're often used as named customer groups.

list_expressions

Lists every expression defined in a project. Expressions are derived attributes computed from a formula: they combine customer or event attributes (properties, aggregates, running aggregates), functions (such as min, max, ifnull, floor, and concat), operators, and string literals. The response gives you the name, context type (customer or event), variable bindings, tags, and which customer or event attributes surface the result. The formula string is not included here — use get_expression for that.

By default the tool returns only active (non-archived) expressions. Set include_archived to true to return only archived ones.

Request parameters

NameTypeRequired?Description
project_idstrYesThe project ID returned by list_projects.
include_archivedboolNoIf true, return only archived expressions. Defaults to false.

Response parameters

The tool returns an ExpressionsResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the request succeeded.
datalist[ExpressionSummary]The expressions defined in the project.
archived_items_existboolWhether archived expressions exist in this project. Populated only when include_archived is false.
errorstr | nullError message if the request failed.

The ExpressionSummary object has the following fields:

FieldTypeDescription
idstrThe expression's unique ID.
namestrThe expression's display name.
context_typestrThe context the expression operates on: customer or event.
event_typestr | nullThe event type, when context_type is event.
all_exposing_propertieslist[ExpressionPropertyRef]Customer properties that surface this expression's computed value. Empty if it isn't yet exposed.
archivedboolWhether the expression has been archived.
parametrizedboolWhether the expression accepts parameters.
tagslist[str]User-defined tags.
created_by_display_namestrDisplay name of the creator.
editedfloatUnix timestamp of the last edit.
edited_by_display_namestrDisplay name of the last editor.
is_global_objectboolWhether the expression is shared across projects.
version_idstrThe version ID of the current definition.
used_bylist[any]Segmentations, reports, funnels, or campaigns that reference this expression.

get_expression

Returns the full definition of a single expression. An expression is a derived attribute: a formula that combines up to 26 named variables (A through Z) with functions, operators, and string literals. Each variable maps to a customer or event attribute, an aggregate, a running aggregate, or an inline constant. The result becomes a customer or event attribute usable in segmentations, reports, funnels, and campaigns.

Request parameters

NameTypeRequired?Description
project_idstrYesThe project ID returned by list_projects.
expression_idstrYesThe expression ID returned by list_expressions.

Response parameters

The tool returns an ExpressionResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the request succeeded.
dataExpression | nullThe full expression record.
errorstr | nullError message if the request failed.

The Expression object has the following fields:

FieldTypeDescription
idstrThe expression's unique ID.
namestrThe expression's display name.
descriptionstr | nullAn optional written description. Often null.
formulastrThe formula that combines variables (A–Z) with functions and operators. Available functions: abs(A), concat(A,B), exp(A), max(A,B), min(A,B), ifnull(A,B), floor(A), ceil(A), lower(A), upper(A), round(A), ln(A), now(), length(A), sqrt(A), and power(A,B).
context_typestrcustomer or event.
event_typestr | nullThe event type, when context_type is event.
memberslist[ExpressionMember]Variable bindings in declaration order: the first is A, the second is B, and so on. Each maps to a customer or event attribute, an aggregate, a running aggregate, or an inline constant.
exposing_propertieslist[ExpressionPropertyRef]Customer properties that surface this expression's computed value.
filterslist[any]Filters applied before the expression is evaluated.
tagslist[str]User-defined tags.
archivedboolWhether the expression has been archived.
parametrizedboolWhether the expression accepts parameters.
parametersany | nullThe parameter definitions, when parametrized is true.
company_idstrThe project ID this expression belongs to.
createdanyUnix timestamp of when the expression was created.
created_by_display_namestrDisplay name of the creator.
editedfloatUnix timestamp of the last edit.
edited_by_display_namestrDisplay name of the last editor.
is_global_objectboolWhether the expression is shared across projects.
version_idstrThe version ID of the current definition.
used_bylist[any]Segmentations, reports, funnels, or campaigns that reference this expression.

list_aggregates

Lists every aggregate defined in a project. Aggregates compute a single value over a customer's event history — for example, total purchase count, sum of order values, or date of last session. Aggregate names can be used as variable bindings inside expressions.

Request parameters

NameTypeRequired?Description
project_idstrYesThe project ID returned by list_projects.

Response parameters

The tool returns an AggregatesResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the request succeeded.
datalist[AggregateSummary]The aggregates defined in the project.
errorstr | nullError message if the request failed.

The AggregateSummary object has the following fields:

FieldTypeDescription
idstrThe aggregate's unique ID.
namestrThe aggregate's display name.
archivedboolWhether the aggregate has been archived.
tagslist[str]User-defined tags.
createdfloat | nullUnix timestamp of when the aggregate was created.
created_by_display_namestrDisplay name of the creator.
editedfloat | nullUnix timestamp of the last edit.
edited_by_display_namestrDisplay name of the last editor.
is_global_objectboolWhether the aggregate is shared across projects.
version_idstr | nullThe version ID of the current definition.
used_bylist[any]Segmentations, reports, funnels, or campaigns that reference this aggregate.
all_exposing_propertieslist[any]Customer or event properties that surface this aggregate's computed value.

get_aggregate

Returns the full definition of a single aggregate: the event filter, the aggregation type, the date filter, the attribute being aggregated, the group-by, and the output format.

Request parameters

NameTypeRequired?Description
project_idstrYesThe project ID returned by list_projects.
aggregate_idstrYesThe aggregate ID returned by list_aggregates.

Response parameters

The tool returns an AggregateResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the request succeeded.
dataAggregate | nullThe full aggregate record.
errorstr | nullError message if the request failed.

The Aggregate object adds the following fields on top of the summary record:

FieldTypeDescription
typestrThe aggregation type: count, sum, avg, min, max, median, first, last, or distinct_count.
eventanyThe event filter: which events are aggregated, including type, attribute conditions, and date range.
attributeany | nullThe event attribute being aggregated. Required for sum, avg, min, max, and median.
date_filteranyThe date range applied to events before aggregating.
independent_if_reusedboolWhether the aggregate is computed independently when reused across multiple expressions.
formatstrThe output format: number, date, or string.
group_byany | nullThe event attribute to group results by. Present only for multi-value aggregations.
skipintThe number of values to skip when returning grouped results.
max_valuesintThe maximum number of grouped values to return. 1 for scalar aggregations.
exposing_propertieslist[any]The direct exposing properties for this aggregate.

list_running_aggregates

Lists every running aggregate in a project. Running aggregates are like aggregates, but they're computed incrementally in real time as events arrive — not on demand. Running aggregate names can be used as variable bindings inside expressions.

Request parameters

NameTypeRequired?Description
project_idstrYesThe project ID returned by list_projects.

Response parameters

The tool returns a RunningAggregatesResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the request succeeded.
datalist[RunningAggregateSummary]The running aggregates defined in the project.
errorstr | nullError message if the request failed.

The RunningAggregateSummary object has the following fields:

FieldTypeDescription
idstrThe running aggregate's unique ID.
namestrThe running aggregate's display name.
archivedboolWhether the running aggregate has been archived.
tagslist[str]User-defined tags.
createdfloat | nullUnix timestamp of when the running aggregate was created.
created_by_display_namestrDisplay name of the creator.
editedfloat | nullUnix timestamp of the last edit.
edited_by_display_namestrDisplay name of the last editor.
is_global_objectboolWhether the running aggregate is shared across projects.
version_idstr | nullThe version ID of the current definition.
used_bylist[any]Segmentations, reports, funnels, or campaigns that reference this running aggregate.
all_exposing_propertieslist[any]Customer or event properties that surface this running aggregate's computed value.

get_running_aggregate

Returns the full definition of a single running aggregate: the event filter, the aggregation type, the date filter, the attribute, and whether the current (in-progress) window is included.

Request parameters

NameTypeRequired?Description
project_idstrYesThe project ID returned by list_projects.
running_aggregate_idstrYesThe running aggregate ID returned by list_running_aggregates.

Response parameters

The tool returns a RunningAggregateResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the request succeeded.
dataRunningAggregate | nullThe full running aggregate record.
errorstr | nullError message if the request failed.

The RunningAggregate object adds the following fields on top of the summary record:

FieldTypeDescription
typestrThe aggregation type, restricted to forward types: count, sum, avg, min, or max.
eventanyThe event filter: which events are aggregated.
attributeany | nullThe event attribute being aggregated. Required for sum, avg, min, and max.
date_filteranyThe date range applied to events before aggregating.
include_currentboolWhether to include the current (in-progress) aggregation window. When true, the value reflects events received so far in the current period.
formatstrThe output format: number, date, or string.
group_byany | nullThe event attribute to group results by.
max_valuesintThe maximum number of grouped values to return.

list_event_segmentations

Lists every event segmentation defined in a project. Event segmentations partition customers into buckets based on event behavior — for example, which product category was most purchased, or which campaign was last clicked. The response gives you the name, tags, archived flag, and the resources that reference each event segmentation. Segment definitions are not included here — use get_event_segmentation for those.

Event segmentations also appear under the Marketing → Customer filters and segments page.

Request parameters

NameTypeRequired?Description
project_idstrYesThe project ID returned by list_projects.

Response parameters

The tool returns an EventSegmentationsResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the request succeeded.
datalist[EventSegmentationSummary]The event segmentations defined in the project.
errorstr | nullError message if the request failed.

The EventSegmentationSummary object has the following fields:

FieldTypeDescription
idstrThe event segmentation's unique ID.
namestrThe event segmentation's display name.
event_typestr | nullThe event type the segmentation partitions customers by.
archivedboolWhether the event segmentation has been archived.
tagslist[str]User-defined tags.
createdfloat | nullUnix timestamp of when the event segmentation was created.
created_by_display_namestrDisplay name of the creator.
editedfloat | nullUnix timestamp of the last edit.
edited_by_display_namestrDisplay name of the last editor.
is_global_objectboolWhether the event segmentation is shared across projects.
version_idstr | nullThe version ID of the current definition.
used_bylist[any]Segmentations, reports, funnels, or campaigns that reference this event segmentation.
all_exposing_propertieslist[any]Properties that surface this event segmentation's computed value.

get_event_segmentation

Returns the full definition of a single event segmentation, including each segment's name and event attribute filter.

Event segmentations also appear under the Marketing → Customer filters and segments page.

Request parameters

NameTypeRequired?Description
project_idstrYesThe project ID returned by list_projects.
event_segmentation_idstrYesThe event segmentation ID returned by list_event_segmentations.

Response parameters

The tool returns an EventSegmentationResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the request succeeded.
dataEventSegmentation | nullThe full event segmentation record.
errorstr | nullError message if the request failed.

The EventSegmentation object adds the following fields on top of the summary record:

FieldTypeDescription
segmentslist[any]The segment definitions. Each segment has a name (the bucket label) and a filter (the event attribute conditions).
exposing_propertieslist[any]The direct exposing properties for this event segmentation.


© Bloomreach, Inc. All rights reserved.