Skip to content

Loyalty campaigns ​

A campaign defines actions a customer can complete to earn rewards. Public variants show campaign details; customer variants can include personal progress and eligibility.

Access labels such as Origin + Brand key + Customer are defined in Headers and access. Each endpoint ends in a Try it console; set the host and keys once in its Settings tab or on the overview.

Get all loyalty campaigns ​

MethodURL pathRequired access
GET/api/v1/brand/loyalty/campaignsOrigin + Brand key

Request fields:

FieldTypeRequiredRules / meaning
queryobjectoptional—
query.level_idnumberoptionalInteger
query.tagstringoptionalWhitespace trimmed; pattern(/^[a-zA-Z0-9_-]+(,[a-zA-Z0-9_-]+)*$/); Maximum (200)
query.typestringoptionalWhitespace trimmed; pattern(/^[a-zA-Z0-9_-]+(,[a-zA-Z0-9_-]+)*$/); Maximum (200)
query.activebooleanoptionalbool()

tag and type accept comma-separated identifiers made of letters, digits, underscores, or hyphens; maximum string length is 200.

Example:

bash
curl -X GET "$BASE_URL/api/v1/brand/loyalty/campaigns" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY"

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/loyalty_campaign_controller.ts:35 → getAllLoyaltyCampaigns; routes: routes/v1/loyalty_campaign_route.ts:293; service: _getAllLoyaltyCampaigns (app/v1/service/loyalty_campaign_service.ts:95).

Get all loyalty campaigns for user ​

MethodURL pathRequired access
GET/api/v1/user/loyalty/campaignsOrigin + Brand key + Customer

Request fields:

FieldTypeRequiredRules / meaning
queryobjectoptional—
query.tagstringoptionalWhitespace trimmed; pattern(/^[a-zA-Z0-9_-]+(,[a-zA-Z0-9_-]+)*$/); Maximum (200)
query.typestringoptionalWhitespace trimmed; pattern(/^[a-zA-Z0-9_-]+(,[a-zA-Z0-9_-]+)*$/); Maximum (200)
query.activebooleanoptionalbool()

tag and type accept comma-separated identifiers made of letters, digits, underscores, or hyphens; maximum string length is 200.

Example:

bash
curl -X GET "$BASE_URL/api/v1/user/loyalty/campaigns" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN"

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/loyalty_campaign_controller.ts:88 → getAllLoyaltyCampaignsForUser; routes: routes/v1/loyalty_campaign_route.ts:147; service: _getAllLoyaltyCampaigns (app/v1/service/loyalty_campaign_service.ts:95).

Get loyalty campaigns by tags ​

MethodURL pathRequired access
GET/api/v1/brand/loyalty/campaigns/tagOrigin + Brand key

Request fields: no body, query, or path fields are read by this controller. Context comes from the headers/middleware above.

Example:

bash
curl -X GET "$BASE_URL/api/v1/brand/loyalty/campaigns/tag" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY"

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/loyalty_campaign_controller.ts:141 → getLoyaltyCampaignsByTags; routes: routes/v1/loyalty_campaign_route.ts:158; service: _getLoyaltyCampaignsByTags (app/v1/service/loyalty_campaign_service.ts:509).

Get loyalty campaigns by tags with banner ​

MethodURL pathRequired access
GET/api/v1/brand/loyalty/campaigns/tags-with-bannerOrigin + Brand key

Request fields: no body, query, or path fields are read by this controller. Context comes from the headers/middleware above.

Example:

bash
curl -X GET "$BASE_URL/api/v1/brand/loyalty/campaigns/tags-with-banner" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY"

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/loyalty_campaign_controller.ts:191 → getLoyaltyCampaignsByTagsWithBanner; routes: routes/v1/loyalty_campaign_route.ts:178; service: _getLoyaltyCampaignsByTagsWithBanner (app/v1/service/loyalty_campaign_service.ts:731).

Get loyalty campaigns by tags with banner for user ​

MethodURL pathRequired access
GET/api/v1/brand/user/loyalty/campaigns/tags-with-bannerOrigin + Brand key + Customer

Request fields: no body, query, or path fields are read by this controller. Context comes from the headers/middleware above.

Example:

bash
curl -X GET "$BASE_URL/api/v1/brand/user/loyalty/campaigns/tags-with-banner" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN"

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/loyalty_campaign_controller.ts:217 → getLoyaltyCampaignsByTagsWithBannerForUser; routes: routes/v1/loyalty_campaign_route.ts:188; service: _getLoyaltyCampaignsByTagsWithBannerForUser (app/v1/service/loyalty_campaign_service.ts:838).

Get loyalty campaigns by category ​

MethodURL pathRequired access
GET/api/v1/brand/loyalty/campaigns/category/:categoryNameOrigin + Brand key

Request fields:

FieldTypeRequiredRules / meaning
pathobjectoptional—
path.categoryNamestringyes—

Example:

bash
curl -X GET "$BASE_URL/api/v1/brand/loyalty/campaigns/category/example" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY"

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/loyalty_campaign_controller.ts:248 → getLoyaltyCampaignsByCategory; routes: routes/v1/loyalty_campaign_route.ts:199; service: _getLoyaltyCampaignsByCategory (app/v1/service/loyalty_campaign_service.ts:1029).

Get almost completed campaigns ​

Find campaigns near completion for the event items in the request body.

MethodURL pathRequired access
POST/api/v1/brand/user/loyalty/campaigns/almost-completedOrigin + Brand key + Customer

Request fields:

