Create streaks

Create a target group/milestone based on alternate currencies.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
❗️

This API is being phased out and will no longer be available for creating new streaks.

To create a new streak, use the Create a Loyalty Promotion API


A streak refers to a consecutive series of actions or engagements by a customer, based on which loyalty benefits are provided.

You can create a streak using the Create target group API.

👍

Note

For detailed information about our APIs and for hands-on testing, refer documentation in API overview and step-by-step guide on making your first API call in Make your first API call .

Example request

curl -L 'https://eu.api.capillarytech.com/v3/targetGroups' \
-H 'Content-Type: application/json' \
-H 'Cookie: _cfuvid=aidEostKQWmdskBHmh1pchvz2wSoA1O27JghNUFOpHw-1728306311172-0.0.1.1-604800000; _cfuvid=2ieM2eqBqFdNAAdfQMYR0zNvTd6WWmQxVVyU.OyFiEw-1728475108732-0.0.1.1-604800000; _cfuvid=2G0CzMo50ZKNrUvAmW0geVydLM0NOFZKEj.drnbKFus-1763644069670-0.0.1.1-604800000' \
-H 'Authorization: Basic ZmM2YjZlY2I2MmEy' \
-d '{
  "active": true,
  "description": "Target group number hundered and one",
  "name": "uatTargetGroup101",
  "trackingType": "DEFAULT",
  "targetEvaluationType": "FIXED_CALENDAR_WINDOW",
  "totalPeriods": 1,
  "frequencyType": "DAILY",
  "frequency": 1,
  "timeZoneName":"Asia/Kolkata",
  "recurringCycles": 1,
  "preferredTillId": 751552970000,
  "userCreated": false,
  "periods": [
    {
      "active": true,
      "description": "",
      "endDate": "2025-06-11T23:59:59.999Z",
      "periodStatus": "RUNNING",
      "refCode": "Cycle_1",
      "startDate": "2025-06-11T00:00:00.000Z"
    },
    {
      "active": true,
      "description": "",
      "endDate": "2025-05-11T23:59:59.999Z",
      "periodStatus": "NOT_STARTED",
      "refCode": "Cycle_2",
      "startDate": "2025-05-11T00:00:00.000Z"
    }
  ],
  "targets": [
    {
      "active": true,
      "description": "",
      "expression": true,
      "expressionJson": "{\"arity\":\"literal\",\"value\":\"true\",\"type\":\"boolean:primitive\"}",
      "filters": [],
      "name": "uat_target_group_101",
      "targetEntity": "EVENT",
      "targetType": "COUNT",
      "extendedFieldInfo": {
        "name": "points",
        "aggregateFunction": "SUM"
      },
      "defaultValues": [
        {
          "defaultValue": "1.00"
        },
        {
          "defaultValue": "1.00"
        }
      ]
    }
  ]
}'

Prerequisites

  • Authentication: Basic/OAuth authentication
  • Default access group

Resource information

URIv3/targetGroups
HTTP methodPOST
PaginationNA
Rate limitNA
Batch supportNA

Request body parameters

Parameter NameData TypeDescription
activeBooleanIndicates if the tracking is active or not.
descriptionStringA brief description of the target group.
name*StringThe name identifier for the target group.
The character limit for the name is 200 characters.
preferredTillIdNumberIdentifier for a preferred till.
timeZoneNameStringIANA time zone name for
the target group. This is a reference label to identify the timezone where the target group is created. There is no validation for this parameter; it is recommended to follow the IANA format.
trackingType*StringThe type of tracking the milestone is created for. Supported values:

