Get active targets

This API gets active targets for an enrolled customer.

A targetrefers to a specific value or event that a user needs to achieve within a given period to receive certain benefits. A target that is currently active for a user is an active target.

👍

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.

Prerequisites

  • Basic authentication
  • Default access group

Resource information

URIv3/users/{userId}/enrolledTargets
HTTP MethodGET
PaginationNo
Batch supportNo
Rate limit informationNone

Endpoint example

https://eu.api.capillarytech.com/v3/users/19721/enrolledTargets

Request path parameters

FieldData
Type
Description
userIDIntegerThe customer ID of the user. For more information refer to the Get Customer ID API.

Request query parameters

https://{host}/v3/users/42381788/enrolledTargets?targetRuleIds=2577%2C2579&enrollmentType=IMPORT&trackingDate=1723193084000&includeOnlyUserCreated=true
FieldData TypeDescription
targetRuleIdsLongRule ID of the target. Target rules are essentially conditions or criteria that need to be met to achieve a specific target. You can add multiple rule IDs separated by commas.
trackingDateDateThe date when the target was created. Epoch time format
enrollmentTypeStringThe target enrollment type refers to the method used to enroll customers and set target values. Possible values are: TRANSACTION, IMPORT, and AUDIENCE_FILTER.

TRANSACTION: Enroll loyalty customers who transact during the target period.
IMPORT: Import a list of customers with custom target values.
includeOnlyUserCreatedBooleanInclude only the user-created targets. A user-created target is a promotion that rewards customers for achieving goals they set themselves.

Response parameters