FieldTypeRequiredRules / meaning
bodyobjectoptional—
body.event_itemone of the listed formsyes—
body.event_item (form 1)objectoptional—
body.event_item (form 1).event_typestringyesAllowed values ("order")
body.event_item (form 1).orderany JSON valueyes—
body.event_item (form 2)objectoptional—
body.event_item (form 2).event_typestringyesAllowed values ("scan-auth")
body.event_item (form 2).productany JSON valueyes—
body.event_item (form 3)objectoptional—
body.event_item (form 3).event_typestringyesAllowed values ("collectible_id")
body.event_item (form 3).collectibleobjectyes—
body.event_item (form 3).collectible.collectible_idnumberyes—
body.event_item (form 4)objectoptional—
body.event_item (form 4).event_typestringyesAllowed values ("user_update")
body.event_item (form 4).userobjectyes—
body.event_item (form 4).user.firstNamestringoptional—
body.event_item (form 4).user.dateOfBirthstringoptional—
body.event_item (form 4).user.phoneNumberstringoptionalreplace(/\D/g , ""); Whitespace trimmed
body.event_item (form 4).user.emailstringoptionalEmail address; Whitespace trimmed; Converted to lowercase
body.event_item (form 5)objectoptional—
body.event_item (form 5).event_typestringyesAllowed values ("user_login")
body.event_item (form 5).userobjectyes—
body.event_item (form 5).user.modestringoptional—
body.event_item (form 5).user.sourcestringoptional—
body.event_item (form 5).user.mediumstringoptional—

Example:

bash
curl -X POST "$BASE_URL/api/v1/brand/user/loyalty/campaigns/almost-completed" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-raw '{"event_item":{"event_type":"order","order":"example"}}'

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/loyalty_campaign_controller.ts:497 → getAlmostCompletedCampaigns; routes: routes/v1/loyalty_campaign_route.ts:209; service: _getAlmostCompletedCampaigns (app/v1/service/loyalty_campaign_service.ts:2221).

Get user claimed discount rewards ​

MethodURL pathRequired access
GET/api/v1/brand/user/loyalty/campaigns/rewards/claimedOrigin + Brand key + Customer

Request fields: no body, query, or path fields are read by this controller. Context comes from the headers/middleware above.

Example:

bash
curl -X GET "$BASE_URL/api/v1/brand/user/loyalty/campaigns/rewards/claimed" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN"

Response: JSON with success: true and result containing the operation’s service data. Result fields/details: redeemed, unredeemed.

Source: app/v1/controller/loyalty_campaign_controller.ts:475 → getUserClaimedDiscountRewards; routes: routes/v1/loyalty_campaign_route.ts:93; service: _getUserClaimedDiscountRewards (app/v1/service/loyalty_campaign_service.ts:1196).

Get loyalty campaign by ID ​

MethodURL pathRequired access
GET/api/v1/brand/loyalty/campaigns/:idOrigin + Brand key

Request fields:

FieldTypeRequiredRules / meaning
pathobjectoptional—
path.idnumberyesInteger

Example:

bash
curl -X GET "$BASE_URL/api/v1/brand/loyalty/campaigns/1" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY"

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/loyalty_campaign_controller.ts:282 → getLoyaltyCampaignById; routes: routes/v1/loyalty_campaign_route.ts:219; service: _getLoyaltyCampaignById (app/v1/service/loyalty_campaign_service.ts:234).

Get loyalty campaign by ID for user ​

MethodURL pathRequired access
GET/api/v1/brand/user/loyalty/campaigns/:idOrigin + Brand key + Customer

Request fields:

FieldTypeRequiredRules / meaning
pathobjectoptional—
path.idnumberyesInteger

Example:

bash
curl -X GET "$BASE_URL/api/v1/brand/user/loyalty/campaigns/1" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN"

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/loyalty_campaign_controller.ts:312 → getLoyaltyCampaignByIdForUser; routes: routes/v1/loyalty_campaign_route.ts:239; service: _getLoyaltyCampaignByIdForUser (app/v1/service/loyalty_campaign_service.ts:297).

Get campaigns for collectible for user ​

MethodURL pathRequired access
GET/api/v1/brand/user/loyalty/collectible/:collectible_id/campaignOrigin + Brand key + Customer

Request fields:

FieldTypeRequiredRules / meaning
pathobjectoptional—
path.collectible_idnumberyesInteger

Example:

bash
curl -X GET "$BASE_URL/api/v1/brand/user/loyalty/collectible/1/campaign" \
  -H "Origin: $ORIGIN" \
  -H "api-key: $API_KEY" \
  -H "Authorization: Bearer $CUSTOMER_TOKEN"

Response: JSON with success: true and result containing the operation’s service data.

Source: app/v1/controller/loyalty_campaign_controller.ts:406 → getCampaignsForCollectibleForUser; routes: routes/v1/loyalty_campaign_route.ts:125; service: _getCampaignsForCollectibleForUser (app/v1/service/loyalty_campaign_service.ts:1877).

Lifecycle ​

A customer's progress in a campaign is one row with two arrays indexed by step: allowed[i], which the progress engine raises as events arrive, and claimed[i], which a claim raises. A step's state follows from them:

  • Locked — progress has not reached the step: User cannot redeem the reward. A non-linear campaign unlocks steps by its own rule rather than in order.
  • Ready — allowed[i] is above claimed[i].
  • Claimed — on a linear campaign, a second claim is refused with Reward already claimed once claimed[i] catches up with allowed[i]. product campaigns skip that check.
  • Periodic campaigns reset every step to zero once the whole cycle is allowed and claimed.

A claim of a promotion reward creates the customer's discount and returns its discountCode; a reward with a cost deducts points. The claim endpoint is on Points, levels and rewards, the progress algorithm in campaign progress tracking, and the journey in the earn-and-spend web flow.

Batch platform, Shopify app and API documentation