- Default (single target tracking)
- Unified (tracking multiple targets as a unit)
- Streaks (continuous tracking across cycles)
- Capping (track and cap points over a period).
To create a streak, use STREAKS.
targetEvaluationTypeStringThe evaluation strategy for the targets. Supported values:
- FIXED_CALENDAR_WINDOW: Runs for a defined period from the start date
- CYCLIC_WINDOW: Starts after user's first transaction
- PERIOD_AGNOSTIC_WINDOW: Continues until the user meets the target.
totalPeriodsNumberThe total number of periods over which the tracking is evaluated.
frequencyTypeEnumThe frequency of each cycle. Supported values: Monthly, Quarterly, Half-yearly, Yearly, Weekly.
userCreatedBooleanIf true, a user-created target group is created. This allows customers to set and be rewarded for their own goals.
frequencyNumberThe frequency count, relevant to the frequencyType.
recurringCyclesNumberThe number of cycles for which the tracking recurs.
periodsObjectAn array of period objects containing details about individual tracking periods.
periods.activeBooleanIndicates if the period is active.
periods.descriptionStringA brief description of the period.
periods.endDateDate TimeThe end date and time of the period.
periods.periodStatusStringIndicates if the cycle of the milestone is active/inactive.
periods.refCodeStringA reference code for the period.
periods.startDateDate TimeThe start date and time of the period.
targetsObjectAn array of target objects outlining each target in the tracking.
targets.activeBooleanIndicates if the target is active.
targets.descriptionStringA brief description of the target.
targets.expressionStringA string representing the condition to meet the target.
targets.expressionJsonStringA JSON expression specifying the conditions required to achieve the target.
targets.filtersObjectDefines the entity to which the target expressions apply.
targets.filters.entityTypeEnumEntity to which expressions apply. Must satisfy the target condition. Supported values: STORE, ZONE, CONCEPT.
targets.filters.entityIdsArrayThe IDs of the entities to which the filter is applied.
targets.nameStringThe name identifier for the target.
targets.targetEntityEnumThe KPI being tracked. Supported values: TRANSACTION, LINEITEM, EVENT, REWARDS.
Use TRANSACTION or LINEITEM for transactional KPIs.
Use EVENT for behavioural/EMF events.
Use REWARDS for tracking reward-based KPIs like points.
targets.eventNameStringThe name of the behavioural event that triggers the target.
targets.targetType*EnumType of target. Supported values: QUANTITY, SALES, COUNT, VISIT, GROSS_SALES, REGULAR_POINTS, PROMOTIONAL_POINTS, ALL_POINTS, EXTENDED_FIELD, EVENT_ATTRIBUTE.
To use SUM for behavioural events, set to EVENT_ATTRIBUTE and define it using extendedFieldInfo.
extendedFieldInfoObjectDetails of the event attribute being tracked. Applicable when targetType is SUM.
extendedFieldInfo.name*StringEvent on which the sum calculation is performed. E.g., number of 'add to cart' events.
extendedFieldInfo.aggregateFunctionEnumAggregate function used to evaluate behavioural events. Supported: SUM. E.g., use SUM to track total cart value and validate against target.
defaultValuesObjectAn array of objects defining default values for the target.
defaultValues.defaultValueIntegerA default value used during target evaluation.
streaks*ObjectAn array containing streak information. Required when trackingType is STREAKS.
streaks.name*StringName of the streak.
streaks.targetCountOfSequence*IntegerNumber of times a user must meet the target to earn the reward.

Example response