{
    "data": [
        {
            "id": 2579,
            "attribution": {
                "createdOn": "2024-08-09T08:05:59.000+0000",
                "lastUpdatedOn": "2024-08-09T08:05:59.000+0000",
                "lastUpdatedBy": {
                    "id": 4,
                    "code": "First",
                    "description": null,
                    "name": "User",
                    "type": "ADMIN_USER"
                },
                "createdBy": {
                    "id": 4,
                    "code": "First",
                    "description": null,
                    "name": "User",
                    "type": "ADMIN_USER"
                }
            },
            "name": "Custom Enroll",
            "emfRuleSetId": 2030169,
            "emfUnrolledRulesetId": 2030168,
            "targetType": "GROSS_SALES",
            "targetEntity": "LINEITEM",
            "targetGroupId": 1898,
            "active": true,
            "expression": "true",
            "expressionJson": "\n{\n  \"arity\":\"literal\",\n  \"value\":\"true\",\n  \"type\":\"boolean:primitive\"\n}",
            "filters": [
                {
                    "entityType": "ZONE",
                    "entityIds": [
                        50674361,
                        50675571
                    ]
                }
            ],
            "enrolmentMethod": "IMPORT",
            "targetPeriodDefaultValuesMap": {}
        }
    ],
    "errors": null,
    "warnings": null
}
{
    "data": [
        {
            "id": 50,
            "attribution": {
                "createdOn": "2022-08-09T10:46:00.000+0000",
                "lastUpdatedOn": "2022-08-09T10:46:00.000+0000",
                "lastUpdatedBy": {
                    "id": 75015489,
                    "code": "1491395484_919600167818",
                    "description": "",
                    "name": "Achyuthanandan S",
                    "type": "ADMIN_USER"
                },
                "createdBy": {
                    "id": 75015489,
                    "code": "1491395484_919600167818",
                    "description": "",
                    "name": "Achyuthanandan S",
                    "type": "ADMIN_USER"
                }
            },
            "name": "Mentorship",
            "emfRuleSetId": 19029,
            "emfUnrolledRulesetId": 19028,
            "targetType": "SALES",
            "targetEntity": "LINEITEM",
            "targetGroupId": 40,
            "active": true,
            "expression": "currentTxn.basketAmountSumNonDiscounted>25",
            "expressionJson": "\n{\n  \"arity\":\"binary_operation\",\n  \"value\":\">\",\n  \"type\":\"boolean:primitive\",\n  \"operands\":[\n    {\n      \"arity\":\"object_dereference\",\n      \"type\":\"real:object:primitive\",\n      \"operands\":[\n        {\n          \"arity\":\"name\",\n          \"value\":\"currentTxn\",\n          \"type\":\"tx:object:primitive\"\n        },\n        {\n          \"arity\":\"name\",\n          \"value\":\"basketAmountSumNonDiscounted\",\n          \"type\":\"real:object:primitive\"\n        }\n      ]\n    },\n    {\n      \"arity\":\"literal\",\n      \"value\":\"25\",\n      \"type\":\"number:primitive\"\n    }\n  ]\n}",
            "filters": [
                {
                    "entityType": "STORE",
                    "entityIds": [
                        75027647,
                        75046489,
                        75027642,
                        75037225,
                        75051583,
                        75051591,
                        75036444,
                        75061222,
                        75027644,
                        75056850,
                        75056852,
                        75046525,
                        75052295,
                        75027631,
                        75046512,
                        75049264,
                        75049270,
                        75027635,
                        75027639,
                        75027637,
                        75043566,
                        75027640,
                        75049268,
                        75027632,
                        75055796,
                        75055797,
                        75061682,
                        75061683,
                        75061684,
                        75061685,
                        75052145,
                        75046491,
                        75027633,
                        75027634,
                        75027643,
                        75027641,
                        75027636,
                        75043257,
                        75043255,
                        75043253,
                        75049266,
                        75043181,
                        75043183,
                        75043185,
                        75043578,
                        75043576,
                        75056557,
                        75056559,
                        75045026,
                        75055010,
                        75055426,
                        75055427,
                        75049256,
                        75049272,
                        75049274,
                        75027648,
                        75027645,
                        75027646,
                        75027638,
                        75046490
                    ]
                }
            ],
            "enrolmentMethod": "TRANSACTION",
            "targetPeriodDefaultValuesMap": {}
        }
    ],
    "errors": null,
    "warnings": null

{
    "data": null,
    "errors": [
        {
            "code": 310011,
            "message": "Invalid userId"
        }
    ],
    "warnings": null
}
{
    "data": null,
    "errors": [
        {
            "code": 310130,
            "message": "Invalid enrollment type as input"
        }
    ],
    "warnings": null
}
FieldData
Type
Description
idIntegerUnique identifier for the target
AttributionObjectAttributes of the target.
- createdOnStringLast update date and time for the target. ISO 8601 format.
-lastUpdatedOnStringLast update date and time for the target. ISO 8601 format.
- lastUpdatedByObjectDetails on the latest updates of the target
-- idIntegerID of the last user who updated the target.
-- descriptionStringDescription related information of the last user who updated the target.
-- nameStringName of the last user who updated the target.
-- type StringType of the last user who updated the target.
Standard User: Limited access to their own profile; cannot manage users/permissions; permissions must be assigned by an Org Owner or Admin.
Admin User: Can manage Standard Users and permissions, with additional admin abilities beyond a Standard User.
Org Owner: Full authority over the organization, managing all users/permissions, with access to all modules; must be at least one per organization.
-createdByObjectDetails on the creation of the target.
-- idIntegerID of the user who created the target.`
-- descriptionStringDescription related information of the user who created the target.
-- nameString Name of the user who created the target.
-- typeStringType of the user who created the target.
Standard User: Limited access to their own profile; cannot manage users/permissions; permissions must be assigned by an Org Owner or Admin.
Admin User: Can manage Standard Users and permissions, with additional admin abilities beyond a Standard User.
Org Owner: Full authority over the organization, managing all users/permissions, with access to all modules; must be at least one per organization.
nameStringName of the target
emfRuleSetIdIntegerID of the rule set associated with the The Event Management Framework (EMF) This refers to various customer-level events within loyalty workflows, such as return transactions and points redemptions.
targetTypeStringType of target.
COUNT: This type tracks the number of times a specific action or event occurs.
VISIT: This type tracks the number of visits or occurrences of a specific event.
SUM: This type is used when the target involves summing up values, such as the total amount spent or the total number of items added to a cart.
targetEntityStringType of target entity.
TRANSACTION and LINEITEM: transactional KPIs
EVENT: behavioral events and EMF events
To , use REWARDS: rewards-based metrics, such as points
targetGroupIdIntegerGroup ID of the target. Target groups are entities within which individual targets can be created.
activeBooleanIndicates whether the target is active or not.
expressionStringThe expression associated with the target.
expressionJsonString (JSON)JSON representation of the expression.
filtersArrayList of filters applied to the target.
enrolmentMethodStringThe method of enrolment for the target. Supported values: TRANSACTION, IMPORT
targetPeriodDefaultValuesMapArrayLists the default target period and ID. A target period is a specific time frame within a target group during which certain goals or milestones are set to be achieved.
errorsObjectList of errors, if any.
warningsObjectList of warnings, if any.

Error codes

CodeDescription
310011Invalid userId
310130Invalid enrollment type as input
Language
Authorization
Basic
base64
:
URL
Click Try It! to start a request and see the response here!