Skip to main content

Overview

Summary definitions control how raw interaction events are aggregated into daily/weekly/monthly buckets. Each definition specifies which dimensions to group by and which time windows to maintain.

List Summary Definitions

GET /api/v1/summary-definitions
Returns all summary definitions for the current tenant, ordered by system definitions first, then alphabetically.

Response

[
  {
    "id": "sd_001",
    "tenantId": "tenant_001",
    "name": "Offer Interactions",
    "description": "Track impressions and conversions by offer and channel",
    "dimensions": ["offer_id", "channel_id", "direction", "outcome_key"],
    "aggregates": ["count", "sum_value"],
    "windows": ["1d", "7d", "30d"],
    "status": "active",
    "isSystem": true,
    "createdAt": "2026-03-20T10:00:00.000Z",
    "updatedAt": "2026-03-20T10:00:00.000Z"
  }
]

Create Summary Definition

POST /api/v1/summary-definitions

Request Body

FieldTypeRequiredDescription
namestringYesUnique name for the definition
descriptionstringNoHuman-readable description (defaults to "")
dimensionsstring[]NoGrouping dimensions (see allowed values below)
aggregatesstring[]NoAggregation functions (see allowed values below)
windowsstring[]NoTime windows to maintain (see allowed values below)
statusstringNoactive (default) or inactive

Allowed Dimensions

DimensionDescription
offer_idGroup by offer
creative_idGroup by creative/treatment
category_idGroup by business category
sub_category_idGroup by sub-category
channel_idGroup by delivery channel
placement_typeGroup by placement type
directionGroup by inbound/outbound direction
outcome_keyGroup by outcome type key

Allowed Aggregates

AggregateDescription
countCount of interactions
sum_valueSum of interaction values
last_contactTimestamp of last contact
distinct_offersCount of distinct offers

Allowed Windows

WindowDescription
1dDaily buckets
7dWeekly buckets
14dBi-weekly buckets
30dMonthly buckets
90dQuarterly buckets

Example

{
  "name": "Channel Performance Tracker",
  "description": "Track offer performance per channel with daily and weekly rollups",
  "dimensions": ["offer_id", "channel_id"],
  "aggregates": ["count", "sum_value"],
  "windows": ["1d", "7d"],
  "status": "active"
}

Response 201

Returns the created summary definition with id, isSystem: false, and timestamps.

Error codes

CodeReason
400Missing name, invalid dimensions/aggregates/windows, or duplicate name.

Update Summary Definition

PUT /api/v1/summary-definitions

Request Body

FieldTypeRequiredDescription
idstringYesSummary definition ID
namestringNoUpdated name
descriptionstringNoUpdated description
dimensionsstring[]NoUpdated dimensions (cannot change on system definitions)
aggregatesstring[]NoUpdated aggregates
windowsstring[]NoUpdated windows
statusstringNoactive or inactive
System summary definitions (created automatically during tenant setup) cannot have their dimensions changed. Attempting to change them returns a 400 error. You can update the name, description, aggregates, windows, and status.

Response 200

Returns the updated summary definition.

Error codes

CodeReason
400Missing id, invalid dimensions/aggregates/windows, duplicate name, or attempting to change system definition dimensions.
404Summary definition not found.

Delete Summary Definition

DELETE /api/v1/summary-definitions?id={id}
Deletes a summary definition. System definitions cannot be deleted.

Query Parameters

ParameterTypeRequiredDescription
idstringYesSummary definition ID to delete

Response

{ "deleted": true }

Error codes

CodeReason
400Missing id, or attempting to delete a system definition.
404Summary definition not found.
Deleting a summary definition stops new aggregation for that shape. Existing aggregated data is retained until the retention policy purges it.

Role requirements

MethodMinimum role
GETviewer
POSTadmin
PUTadmin
DELETEadmin

System definitions

Each tenant receives one system summary definition automatically during setup. System definitions:
  • Cannot have their dimensions changed (the API returns 400 if you try).
  • Cannot be deleted (the API returns 400).
  • Can have their name, description, aggregates, windows, and status updated normally.
  • Are listed first in GET responses (ordered by isSystem descending, then alphabetically by name).