{
    "data": {
        "id": 2771,
        "name": "uatTargetGroup101",
        "active": true,
        "preferredTillId": 751552970000,
        "periods": [
            {
                "id": 30160,
                "attribution": {
                    "createdOn": "2025-11-20T13:07:49.000+0000",
                    "createdOnISO": "2025-11-20T13:07:49Z",
                    "lastUpdatedOn": "2025-11-20T13:07:49.000+0000",
                    "lastUpdatedOnISO": "2025-11-20T13:07:49Z",
                    "lastUpdatedBy": {
                        "id": 75152721,
                        "code": "naman_doc",
                        "description": "",
                        "name": "naman",
                        "type": "TILL"
                    },
                    "createdBy": {
                        "id": 75152721,
                        "code": "naman_doc",
                        "description": "",
                        "name": "naman",
                        "type": "TILL"
                    }
                },
                "startDate": "2025-06-11",
                "endDate": "2025-06-11",
                "refCode": "Cycle_1",
                "periodStatus": "ENDED",
                "targetGroupId": 2771,
                "description": "",
                "active": true
            },
            {
                "id": 30161,
                "attribution": {
                    "createdOn": "2025-11-20T13:07:49.000+0000",
                    "createdOnISO": "2025-11-20T13:07:49Z",
                    "lastUpdatedOn": "2025-11-20T13:07:49.000+0000",
                    "lastUpdatedOnISO": "2025-11-20T13:07:49Z",
                    "lastUpdatedBy": {
                        "id": 75152721,
                        "code": "naman_doc",
                        "description": "",
                        "name": "naman",
                        "type": "TILL"
                    },
                    "createdBy": {
                        "id": 75152721,
                        "code": "naman_doc",
                        "description": "",
                        "name": "naman",
                        "type": "TILL"
                    }
                },
                "startDate": "2025-05-11",
                "endDate": "2025-05-11",
                "refCode": "Cycle_2",
                "periodStatus": "ENDED",
                "targetGroupId": 2771,
                "description": "",
                "active": true
            }
        ],
        "totalPeriods": 1,
        "description": "UAT target group number hundered and one",
        "targetEvaluationType": "FIXED_CALENDAR_WINDOW",
        "recurringCycles": 1,
        "frequency": 1,
        "targetCycleStartDate": "2025-05-11T00:00:00.000Z",
        "targetCycleEndDate": "2025-06-11T23:59:59.000Z",
        "targetCycleStartDateISO": "2025-05-11T00:00:00Z",
        "targetCycleEndDateISO": "2025-06-11T23:59:59Z",
        "frequencyType": "DAILY",
        "trackingType": "DEFAULT",
        "targets": [
            {
                "id": 3017,
                "attribution": {
                    "createdOn": "2025-11-20T13:07:49.173+0000",
                    "createdOnISO": "2025-11-20T13:07:49Z",
                    "lastUpdatedOn": "2025-11-20T13:07:49.173+0000",
                    "lastUpdatedOnISO": "2025-11-20T13:07:49Z",
                    "lastUpdatedBy": {
                        "id": 75152721,
                        "code": "naman_doc",
                        "description": "",
                        "name": "naman",
                        "type": "TILL"
                    },
                    "createdBy": {
                        "id": 75152721,
                        "code": "naman_doc",
                        "description": "",
                        "name": "naman",
                        "type": "TILL"
                    }
                },
                "name": "uat_target_group_101",
                "emfRuleSetId": 126455464,
                "targetType": "COUNT",
                "targetEntity": "EVENT",
                "eventName": "TransactionAdd",
                "targetGroupId": 2771,
                "description": "",
                "active": true,
                "expression": "true",
                "expressionJson": "{\"arity\":\"literal\",\"value\":\"true\",\"type\":\"boolean:primitive\"}",
                "filters": [],
                "enrolmentMethod": "IMPORT",
                "defaultValues": [
                    {
                        "id": 127067,
                        "periodId": 30160,
                        "defaultValue": 1.000
                    },
                    {
                        "id": 127068,
                        "periodId": 30161,
                        "defaultValue": 1.000
                    }
                ],
                "targetPeriodDefaultValuesMap": {
                    "30160": {
                        "id": 127067,
                        "periodId": 30160,
                        "defaultValue": 1.000
                    },
                    "30161": {
                        "id": 127068,
                        "periodId": 30161,
                        "defaultValue": 1.000
                    }
                },
                "extendedFieldInfo": {
                    "name": "points",
                    "aggregateFunction": "SUM"
                }
            }
        ],
        "leaderboardEnabled": false,
        "userCreated": false,
        "timeZoneName": "Asia/Kolkata"
    },
    "errors": null,
    "warnings": null
}

Response parameters

FieldDatatypeDescription
objectobjectRoot response object.
.dataobjectTarget group details.
..idintegerUnique identifier for the group.
..namestringName of the group.
..activebooleanIndicates if the group is active.
..preferredTillIdintegerPreferred till ID, indicating no specific preference with 0.
..periodsarray of objectsList of periods specified for the group.
...idintegerUnique identifier for each period.
...attributionobjectAudit information for each period.
....createdOnstring (date-time)

Creation date and time of the streak period in ISO 8601 extended format.

Note: This field will be deprecated in the future and is being replaced by createdOnISO.

....createdOnISOstring (date-time)

Indicates the creation date and time of the streak period in ISO 8601 format, returned in the server's time zone.

EU server example
2025-12-16T14:30:45Z → 16 December 2025, 14:30:45 (UTC)

India server example
2025-12-16T14:30:45+05:30 → 16 December 2025, 14:30:45 (IST)

Note: The response time zone always matches the server time zone, regardless of the time zone offset in the request.

....lastUpdatedOnstring (date-time)

Date and time when the streak period was last updated in ISO 8601 extended format.

Note: This field will be deprecated in the future and is being replaced by lastUpdatedOnISO.

....lastUpdatedOnISOstring (date-time)

Indicates the last updated date and time of the streak period in ISO 8601 format, returned in the server's time zone.

EU server example
2025-12-16T14:30:45Z → 16 December 2025, 14:30:45 (UTC)

India server example
2025-12-16T14:30:45+05:30 → 16 December 2025, 14:30:45 (IST)

Note: The response time zone always matches the server time zone, regardless of the time zone offset in the request.

....lastUpdatedByobjectUser who last updated the period.
.....idintegerUnique identifier of the user who last updated the period.
.....codestringCode of the user who last updated the period.
.....descriptionstringDescription of the user who last updated the period.
.....namestringName of the user who last updated the period.
.....typestringType of updater, e.g., "TILL".
....createdByobjectUser who created the period.
.....idintegerUnique identifier of the user who created the period.
.....codestringCode of the user who created the period.
.....descriptionstringDescription of the user who created the period.
.....namestringName of the user who created the period.
.....typestringType of creator, e.g., "TILL".
...startDatestring (date)Start date for each period.
...endDatestring (date)End date for each period.
...refCodestringReference code for each period.
...periodStatusstringStatus of each period, e.g., "RUNNING", "NOT_STARTED", "ENDED".
...targetGroupIdintegerIdentifier linking each period to a target group.
...descriptionstringDescription of each period.
...activebooleanIndicates if each period is active.
..totalPeriodsintegerTotal number of periods specified.
..descriptionstringDescription of the group.
..targetEvaluationTypestringType of target evaluation, e.g., "FIXED_CALENDAR_WINDOW".
..recurringCyclesintegerNumber of recurring cycles specified (if applicable).
..frequencyintegerFrequency value set for the setting (if applicable).
..targetCycleStartDatestring (date-time)Start date and time for the target cycle.
Note: This field will be deprecated in the future and is being replaced by targetCycleStartDateISO.
..targetCycleEndDatestring (date-time)End date and time for the target cycle (if applicable).
Note: This field will be deprecated in the future and is being replaced by targetCycleEndDateISO.
..targetCycleStartDateISOstring (date-time)

Indicates the start date and time of the streak cycle in ISO 8601 format, returned in the server's time zone.

EU server example
2025-12-16T14:30:45Z → 16 December 2025, 14:30:45 (UTC)

India server example
2025-12-16T14:30:45+05:30 → 16 December 2025, 14:30:45 (IST)

Note: The response time zone always matches the server time zone, regardless of the time zone offset in the request.

..targetCycleEndDateISOstring (date-time)

Indicates the end date and time of the streak cycle in ISO 8601 format, returned in the server's time zone.

EU server example
2025-12-16T14:30:45Z → 16 December 2025, 14:30:45 (UTC)

India server example
2025-12-16T14:30:45+05:30 → 16 December 2025, 14:30:45 (IST)

Note: The response time zone always matches the server time zone, regardless of the time zone offset in the request.

..frequencyTypestringFrequency type, e.g., "CUSTOM", "DAILY" (if applicable).
..trackingTypestringType of tracking, e.g., "STREAKS", "DEFAULT" (if applicable).
..targetsarray of objectsList of targets configured for the group.
...idintegerUnique identifier for each target.
...attributionobjectAudit information for each target.
....createdOnstring (date-time)Creation date and time of the target in ISO 8601 extended format.
Note: This field will be deprecated in the future and is being replaced by createdOnISO.
....createdOnISOstring (date-time)

Indicates the creation date and time of the target in ISO 8601 format, returned in the server's time zone.

EU server example
2025-12-16T14:30:45Z → 16 December 2025, 14:30:45 (UTC)

India server example
2025-12-16T14:30:45+05:30 → 16 December 2025, 14:30:45 (IST)

Note: The response time zone always matches the server time zone, regardless of the time zone offset in the request.

....lastUpdatedOnstring (date-time)Date and time when the target was last updated in ISO 8601 extended format.
Note: This field will be deprecated in the future and is being replaced by lastUpdatedOnISO.
....lastUpdatedOnISOstring (date-time)

Indicates the last updated date and time of the target in ISO 8601 format, returned in the server's time zone.

EU server example
2025-12-16T14:30:45Z → 16 December 2025, 14:30:45 (UTC)

India server example
2025-12-16T14:30:45+05:30 → 16 December 2025, 14:30:45 (IST)

Note: The response time zone always matches the server time zone, regardless of the time zone offset in the request.

....lastUpdatedByobjectUser who last updated the target.
.....idintegerUnique identifier of the user who last updated the target.
.....codestringCode of the user who last updated the target.
.....descriptionstringDescription of the user who last updated the target.
.....namestringName of the user who last updated the target.
.....typestringType of updater, e.g., "TILL".
....createdByobjectUser who created the target.
.....idintegerUnique identifier of the user who created the target.
.....codestringCode of the user who created the target.
.....descriptionstringDescription of the user who created the target.
.....namestringName of the user who created the target.
.....typestringType of creator, e.g., "TILL".
...namestringName of each target.
...emfRuleSetIdintegerIdentifier of the rule set used for evaluating the target.
...targetTypestringType of each target, e.g., "SALES", "COUNT".
...targetEntitystringType of entity targeted by each target, e.g., "EVENT".
...eventNamestringName of the event associated with each target.
...targetGroupIdintegerIdentifier linking each target to a target group.
...descriptionstringDescription of each target.
...activebooleanIndicates if each target is active.
...expressionstringExpression defining the criteria for each target.
...expressionJsonstring (JSON)Target expression in JSON format for each target.
...filtersarrayFilters applied to the target (if any).
...enrolmentMethodstringMethod of enrolment for each target.
...defaultValuesarray of objectsDefault values configured per period for the target.
....idintegerUnique identifier for each default value configuration.
....periodIdintegerIdentifier of the period the default value applies to.
....defaultValuefloatSpecifies a default value for the target criteria for each target.
...targetPeriodDefaultValuesMapobjectMap of period IDs to their default value configuration for the target.
....30160objectDefault value configuration for period ID 30160.
.....idintegerUnique identifier for the default value configuration for period ID 30160.
.....periodIdintegerPeriod ID (30160) that this default value configuration applies to.
.....defaultValuefloatDefault value configured for period ID 30160.
....30161objectDefault value configuration for period ID 30161.
.....idintegerUnique identifier for the default value configuration for period ID 30161.
.....periodIdintegerPeriod ID (30161) that this default value configuration applies to.
.....defaultValuefloatDefault value configured for period ID 30161.
...extendedFieldInfoobjectAdditional configuration for the aggregation field used by the target.
....namestringName of the extended field used for aggregation.
....aggregateFunctionstringAggregate function applied on the extended field, e.g., "SUM".
..leaderboardEnabledbooleanIndicates if leaderboard is enabled for this target group.
..userCreatedbooleanIndicates if the target group was created by a user.
..timeZoneNamestringIANA time zone name for
the target group. This is a reference label to identify the timezone where the target group is created. There is no validation for this parameter; it is recommended to follow the IANA format.
.errorsarray of objects or nullList of errors, if any.
.warningsarray of objects or nullList of warnings, if any.

API error codes

CodeDescription
310069Target group name already exists
300004Invalid input, check all values and ensure they are correct.
310008Length of Target rule name cannot exceed 200
310101At least one streak should be present for streaks target group
310106Streak count is mandatory

Body Params
boolean

Indicate if the target is active.

string

Brief description of the target. The character limit for the description is 255 characters and special characters are supported.

string
required

Name for the target. The name can be up to 200 characters long, supports special characters, and is case-insensitive.

int32

Identifier for the preferred or primary POS till for the target.

string
enum
required

Type of tracking the milestone is created for.

Allowed:
string
enum
required

Defines the type of time frame used for evaluating the target.

Allowed:
int32
required

Total number of period cycles for the target group.

string
enum
required

Frequency of each cycle in which the user has to achieve the target value

Allowed:
int32
required

Number of units corresponding to the selected frequencyType For example: If frequencyType is DAILY and frequency is 10, the cycle spans ten days.

int32
required

Total number of cycles defined for the target group. Once a cycle is complete, the target is reset for the new cycle. A maximum of 100 cycles can be defined for a target group.

string
required

End date and time of the period in ISO 8601 YYYY-MM-DDTHH:mm:ss.SSS format. Example: 2024-10-24T23:59:00.000.

string
enum

Indicate if the cycle of the Milestone is running or upcoming.

Allowed:
string
required

A reference code for the period.

string
required

Start date and time of the period in ISO 8601 YYYY-MM-DDTHH:mm:ss.SSS format. Example: 2024-10-24T00:00:00.000

boolean

Indicate if the target has an expression for evaluation.

string

A JSON expression that specifies the conditions required to achieve the target. The expression is generated in the backend.

string
enum
required
Defaults to ALTERNATE_CURRENCIES

KPI on which the target is tracked.

Allowed:
string
enum

Method of enrolment for the target.

Allowed:
string
enum
required

Type of target

Allowed:
float

Default value for the target.

string
required

Unique identifier of the alternate currency that is generated when creating an alternate currency.

int32
required

Unique ID of the loyalty program that includes the alternate currency.

Responses

Language
Credentials
Basic
base64
:
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json