> For the complete documentation index, see [llms.txt](https://help.openloyalty.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.openloyalty.io/api-reference/campaign.md).

# Campaign

These endpoints will allow you to easily manage campaigns.

## Get the campaign’s details

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br>\
> This method returns detailed information about a specific Campaign.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"campaign":{"name":"campaign","in":"path","description":"Campaign ID","required":true,"schema":{"type":"string","format":"uuid"}}},"schemas":{"CampaignResponse":{"description":"Campaign","properties":{"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string","enum":["direct","referral"]},"trigger":{"type":"string","enum":["transaction","return_transaction","custom_event","internal_event","time","achievement","custom_event_unique_code"]},"campaignId":{"type":"string","format":"uuid"},"activity":{"properties":{"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"}},"type":"object"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"displayOrder":{"type":"number"},"rules":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"conditions":{"type":"array","items":{"oneOf":[{"title":"Condition","properties":{"operator":{"type":"string"},"data":{"type":"array","items":{"type":"string"}},"attribute":{"type":"string"}},"type":"object"},{"$ref":"#/components/schemas/NewCondition"}]}},"effects":{"type":"array","items":{"properties":{"effect":{"type":"string"},"pointsRule":{"type":"string"}},"type":"object"}}},"type":"object"}},"transactionItemsFilters":{"type":"array","items":{"$ref":"#/components/schemas/TransactionItemsFilters"}},"limits":{"$ref":"#/components/schemas/Limit"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslationsResponse"},"limitUsages":{"properties":{"points":{"description":"These fields are not updated immediately after the status changes.","properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer","deprecated":true}},"type":"object"}},"type":"object"}},"type":"object"},"visibility":{"$ref":"#/components/schemas/Visibility"},"customFields":{"type":"object","nullable":true,"additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object"},"NewCondition":{"title":"New condition","required":["value","condition"],"properties":{"value":{"required":["field"],"properties":{"field":{"type":"string","enum":["customer.email","customer.wallets","referrer.wallets","customer.badges","referrer.badges","transaction.items","challenge.trigger","challenge.completions","challenge.milestoneProgresses"]},"params":{"description":"The `wallet` object applies only to the `customer.wallets` and `referrer.wallets` fields. The `walletTypeCode` field is used to precisely specify which wallet the condition should apply to. The `field` property defines which wallet field is used to retrieve the value for the condition.","type":"object","oneOf":[{"title":"wallet","required":["walletTypeCode","field"],"properties":{"walletTypeCode":{"type":"string"},"field":{"type":"string","enum":["activeUnits","spentUnits","earnedUnits","lockedUnits","blockUnits","expiredUnits"]}},"type":"object","additionalProperties":false},{"title":"badge","required":["badgeTypeId"],"properties":{"badgeTypeId":{"type":"string","format":"uuid"}},"type":"object","additionalProperties":false},{"title":"milestoneByRelationId","required":["milestoneRelationId"],"properties":{"milestoneRelationId":{"type":"string"}},"type":"object","additionalProperties":false},{"title":"milestoneById","required":["milestoneId"],"properties":{"milestoneId":{"type":"string","format":"uuid"}},"type":"object","additionalProperties":false}]},"filterCode":{"description":"In this field you can specify which transaction items filters you want to use in condition","type":"string"},"aggregation":{"description":"Available only for transaction.items","required":["type"],"properties":{"type":{"type":"string","enum":["sum","count"]},"field":{"type":"string"}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"condition":{"$ref":"#/components/schemas/Condition"}},"type":"object"},"Condition":{"required":["operator","value"],"properties":{"operator":{"type":"string","enum":["eq","neq","between","not_between","starts_with","ends_with","match","not_match","gt","gte","lt","lte","is_after","is_before","in","not_in","one_of","not_one_of","in_value_group","not_in_value_group","one_of_value_group","not_one_of_value_group"]},"value":{"oneOf":[{"description":"For operators `eq`, `neq`, `starts_with`, `ends_with`, `match`, `not_match` the value can be a string. For `match` and `not_match`, the string must be a valid regular expression.","type":"string"},{"description":"For operators `eq`, `neq`, `gt`, `gte`, `lt`, `lte` , the value can be a number.","type":"number"},{"description":"For operators `eq`, `neq`, the value can be a bool.","type":"boolean"},{"title":"datetime","description":"For operators `eq`, `neq` `is_after`, `is_before`, the value can be a datetime.","type":"string","format":"datetime","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?Z$"},{"title":"array","type":"array","items":{"description":"For `in`, `not_in`, `one_of`, `not_one_of` operators, the values can be in array.","oneOf":[{"type":"number"},{"type":"string"},{"title":"custom attribute","properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}]}},{"title":"between","description":"For `between`, `not_between` operators, the value is an object with 'from' and 'to'.","required":["from","to"],"properties":{"from":{"oneOf":[{"type":"number"},{"title":"datetime","type":"string","format":"datetime"}]},"to":{"oneOf":[{"type":"number"},{"title":"datetime","type":"string","format":"datetime"}]}},"type":"object"},{"title":"group of values","required":["groupValuesIds"],"properties":{"groupValuesIds":{"description":"For `in_value_group`, `not_in_value_group` operators, the value is an object with `groupValuesIds` array.","type":"array","items":{"type":"string","format":"uuid"}}},"type":"object"},{"title":"one of group of values","description":"For `one_of_value_group`, `not_one_of_value_group` operators, the value is an object with labelKey and `groupValuesIds` array.","required":["groupValuesIds","labelKey"],"properties":{"labelKey":{"type":"string"},"groupValuesIds":{"type":"array","items":{"type":"string","format":"uuid"}}},"type":"object"}]}},"type":"object","additionalProperties":false},"TransactionItemsFilters":{"required":["code"],"properties":{"code":{"type":"string"},"name":{"type":"string"},"filters":{"type":"array","items":{"required":["value","condition"],"properties":{"value":{"required":["field"],"properties":{"field":{"type":"string","enum":["sku","name","qty","grossValue","category","maker","labels"]}},"type":"object","additionalProperties":false},"condition":{"$ref":"#/components/schemas/Condition"}},"type":"object","additionalProperties":false}}},"type":"object","additionalProperties":false},"Limit":{"properties":{"points":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"},"pointsPerMember":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"},"executionsPerMember":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"}},"type":"object"},"CampaignTranslationsResponse":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"id":{"type":"integer"},"locale":{"type":"string"}},"type":"object"}},"Visibility":{"description":"Visibility settings for the campaign. Optional field.","properties":{"target":{"type":"string","enum":["segment","tier","none"]},"tiers":{"description":"Visibility settings for the campaign. Optional field.","type":"array","items":{"type":"string"}},"segments":{"description":"Visibility settings for the campaign. Optional field.","type":"array","items":{"type":"string"}}},"type":"object","additionalProperties":false},"MultiReferralCampaignResponse":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"trigger":{"type":"string"},"campaignId":{"type":"string","format":"uuid"},"activity":{"properties":{"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time","nullable":true}},"type":"object"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"displayOrder":{"type":"number"},"multiLevel":{"type":"number"},"rules":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"conditions":{"type":"array","items":{"properties":{"operator":{"type":"string"},"data":{"type":"array","items":{"type":"string"}},"attribute":{"type":"string"}},"type":"object"}},"effects":{"type":"array","items":{"properties":{"effect":{"type":"string"},"pointsRule":{"type":"string"}},"type":"object"}}},"type":"object"}},"limits":{"$ref":"#/components/schemas/Limit"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslationsResponse"},"limitUsages":{"properties":{"points":{"description":"These fields are not updated immediately after the status changes.","properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer","deprecated":true}},"type":"object"}},"type":"object"}},"type":"object"},"visibility":{"$ref":"#/components/schemas/Visibility"},"customFields":{"type":"object","nullable":true,"additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object"},"UniqueCodeCampaignResponse":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"trigger":{"type":"string"},"campaignId":{"type":"string","format":"uuid"},"activity":{"properties":{"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time","nullable":true}},"type":"object"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"displayOrder":{"type":"number"},"rules":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"conditions":{"type":"array","items":{"properties":{"operator":{"type":"string"},"data":{"type":"array","items":{"type":"string"}},"attribute":{"type":"string"}},"type":"object"}},"effects":{"type":"array","items":{"properties":{"effect":{"type":"string"},"pointsRule":{"type":"string"}},"type":"object"}}},"type":"object"}},"limits":{"$ref":"#/components/schemas/Limit"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslationsResponse"},"eventCodeAttribute":{"type":"string"},"codeGenerator":{"properties":{"characterSet":{"type":"string"},"length":{"type":"integer"},"prefix":{"type":"string"}},"type":"object"},"limitUsages":{"properties":{"points":{"description":"These fields are not updated immediately after the status changes.","properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer","deprecated":true}},"type":"object"}},"type":"object"}},"type":"object"},"visibility":{"$ref":"#/components/schemas/Visibility"},"customFields":{"type":"object","nullable":true,"additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object"},"TimeTriggerCampaignResponse":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"trigger":{"type":"string"},"campaignId":{"type":"string","format":"uuid"},"activity":{"properties":{"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time","nullable":true}},"type":"object"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"displayOrder":{"type":"number"},"multiLevel":{"type":"number"},"rules":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"conditions":{"type":"array","items":{"properties":{"operator":{"type":"string"},"data":{"type":"array","items":{"type":"string"}},"attribute":{"type":"string"}},"type":"object"}},"effects":{"type":"array","items":{"properties":{"effect":{"type":"string"},"pointsRule":{"type":"string"}},"type":"object"}}},"type":"object"}},"limits":{"$ref":"#/components/schemas/Limit"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslationsResponse"},"limitUsages":{"properties":{"points":{"description":"These fields are not updated immediately after the status changes.","properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer","deprecated":true}},"type":"object"}},"type":"object"}},"type":"object"},"visibility":{"$ref":"#/components/schemas/Visibility"},"audience":{"$ref":"#/components/schemas/Audience"},"triggerStrategy":{"$ref":"#/components/schemas/TriggerStrategy"},"customFields":{"type":"object","nullable":true,"additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object"},"Audience":{"description":"Audience settings for the campaign. Optional field.","properties":{"target":{"type":"string","enum":["segment","tier"]},"tiers":{"type":"array","items":{"type":"string"}},"segments":{"type":"array","items":{"type":"string"}}},"type":"object","nullable":true},"TriggerStrategy":{"properties":{"type":{"type":"string","enum":["birthday","registration_anniversary","daily","weekly","monthly"]},"executionSchedule":{"description":"Required for `weekly` and `monthly` type of campaign.","properties":{"dayOfWeek":{"description":"List of days when campaign should be executed. 0 for Sunday, 6 for Saturday.","type":"array","items":{"type":"integer","enum":[0,1,2,3,4,5,6]},"nullable":true},"dayOfMonth":{"description":"List of month days when campaign should be executed. 'L' for the last day of the month.","type":"array","items":{"oneOf":[{"type":"integer","enum":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},{"type":"string","enum":["L"]}]},"nullable":true}},"type":"object","nullable":true}},"type":"object"},"LeaderboardCampaignResponse":{"description":"Campaign","properties":{"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string","enum":["direct","referral"]},"trigger":{"type":"string","enum":["leaderboard"]},"campaignId":{"type":"string","format":"uuid"},"activity":{"properties":{"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"}},"type":"object"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"displayOrder":{"type":"number"},"rules":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"conditions":{"type":"array","items":{"oneOf":[{"title":"Condition","properties":{"operator":{"type":"string"},"data":{"type":"array","items":{"type":"string"}},"attribute":{"type":"string"}},"type":"object"},{"$ref":"#/components/schemas/NewCondition"}]}},"effects":{"type":"array","items":{"properties":{"effect":{"type":"string"},"pointsRule":{"type":"string"}},"type":"object"}}},"type":"object"}},"limits":{"$ref":"#/components/schemas/Limit"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslationsResponse"},"limitUsages":{"properties":{"points":{"description":"These fields are not updated immediately after the status changes.","properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer","deprecated":true}},"type":"object"}},"type":"object"}},"type":"object"},"visibility":{"$ref":"#/components/schemas/Visibility"},"leaderboard":{"$ref":"#/components/schemas/LeaderboardResponse"},"customFields":{"type":"object","nullable":true,"additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object"},"LeaderboardResponse":{"properties":{"metric":{"required":["type","walletTypeCode"],"properties":{"type":{"type":"string","enum":["earned_units_cumulative"]},"walletTypeCode":{"type":"string"}},"type":"object"},"cycles":{"required":["type"],"properties":{"type":{"type":"string","enum":["end_of_the_month"]},"code":{"type":"string"},"recalculatedAt":{"type":"string","format":"datetime"}},"type":"object"},"groupingField":{"description":"Present only for grouped leaderboards. `groupsCount` reflects the number of distinct group values in the running iteration (0 when no iteration is running). `groupsLimit` is the per-environment hard cap.\n","required":["type","key","groupsCount","groupsLimit"],"properties":{"type":{"type":"string","enum":["address_field","custom_attribute"]},"key":{"type":"string"},"groupsCount":{"type":"integer","minimum":0},"groupsLimit":{"type":"integer","minimum":1}},"type":"object"}},"type":"object"},"ChallengeCampaignResponse":{"description":"Challenge Campaign","properties":{"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string","enum":["direct","referral"]},"trigger":{"type":"string","enum":["challenge"]},"campaignId":{"type":"string","format":"uuid"},"activity":{"properties":{"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"}},"type":"object"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"displayOrder":{"type":"number"},"rules":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"conditions":{"type":"array","items":{"oneOf":[{"title":"Condition","properties":{"operator":{"type":"string"},"data":{"type":"array","items":{"type":"string"}},"attribute":{"type":"string"}},"type":"object"},{"$ref":"#/components/schemas/NewCondition"}]}},"effects":{"type":"array","items":{"properties":{"effect":{"type":"string"},"pointsRule":{"type":"string"}},"type":"object"}}},"type":"object"}},"limits":{"$ref":"#/components/schemas/Limit"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslationsResponse"},"limitUsages":{"properties":{"points":{"description":"These fields are not updated immediately after the status changes.","properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer"}},"type":"object"}},"type":"object"}},"type":"object"},"visibility":{"$ref":"#/components/schemas/Visibility"},"milestones":{"type":"array","items":{"$ref":"#/components/schemas/Milestone"}},"challengeAvailability":{"$ref":"#/components/schemas/AchievementActivity"},"challengeLimit":{"$ref":"#/components/schemas/ChallengeLimit"},"customFields":{"type":"object","nullable":true,"additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object"},"Milestone":{"properties":{"translations":{"properties":{"en":{"properties":{"name":{"type":"string"},"description":{"type":"string"}},"type":"object"}},"type":"object"},"milestoneId":{"type":"string"},"completeRule":{"$ref":"#/components/schemas/CompleteRule"},"aggregation":{"$ref":"#/components/schemas/Aggregation"},"uniqueReferee":{"type":"boolean"},"event":{"type":"string"},"trigger":{"type":"string"},"type":{"type":"string"},"conditions":{"type":"array","items":{"type":"object"}},"limit":{"$ref":"#/components/schemas/ChallengeLimit"}},"type":"object"},"CompleteRule":{"properties":{"periodGoal":{"oneOf":[{"type":"string"},{"type":"number"}]},"period":{"$ref":"#/components/schemas/Period"},"uniqueAttribute":{"type":"string"}},"type":"object"},"Period":{"properties":{"type":{"type":"string"},"consecutive":{"type":"integer"},"value":{"type":"integer"}},"type":"object"},"Aggregation":{"properties":{"type":{"type":"string"},"rule":{"type":"string"}},"type":"object"},"ChallengeLimit":{"properties":{"interval":{"$ref":"#/components/schemas/LimitInterval"},"value":{"type":"integer"}},"type":"object"},"LimitInterval":{"properties":{"type":{"type":"string"},"value":{"type":"integer"}},"type":"object"},"AchievementActivity":{"properties":{"data":{"oneOf":[{"type":"string"},{"properties":{"from":{"type":"string"},"to":{"type":"string"}},"type":"object"},{"type":"array","items":{"type":"string"}}]},"operator":{"type":"string"}},"type":"object"},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/campaign/{campaign}":{"get":{"tags":["Campaign"],"summary":"Get the campaign’s details","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\nThis method returns detailed information about a specific Campaign.\n","operationId":"campaignGet","parameters":[{"$ref":"#/components/parameters/storeCode"},{"$ref":"#/components/parameters/campaign"}],"responses":{"200":{"description":"Campaign details.","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/CampaignResponse"},{"$ref":"#/components/schemas/MultiReferralCampaignResponse"},{"$ref":"#/components/schemas/UniqueCodeCampaignResponse"},{"$ref":"#/components/schemas/TimeTriggerCampaignResponse"},{"$ref":"#/components/schemas/LeaderboardCampaignResponse"},{"$ref":"#/components/schemas/ChallengeCampaignResponse"}]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Update campaign’s configuration

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br>\
> This method allows changing the information about a specific Campaign.\<br>\<br>\
> \<strong>Custom-fields semantics on PUT:\</strong> \<ul>\
> &#x20; \<li>\<code>customFields\</code> omitted from the request body → existing custom-field\
> &#x20;   values on the campaign are \<strong>kept untouched\</strong> (no-op; no validation\
> &#x20;   runs).\</li>\
> &#x20; \<li>\<code>customFields: null\</code> → existing values are \<strong>kept untouched\</strong>\
> &#x20;   (treated identically to omitting the field).\</li>\
> &#x20; \<li>\<code>customFields: {}\</code> (explicit empty object) → all existing custom-field\
> &#x20;   values on the campaign are \<strong>cleared\</strong>. Required-field validation still\
> &#x20;   runs against the empty payload, so this fails with 400 if any active campaign\
> &#x20;   custom-field group contains a required field.\</li>\
> &#x20; \<li>\<code>customFields: { groupKey: { fieldKey: value, ... }, ... }\</code> →\
> &#x20;   \<strong>wholesale entity replace\</strong>. The campaign's entire custom-field state\
> &#x20;   is deleted first, then only the groups present in the payload are persisted.\
> &#x20;   Consequence: any group NOT listed in the payload is also wiped, even if it had\
> &#x20;   values before. Required-field validation runs against the payload as a whole.\</li>\
> \</ul> The feature flag \<code>CUSTOM\_FIELD\_CAMPAIGN\</code> must be enabled; when disabled the \<code>customFields\</code> key is silently ignored regardless of value.\<br>\<br>\
> For granular per-group or per-key updates that preserve other groups, use the bulk patch endpoint (\<code>PATCH /api/{storeCode}/custom-fields/campaign/{campaignId}\</code>).<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"campaign":{"name":"campaign","in":"path","description":"Campaign ID","required":true,"schema":{"type":"string","format":"uuid"}}},"schemas":{"AchievementCampaignRequestBody":{"title":"AchievementCampaign","required":["campaign"],"properties":{"campaign":{"required":["type","trigger","translations","activity","rules","achievementId"],"properties":{"triggerStrategy":{"$ref":"#/components/schemas/TriggerStrategy"},"visibility":{"$ref":"#/components/schemas/Visibility"},"audience":{"$ref":"#/components/schemas/Audience"},"rules":{"$ref":"#/components/schemas/Rule"},"limits":{"$ref":"#/components/schemas/Limit"},"type":{"type":"string","enum":["direct","referral"]},"trigger":{"type":"string"},"activity":{"required":["startsAt"],"properties":{"startsAt":{"type":"string"},"endsAt":{"type":"string","nullable":true}},"type":"object"},"displayOrder":{"type":"number"},"active":{"type":"boolean"},"labels":{"type":"array","items":{"required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslations"},"achievementId":{"type":"string","format":"uuid","deprecated":true},"customFields":{"type":"object","nullable":true,"description":"Custom-field values grouped by group key. PUT semantics: omitted or null → existing values kept (no-op); empty object {} → all values cleared (validation still runs); non-empty object → wholesale entity replace (every group not in the payload is also wiped). Requires the CUSTOM_FIELD_CAMPAIGN feature flag; when disabled the field is silently ignored. See the endpoint description for full semantics.","additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"TriggerStrategy":{"properties":{"type":{"type":"string","enum":["birthday","registration_anniversary","daily","weekly","monthly"]},"executionSchedule":{"description":"Required for `weekly` and `monthly` type of campaign.","properties":{"dayOfWeek":{"description":"List of days when campaign should be executed. 0 for Sunday, 6 for Saturday.","type":"array","items":{"type":"integer","enum":[0,1,2,3,4,5,6]},"nullable":true},"dayOfMonth":{"description":"List of month days when campaign should be executed. 'L' for the last day of the month.","type":"array","items":{"oneOf":[{"type":"integer","enum":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},{"type":"string","enum":["L"]}]},"nullable":true}},"type":"object","nullable":true}},"type":"object"},"Visibility":{"description":"Visibility settings for the campaign. Optional field.","properties":{"target":{"type":"string","enum":["segment","tier","none"]},"tiers":{"description":"Visibility settings for the campaign. Optional field.","type":"array","items":{"type":"string"}},"segments":{"description":"Visibility settings for the campaign. Optional field.","type":"array","items":{"type":"string"}}},"type":"object","additionalProperties":false},"Audience":{"description":"Audience settings for the campaign. Optional field.","properties":{"target":{"type":"string","enum":["segment","tier"]},"tiers":{"type":"array","items":{"type":"string"}},"segments":{"type":"array","items":{"type":"string"}}},"type":"object","nullable":true},"Rule":{"type":"array","items":{"required":["effects"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"target":{"description":"Allowed only when the campaign type is `referral`. Specifies which member the rule applies to: `self` (the referrer) or `referral` (the referred person).","type":"string","enum":["self","referrer"]},"effects":{"type":"array","items":{"required":["effect"],"properties":{"effect":{"type":"string","enum":["give_points","give_reward","deduct_unit","assign_member_custom_attribute","remove_member_custom_attribute","grant_badge","cancel_transaction_effects"]},"pointsRule":{"description":"Only allowed for `give_points` and `deduct_unit` effect"},"walletCode":{"description":"Only allowed for `give_points` and `deduct_unit` effect","type":"string"},"unitsLockRule":{"description":"The field allows you to set a custom pending for units given by campaign effects. Only allowed for `give_points` effect","required":["lockStrategy"],"properties":{"lockStrategy":{"type":"string","enum":["expression","from_wallet","no_pending"]},"expression":{"description":"This field is required for `lockStrategy = expression`","type":"string"}},"type":"object","additionalProperties":false},"unitsExpirationRule":{"description":"The field allows you to set a custom expiration for units given by campaign effects. Only allowed for `give_points` effect","required":["expirationStrategy"],"properties":{"expirationStrategy":{"type":"string","enum":["expression","from_wallet","never_expires"]},"expression":{"description":"This field is required for `lockStrategy = expression`","type":"string"}},"type":"object","additionalProperties":false},"rewardId":{"description":"Only allowed for `give_reward` effect","type":"string","format":"uuid"},"couponValueRule":{"description":"Only allowed for `give_reward` effect","type":"string"},"customAttributeKey":{"description":"Only allowed for `assign_member_custom_attribute` effect","type":"string"},"customAttributeValueRule":{"description":"Only allowed for `assign_member_custom_attribute` effect","type":"string"},"badgeSystemCode":{"description":"Only allowed for `grant_badge` effect","type":"string"}},"type":"object","additionalProperties":false}},"conditions":{"type":"array","items":{"oneOf":[{"title":"Condition","required":["operator","data"],"properties":{"attribute":{"type":"string"},"operator":{"type":"string","enum":["expression","is_equal","has_at_least_one_label","contains","not_contains","is_not_equal","is_not_one_of","is_one_of","matches_regex","is_greater","is_greater_or_equal","is_less","is_less_or_equal","ends_with","starts_with","is_after","is_before","is_between","is_day_of_week","is_month_of_year","is_not_between","is_day_of_month","is_time_between","is_one_of_group_values","is_not_one_of_group_values","not_contains_one_of","contains_one_of"]},"data":{}},"type":"object"},{"$ref":"#/components/schemas/NewCondition"}]}}},"type":"object"}},"NewCondition":{"title":"New condition","required":["value","condition"],"properties":{"value":{"required":["field"],"properties":{"field":{"type":"string","enum":["customer.email","customer.wallets","referrer.wallets","customer.badges","referrer.badges","transaction.items","challenge.trigger","challenge.completions","challenge.milestoneProgresses"]},"params":{"description":"The `wallet` object applies only to the `customer.wallets` and `referrer.wallets` fields. The `walletTypeCode` field is used to precisely specify which wallet the condition should apply to. The `field` property defines which wallet field is used to retrieve the value for the condition.","type":"object","oneOf":[{"title":"wallet","required":["walletTypeCode","field"],"properties":{"walletTypeCode":{"type":"string"},"field":{"type":"string","enum":["activeUnits","spentUnits","earnedUnits","lockedUnits","blockUnits","expiredUnits"]}},"type":"object","additionalProperties":false},{"title":"badge","required":["badgeTypeId"],"properties":{"badgeTypeId":{"type":"string","format":"uuid"}},"type":"object","additionalProperties":false},{"title":"milestoneByRelationId","required":["milestoneRelationId"],"properties":{"milestoneRelationId":{"type":"string"}},"type":"object","additionalProperties":false},{"title":"milestoneById","required":["milestoneId"],"properties":{"milestoneId":{"type":"string","format":"uuid"}},"type":"object","additionalProperties":false}]},"filterCode":{"description":"In this field you can specify which transaction items filters you want to use in condition","type":"string"},"aggregation":{"description":"Available only for transaction.items","required":["type"],"properties":{"type":{"type":"string","enum":["sum","count"]},"field":{"type":"string"}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"condition":{"$ref":"#/components/schemas/Condition"}},"type":"object"},"Condition":{"required":["operator","value"],"properties":{"operator":{"type":"string","enum":["eq","neq","between","not_between","starts_with","ends_with","match","not_match","gt","gte","lt","lte","is_after","is_before","in","not_in","one_of","not_one_of","in_value_group","not_in_value_group","one_of_value_group","not_one_of_value_group"]},"value":{"oneOf":[{"description":"For operators `eq`, `neq`, `starts_with`, `ends_with`, `match`, `not_match` the value can be a string. For `match` and `not_match`, the string must be a valid regular expression.","type":"string"},{"description":"For operators `eq`, `neq`, `gt`, `gte`, `lt`, `lte` , the value can be a number.","type":"number"},{"description":"For operators `eq`, `neq`, the value can be a bool.","type":"boolean"},{"title":"datetime","description":"For operators `eq`, `neq` `is_after`, `is_before`, the value can be a datetime.","type":"string","format":"datetime","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?Z$"},{"title":"array","type":"array","items":{"description":"For `in`, `not_in`, `one_of`, `not_one_of` operators, the values can be in array.","oneOf":[{"type":"number"},{"type":"string"},{"title":"custom attribute","properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}]}},{"title":"between","description":"For `between`, `not_between` operators, the value is an object with 'from' and 'to'.","required":["from","to"],"properties":{"from":{"oneOf":[{"type":"number"},{"title":"datetime","type":"string","format":"datetime"}]},"to":{"oneOf":[{"type":"number"},{"title":"datetime","type":"string","format":"datetime"}]}},"type":"object"},{"title":"group of values","required":["groupValuesIds"],"properties":{"groupValuesIds":{"description":"For `in_value_group`, `not_in_value_group` operators, the value is an object with `groupValuesIds` array.","type":"array","items":{"type":"string","format":"uuid"}}},"type":"object"},{"title":"one of group of values","description":"For `one_of_value_group`, `not_one_of_value_group` operators, the value is an object with labelKey and `groupValuesIds` array.","required":["groupValuesIds","labelKey"],"properties":{"labelKey":{"type":"string"},"groupValuesIds":{"type":"array","items":{"type":"string","format":"uuid"}}},"type":"object"}]}},"type":"object","additionalProperties":false},"Limit":{"properties":{"points":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"},"pointsPerMember":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"},"executionsPerMember":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"}},"type":"object"},"CampaignTranslations":{"description":"This field is used to save the name and description in the language of your choice","required":["en"],"properties":{"en":{"required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"}},"type":"object"},"pl":{"required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"}},"type":"object"}},"type":"object"},"PutUniqueCodeCampaignRequestBody":{"title":"RedemptionCampaign","required":["campaign"],"properties":{"campaign":{"required":["type","trigger","translations","activity","eventCodeAttribute","rules"],"properties":{"type":{"type":"string"},"trigger":{"type":"string"},"activity":{"required":["startsAt"],"properties":{"startsAt":{"type":"string"},"endsAt":{"type":"string","nullable":true}},"type":"object"},"displayOrder":{"type":"number"},"active":{"type":"boolean"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslations"},"rules":{"$ref":"#/components/schemas/Rule"},"limits":{"$ref":"#/components/schemas/Limit"},"visibility":{"$ref":"#/components/schemas/Visibility"},"audience":{"$ref":"#/components/schemas/Audience"},"event":{"type":"string"},"eventCodeAttribute":{"type":"string"},"codeGenerator":{"description":"Required for generated codes.","required":["characterSet","length"],"properties":{"characterSet":{"type":"string"},"length":{"type":"integer"},"prefix":{"type":"string"}},"type":"object","additionalProperties":false},"isExternalCodeSource":{"type":"boolean"},"customFields":{"type":"object","nullable":true,"description":"Custom-field values grouped by group key. PUT semantics: omitted or null → existing values kept (no-op); empty object {} → all values cleared (validation still runs); non-empty object → wholesale entity replace (every group not in the payload is also wiped). Requires the CUSTOM_FIELD_CAMPAIGN feature flag; when disabled the field is silently ignored. See the endpoint description for full semantics.","additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"CampaignRequestBody":{"title":"Campaign","required":["campaign"],"properties":{"campaign":{"required":["type","trigger","translations","activity","rules"],"properties":{"triggerStrategy":{"$ref":"#/components/schemas/TriggerStrategy"},"visibility":{"$ref":"#/components/schemas/Visibility"},"audience":{"$ref":"#/components/schemas/Audience"},"rules":{"$ref":"#/components/schemas/Rule"},"transactionItemsFilters":{"description":"Field that you can use to filter transaction items, which you can then use in the condition by providing the code, only allowed for transaction trigger","type":"array","items":{"$ref":"#/components/schemas/TransactionItemsFilters"}},"limits":{"$ref":"#/components/schemas/Limit"},"type":{"type":"string","enum":["direct","referral"]},"trigger":{"type":"string","enum":["transaction","return_transaction","custom_event","internal_event","time","achievement","custom_event_unique_code"]},"event":{"description":"Allowed only for campaign with trigger event","type":"string"},"activity":{"required":["startsAt"],"properties":{"startsAt":{"type":"string"},"endsAt":{"type":"string","nullable":true}},"type":"object"},"displayOrder":{"type":"number"},"active":{"type":"boolean"},"labels":{"type":"array","items":{"required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"memberFilter":{"description":"Only allowed for time trigger","properties":{"strategy":{}},"type":"object"},"translations":{"$ref":"#/components/schemas/CampaignTranslations"},"customFields":{"type":"object","nullable":true,"description":"Custom-field values grouped by group key. PUT semantics: omitted or null → existing values kept (no-op); empty object {} → all values cleared (validation still runs); non-empty object → wholesale entity replace (every group not in the payload is also wiped). Requires the CUSTOM_FIELD_CAMPAIGN feature flag; when disabled the field is silently ignored. See the endpoint description for full semantics.","additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"TransactionItemsFilters":{"required":["code"],"properties":{"code":{"type":"string"},"name":{"type":"string"},"filters":{"type":"array","items":{"required":["value","condition"],"properties":{"value":{"required":["field"],"properties":{"field":{"type":"string","enum":["sku","name","qty","grossValue","category","maker","labels"]}},"type":"object","additionalProperties":false},"condition":{"$ref":"#/components/schemas/Condition"}},"type":"object","additionalProperties":false}}},"type":"object","additionalProperties":false},"MultiReferralCampaignRequestBody":{"title":"MultiReferralCampaign","description":"When campaign is referral type, you can specify multi level","required":["campaign"],"properties":{"campaign":{"required":["multiLevel","type","trigger","translations","activity","rules"],"properties":{"triggerStrategy":{"$ref":"#/components/schemas/TriggerStrategy"},"visibility":{"$ref":"#/components/schemas/Visibility"},"audience":{"$ref":"#/components/schemas/Audience"},"rules":{"$ref":"#/components/schemas/Rule"},"transactionItemsFilters":{"description":"Field that you can use to filter transaction items, which you can then use in the condition by providing the code, only allowed for transaction trigger","type":"array","items":{"$ref":"#/components/schemas/TransactionItemsFilters"}},"limits":{"$ref":"#/components/schemas/Limit"},"type":{"type":"string","enum":["direct","referral"]},"multiLevel":{"type":"number"},"trigger":{"type":"string","enum":["transaction","return_transaction","custom_event","internal_event","time","achievement","custom_event_unique_code"]},"event":{"type":"string"},"activity":{"required":["startsAt"],"properties":{"startsAt":{"type":"string"},"endsAt":{"type":"string","nullable":true}},"type":"object"},"displayOrder":{"type":"number"},"active":{"type":"boolean"},"labels":{"type":"array","items":{"required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"memberFilter":{"description":"Only allowed for time trigger","properties":{"strategy":{}},"type":"object"},"translations":{"$ref":"#/components/schemas/CampaignTranslations"},"customFields":{"type":"object","nullable":true,"description":"Custom-field values grouped by group key. PUT semantics: omitted or null → existing values kept (no-op); empty object {} → all values cleared (validation still runs); non-empty object → wholesale entity replace (every group not in the payload is also wiped). Requires the CUSTOM_FIELD_CAMPAIGN feature flag; when disabled the field is silently ignored. See the endpoint description for full semantics.","additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"LeaderboardCampaignRequestBody":{"title":"LeaderboardCampaign","required":["campaign"],"properties":{"campaign":{"required":["type","trigger","translations","activity","leaderboard"],"properties":{"triggerStrategy":{"$ref":"#/components/schemas/TriggerStrategy"},"visibility":{"$ref":"#/components/schemas/Visibility"},"audience":{"$ref":"#/components/schemas/Audience"},"rules":{"$ref":"#/components/schemas/Rule"},"type":{"type":"string","enum":["direct","referral"]},"trigger":{"type":"string"},"activity":{"required":["startsAt"],"properties":{"startsAt":{"type":"string"},"endsAt":{"type":"string","nullable":true}},"type":"object"},"displayOrder":{"type":"number"},"active":{"type":"boolean"},"labels":{"type":"array","items":{"required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslations"},"leaderboard":{"$ref":"#/components/schemas/Leaderboard"},"customFields":{"type":"object","nullable":true,"description":"Custom-field values grouped by group key. PUT semantics: omitted or null → existing values kept (no-op); empty object {} → all values cleared (validation still runs); non-empty object → wholesale entity replace (every group not in the payload is also wiped). Requires the CUSTOM_FIELD_CAMPAIGN feature flag; when disabled the field is silently ignored. See the endpoint description for full semantics.","additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"Leaderboard":{"properties":{"metric":{"required":["type","walletTypeCode"],"properties":{"type":{"type":"string","enum":["earned_units_cumulative"]},"walletTypeCode":{"type":"string"}},"type":"object"},"cycles":{"description":"Optional cycle definition. Without `cycles` the leaderboard is timeless (a single open-ended iteration). Only one cycle is supported.\n","type":"array","maxItems":1,"items":{"required":["type"],"properties":{"type":{"type":"string","enum":["end_of_the_month"]},"code":{"description":"Caller-defined cycle code returned alongside leaderboard rankings. Optional — when omitted the server applies a default code.\n","type":"string"}},"type":"object"}},"groupingField":{"description":"Splits the leaderboard into sub-rankings per distinct group value. Members without a resolvable group value are excluded from the grouped leaderboard. The grouping configuration is set at campaign creation and is read-only afterwards. Submitting a `groupingField` on update (PUT) that differs from the stored one — including adding or removing it — is rejected with HTTP 400 to keep historical iterations consistent. An identical `groupingField` (or none) is accepted.\n","required":["type","key"],"properties":{"type":{"type":"string","description":"`address_field` groups by an address sub-field on the member profile; `custom_attribute` groups by a member custom attribute key.\n","enum":["address_field","custom_attribute"]},"key":{"type":"string","description":"For `address_field`, one of: `city`, `country`, `province`, `postal`. For `custom_attribute`, the custom attribute key on the member profile.\n"}},"type":"object"}},"type":"object"},"ChallengeCampaignRequestBody":{"title":"ChallengeCampaign","required":["campaign"],"properties":{"campaign":{"required":["type","trigger","translations","activity","rules","milestones"],"properties":{"triggerStrategy":{"$ref":"#/components/schemas/TriggerStrategy"},"visibility":{"$ref":"#/components/schemas/Visibility"},"audience":{"$ref":"#/components/schemas/Audience"},"rules":{"$ref":"#/components/schemas/Rule"},"limits":{"$ref":"#/components/schemas/Limit"},"type":{"type":"string","enum":["direct","referral"]},"trigger":{"type":"string"},"activity":{"required":["startsAt"],"properties":{"startsAt":{"type":"string"},"endsAt":{"type":"string","nullable":true}},"type":"object"},"displayOrder":{"type":"number"},"active":{"type":"boolean"},"labels":{"type":"array","items":{"required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslations"},"challengeLimit":{"$ref":"#/components/schemas/ChallengeLimit"},"challengeAvailability":{"$ref":"#/components/schemas/AchievementActivity"},"milestones":{"type":"array","items":{"$ref":"#/components/schemas/Milestone"}},"customFields":{"type":"object","nullable":true,"description":"Custom-field values grouped by group key. PUT semantics: omitted or null → existing values kept (no-op); empty object {} → all values cleared (validation still runs); non-empty object → wholesale entity replace (every group not in the payload is also wiped). Requires the CUSTOM_FIELD_CAMPAIGN feature flag; when disabled the field is silently ignored. See the endpoint description for full semantics.","additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"ChallengeLimit":{"properties":{"interval":{"$ref":"#/components/schemas/LimitInterval"},"value":{"type":"integer"}},"type":"object"},"LimitInterval":{"properties":{"type":{"type":"string"},"value":{"type":"integer"}},"type":"object"},"AchievementActivity":{"properties":{"data":{"oneOf":[{"type":"string"},{"properties":{"from":{"type":"string"},"to":{"type":"string"}},"type":"object"},{"type":"array","items":{"type":"string"}}]},"operator":{"type":"string"}},"type":"object"},"Milestone":{"properties":{"translations":{"properties":{"en":{"properties":{"name":{"type":"string"},"description":{"type":"string"}},"type":"object"}},"type":"object"},"milestoneId":{"type":"string"},"completeRule":{"$ref":"#/components/schemas/CompleteRule"},"aggregation":{"$ref":"#/components/schemas/Aggregation"},"uniqueReferee":{"type":"boolean"},"event":{"type":"string"},"trigger":{"type":"string"},"type":{"type":"string"},"conditions":{"type":"array","items":{"type":"object"}},"limit":{"$ref":"#/components/schemas/ChallengeLimit"}},"type":"object"},"CompleteRule":{"properties":{"periodGoal":{"oneOf":[{"type":"string"},{"type":"number"}]},"period":{"$ref":"#/components/schemas/Period"},"uniqueAttribute":{"type":"string"}},"type":"object"},"Period":{"properties":{"type":{"type":"string"},"consecutive":{"type":"integer"},"value":{"type":"integer"}},"type":"object"},"Aggregation":{"properties":{"type":{"type":"string"},"rule":{"type":"string"}},"type":"object"}},"responses":{"NoContent":{"description":"Success. No content."},"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/campaign/{campaign}":{"put":{"tags":["Campaign"],"summary":"Update campaign’s configuration","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\nThis method allows changing the information about a specific Campaign.<br><br>\n<strong>Custom-fields semantics on PUT:</strong> <ul>\n  <li><code>customFields</code> omitted from the request body → existing custom-field\n    values on the campaign are <strong>kept untouched</strong> (no-op; no validation\n    runs).</li>\n  <li><code>customFields: null</code> → existing values are <strong>kept untouched</strong>\n    (treated identically to omitting the field).</li>\n  <li><code>customFields: {}</code> (explicit empty object) → all existing custom-field\n    values on the campaign are <strong>cleared</strong>. Required-field validation still\n    runs against the empty payload, so this fails with 400 if any active campaign\n    custom-field group contains a required field.</li>\n  <li><code>customFields: { groupKey: { fieldKey: value, ... }, ... }</code> →\n    <strong>wholesale entity replace</strong>. The campaign's entire custom-field state\n    is deleted first, then only the groups present in the payload are persisted.\n    Consequence: any group NOT listed in the payload is also wiped, even if it had\n    values before. Required-field validation runs against the payload as a whole.</li>\n</ul> The feature flag <code>CUSTOM_FIELD_CAMPAIGN</code> must be enabled; when disabled the <code>customFields</code> key is silently ignored regardless of value.<br><br>\nFor granular per-group or per-key updates that preserve other groups, use the bulk patch endpoint (<code>PATCH /api/{storeCode}/custom-fields/campaign/{campaignId}</code>).\n","operationId":"_campaignPut","parameters":[{"$ref":"#/components/parameters/storeCode"},{"$ref":"#/components/parameters/campaign"}],"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/AchievementCampaignRequestBody"},{"$ref":"#/components/schemas/PutUniqueCodeCampaignRequestBody"},{"$ref":"#/components/schemas/CampaignRequestBody"},{"$ref":"#/components/schemas/MultiReferralCampaignRequestBody"},{"$ref":"#/components/schemas/LeaderboardCampaignRequestBody"},{"$ref":"#/components/schemas/ChallengeCampaignRequestBody"}]}}}},"responses":{"204":{"$ref":"#/components/responses/NoContent"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Delete campaign.

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br>\
> This method allows you to delete campaign.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"campaign":{"name":"campaign","in":"path","description":"Campaign ID","required":true,"schema":{"type":"string","format":"uuid"}}},"responses":{"NoContent":{"description":"Success. No content."},"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}},"schemas":{"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}},"paths":{"/api/{storeCode}/campaign/{campaign}":{"delete":{"tags":["Campaign"],"summary":"Delete campaign.","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\nThis method allows you to delete campaign.\n","operationId":"_campaignDelete","parameters":[{"$ref":"#/components/parameters/storeCode"},{"$ref":"#/components/parameters/campaign"}],"responses":{"204":{"$ref":"#/components/responses/NoContent"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Update campaign’s configuration

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br>\
> This method allows you to change the order in which your campaigns are displayed and campaign activity.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"campaign":{"name":"campaign","in":"path","description":"Campaign ID","required":true,"schema":{"type":"string","format":"uuid"}}},"schemas":{"PartialUpdateCampaign":{"properties":{"campaign":{"properties":{"displayOrder":{"type":"integer"},"active":{"type":"boolean"}},"type":"object"}},"type":"object"}},"responses":{"NoContent":{"description":"Success. No content."},"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/campaign/{campaign}":{"patch":{"tags":["Campaign"],"summary":"Update campaign’s configuration","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\nThis method allows you to change the order in which your campaigns are displayed and campaign activity.\n","operationId":"campaignPatch","parameters":[{"$ref":"#/components/parameters/storeCode"},{"$ref":"#/components/parameters/campaign"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartialUpdateCampaign"}}}},"responses":{"204":{"$ref":"#/components/responses/NoContent"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Get campaigns list

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br>\
> This method returns detailed information about all Campaigns created in the system.\n\n\
> If sorting is not chosen, the rows will be returned in an unspecified order.  \n\
> To sort a result, use an \`\_orderBy\` parameter in query.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"page":{"name":"_page","in":"query","description":"Number of page with results, starts from 1","required":false,"schema":{"type":"integer","default":1,"minimum":1}},"itemsOnPage":{"name":"_itemsOnPage","in":"query","description":"Items on one page","required":false,"schema":{"type":"integer","default":10,"maximum":50,"minimum":1}},"orderBy":{"name":"_orderBy","in":"query","description":"Sorting order. If sorting is not chosen, the rows will be returned in an unspecified order. Sort order: * `asc` - Ascending, from A to Z * `desc` - Descending, from Z to A","required":false,"style":"deepObject","explode":true,"schema":{"type":"object","additionalProperties":{"type":"string","enum":["asc","desc"]}}}},"schemas":{"CampaignResponse":{"description":"Campaign","properties":{"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string","enum":["direct","referral"]},"trigger":{"type":"string","enum":["transaction","return_transaction","custom_event","internal_event","time","achievement","custom_event_unique_code"]},"campaignId":{"type":"string","format":"uuid"},"activity":{"properties":{"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"}},"type":"object"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"displayOrder":{"type":"number"},"rules":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"conditions":{"type":"array","items":{"oneOf":[{"title":"Condition","properties":{"operator":{"type":"string"},"data":{"type":"array","items":{"type":"string"}},"attribute":{"type":"string"}},"type":"object"},{"$ref":"#/components/schemas/NewCondition"}]}},"effects":{"type":"array","items":{"properties":{"effect":{"type":"string"},"pointsRule":{"type":"string"}},"type":"object"}}},"type":"object"}},"transactionItemsFilters":{"type":"array","items":{"$ref":"#/components/schemas/TransactionItemsFilters"}},"limits":{"$ref":"#/components/schemas/Limit"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslationsResponse"},"limitUsages":{"properties":{"points":{"description":"These fields are not updated immediately after the status changes.","properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer","deprecated":true}},"type":"object"}},"type":"object"}},"type":"object"},"visibility":{"$ref":"#/components/schemas/Visibility"},"customFields":{"type":"object","nullable":true,"additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object"},"NewCondition":{"title":"New condition","required":["value","condition"],"properties":{"value":{"required":["field"],"properties":{"field":{"type":"string","enum":["customer.email","customer.wallets","referrer.wallets","customer.badges","referrer.badges","transaction.items","challenge.trigger","challenge.completions","challenge.milestoneProgresses"]},"params":{"description":"The `wallet` object applies only to the `customer.wallets` and `referrer.wallets` fields. The `walletTypeCode` field is used to precisely specify which wallet the condition should apply to. The `field` property defines which wallet field is used to retrieve the value for the condition.","type":"object","oneOf":[{"title":"wallet","required":["walletTypeCode","field"],"properties":{"walletTypeCode":{"type":"string"},"field":{"type":"string","enum":["activeUnits","spentUnits","earnedUnits","lockedUnits","blockUnits","expiredUnits"]}},"type":"object","additionalProperties":false},{"title":"badge","required":["badgeTypeId"],"properties":{"badgeTypeId":{"type":"string","format":"uuid"}},"type":"object","additionalProperties":false},{"title":"milestoneByRelationId","required":["milestoneRelationId"],"properties":{"milestoneRelationId":{"type":"string"}},"type":"object","additionalProperties":false},{"title":"milestoneById","required":["milestoneId"],"properties":{"milestoneId":{"type":"string","format":"uuid"}},"type":"object","additionalProperties":false}]},"filterCode":{"description":"In this field you can specify which transaction items filters you want to use in condition","type":"string"},"aggregation":{"description":"Available only for transaction.items","required":["type"],"properties":{"type":{"type":"string","enum":["sum","count"]},"field":{"type":"string"}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"condition":{"$ref":"#/components/schemas/Condition"}},"type":"object"},"Condition":{"required":["operator","value"],"properties":{"operator":{"type":"string","enum":["eq","neq","between","not_between","starts_with","ends_with","match","not_match","gt","gte","lt","lte","is_after","is_before","in","not_in","one_of","not_one_of","in_value_group","not_in_value_group","one_of_value_group","not_one_of_value_group"]},"value":{"oneOf":[{"description":"For operators `eq`, `neq`, `starts_with`, `ends_with`, `match`, `not_match` the value can be a string. For `match` and `not_match`, the string must be a valid regular expression.","type":"string"},{"description":"For operators `eq`, `neq`, `gt`, `gte`, `lt`, `lte` , the value can be a number.","type":"number"},{"description":"For operators `eq`, `neq`, the value can be a bool.","type":"boolean"},{"title":"datetime","description":"For operators `eq`, `neq` `is_after`, `is_before`, the value can be a datetime.","type":"string","format":"datetime","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?Z$"},{"title":"array","type":"array","items":{"description":"For `in`, `not_in`, `one_of`, `not_one_of` operators, the values can be in array.","oneOf":[{"type":"number"},{"type":"string"},{"title":"custom attribute","properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}]}},{"title":"between","description":"For `between`, `not_between` operators, the value is an object with 'from' and 'to'.","required":["from","to"],"properties":{"from":{"oneOf":[{"type":"number"},{"title":"datetime","type":"string","format":"datetime"}]},"to":{"oneOf":[{"type":"number"},{"title":"datetime","type":"string","format":"datetime"}]}},"type":"object"},{"title":"group of values","required":["groupValuesIds"],"properties":{"groupValuesIds":{"description":"For `in_value_group`, `not_in_value_group` operators, the value is an object with `groupValuesIds` array.","type":"array","items":{"type":"string","format":"uuid"}}},"type":"object"},{"title":"one of group of values","description":"For `one_of_value_group`, `not_one_of_value_group` operators, the value is an object with labelKey and `groupValuesIds` array.","required":["groupValuesIds","labelKey"],"properties":{"labelKey":{"type":"string"},"groupValuesIds":{"type":"array","items":{"type":"string","format":"uuid"}}},"type":"object"}]}},"type":"object","additionalProperties":false},"TransactionItemsFilters":{"required":["code"],"properties":{"code":{"type":"string"},"name":{"type":"string"},"filters":{"type":"array","items":{"required":["value","condition"],"properties":{"value":{"required":["field"],"properties":{"field":{"type":"string","enum":["sku","name","qty","grossValue","category","maker","labels"]}},"type":"object","additionalProperties":false},"condition":{"$ref":"#/components/schemas/Condition"}},"type":"object","additionalProperties":false}}},"type":"object","additionalProperties":false},"Limit":{"properties":{"points":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"},"pointsPerMember":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"},"executionsPerMember":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"}},"type":"object"},"CampaignTranslationsResponse":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"id":{"type":"integer"},"locale":{"type":"string"}},"type":"object"}},"Visibility":{"description":"Visibility settings for the campaign. Optional field.","properties":{"target":{"type":"string","enum":["segment","tier","none"]},"tiers":{"description":"Visibility settings for the campaign. Optional field.","type":"array","items":{"type":"string"}},"segments":{"description":"Visibility settings for the campaign. Optional field.","type":"array","items":{"type":"string"}}},"type":"object","additionalProperties":false},"SearchableTotalResponse":{"required":["all","filtered","estimated"],"properties":{"all":{"type":"integer","deprecated":true},"filtered":{"type":"integer","deprecated":true},"estimated":{"description":"Field estimated is used to show that the results are estimated. It might happen when there are more than 5000 results due to performance optimization.","type":"boolean","deprecated":true}},"type":"object","deprecated":true},"MultiReferralCampaignResponse":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"trigger":{"type":"string"},"campaignId":{"type":"string","format":"uuid"},"activity":{"properties":{"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time","nullable":true}},"type":"object"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"displayOrder":{"type":"number"},"multiLevel":{"type":"number"},"rules":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"conditions":{"type":"array","items":{"properties":{"operator":{"type":"string"},"data":{"type":"array","items":{"type":"string"}},"attribute":{"type":"string"}},"type":"object"}},"effects":{"type":"array","items":{"properties":{"effect":{"type":"string"},"pointsRule":{"type":"string"}},"type":"object"}}},"type":"object"}},"limits":{"$ref":"#/components/schemas/Limit"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslationsResponse"},"limitUsages":{"properties":{"points":{"description":"These fields are not updated immediately after the status changes.","properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer","deprecated":true}},"type":"object"}},"type":"object"}},"type":"object"},"visibility":{"$ref":"#/components/schemas/Visibility"},"customFields":{"type":"object","nullable":true,"additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object"},"UniqueCodeCampaignResponse":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"trigger":{"type":"string"},"campaignId":{"type":"string","format":"uuid"},"activity":{"properties":{"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time","nullable":true}},"type":"object"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"displayOrder":{"type":"number"},"rules":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"conditions":{"type":"array","items":{"properties":{"operator":{"type":"string"},"data":{"type":"array","items":{"type":"string"}},"attribute":{"type":"string"}},"type":"object"}},"effects":{"type":"array","items":{"properties":{"effect":{"type":"string"},"pointsRule":{"type":"string"}},"type":"object"}}},"type":"object"}},"limits":{"$ref":"#/components/schemas/Limit"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslationsResponse"},"eventCodeAttribute":{"type":"string"},"codeGenerator":{"properties":{"characterSet":{"type":"string"},"length":{"type":"integer"},"prefix":{"type":"string"}},"type":"object"},"limitUsages":{"properties":{"points":{"description":"These fields are not updated immediately after the status changes.","properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer","deprecated":true}},"type":"object"}},"type":"object"}},"type":"object"},"visibility":{"$ref":"#/components/schemas/Visibility"},"customFields":{"type":"object","nullable":true,"additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object"},"TimeTriggerCampaignResponse":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"trigger":{"type":"string"},"campaignId":{"type":"string","format":"uuid"},"activity":{"properties":{"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time","nullable":true}},"type":"object"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"displayOrder":{"type":"number"},"multiLevel":{"type":"number"},"rules":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"conditions":{"type":"array","items":{"properties":{"operator":{"type":"string"},"data":{"type":"array","items":{"type":"string"}},"attribute":{"type":"string"}},"type":"object"}},"effects":{"type":"array","items":{"properties":{"effect":{"type":"string"},"pointsRule":{"type":"string"}},"type":"object"}}},"type":"object"}},"limits":{"$ref":"#/components/schemas/Limit"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslationsResponse"},"limitUsages":{"properties":{"points":{"description":"These fields are not updated immediately after the status changes.","properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer","deprecated":true}},"type":"object"}},"type":"object"}},"type":"object"},"visibility":{"$ref":"#/components/schemas/Visibility"},"audience":{"$ref":"#/components/schemas/Audience"},"triggerStrategy":{"$ref":"#/components/schemas/TriggerStrategy"},"customFields":{"type":"object","nullable":true,"additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object"},"Audience":{"description":"Audience settings for the campaign. Optional field.","properties":{"target":{"type":"string","enum":["segment","tier"]},"tiers":{"type":"array","items":{"type":"string"}},"segments":{"type":"array","items":{"type":"string"}}},"type":"object","nullable":true},"TriggerStrategy":{"properties":{"type":{"type":"string","enum":["birthday","registration_anniversary","daily","weekly","monthly"]},"executionSchedule":{"description":"Required for `weekly` and `monthly` type of campaign.","properties":{"dayOfWeek":{"description":"List of days when campaign should be executed. 0 for Sunday, 6 for Saturday.","type":"array","items":{"type":"integer","enum":[0,1,2,3,4,5,6]},"nullable":true},"dayOfMonth":{"description":"List of month days when campaign should be executed. 'L' for the last day of the month.","type":"array","items":{"oneOf":[{"type":"integer","enum":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},{"type":"string","enum":["L"]}]},"nullable":true}},"type":"object","nullable":true}},"type":"object"},"LeaderboardCampaignResponse":{"description":"Campaign","properties":{"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string","enum":["direct","referral"]},"trigger":{"type":"string","enum":["leaderboard"]},"campaignId":{"type":"string","format":"uuid"},"activity":{"properties":{"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"}},"type":"object"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"displayOrder":{"type":"number"},"rules":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"conditions":{"type":"array","items":{"oneOf":[{"title":"Condition","properties":{"operator":{"type":"string"},"data":{"type":"array","items":{"type":"string"}},"attribute":{"type":"string"}},"type":"object"},{"$ref":"#/components/schemas/NewCondition"}]}},"effects":{"type":"array","items":{"properties":{"effect":{"type":"string"},"pointsRule":{"type":"string"}},"type":"object"}}},"type":"object"}},"limits":{"$ref":"#/components/schemas/Limit"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslationsResponse"},"limitUsages":{"properties":{"points":{"description":"These fields are not updated immediately after the status changes.","properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer","deprecated":true}},"type":"object"}},"type":"object"}},"type":"object"},"visibility":{"$ref":"#/components/schemas/Visibility"},"leaderboard":{"$ref":"#/components/schemas/LeaderboardResponse"},"customFields":{"type":"object","nullable":true,"additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object"},"LeaderboardResponse":{"properties":{"metric":{"required":["type","walletTypeCode"],"properties":{"type":{"type":"string","enum":["earned_units_cumulative"]},"walletTypeCode":{"type":"string"}},"type":"object"},"cycles":{"required":["type"],"properties":{"type":{"type":"string","enum":["end_of_the_month"]},"code":{"type":"string"},"recalculatedAt":{"type":"string","format":"datetime"}},"type":"object"},"groupingField":{"description":"Present only for grouped leaderboards. `groupsCount` reflects the number of distinct group values in the running iteration (0 when no iteration is running). `groupsLimit` is the per-environment hard cap.\n","required":["type","key","groupsCount","groupsLimit"],"properties":{"type":{"type":"string","enum":["address_field","custom_attribute"]},"key":{"type":"string"},"groupsCount":{"type":"integer","minimum":0},"groupsLimit":{"type":"integer","minimum":1}},"type":"object"}},"type":"object"},"ChallengeCampaignResponse":{"description":"Challenge Campaign","properties":{"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string","enum":["direct","referral"]},"trigger":{"type":"string","enum":["challenge"]},"campaignId":{"type":"string","format":"uuid"},"activity":{"properties":{"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"}},"type":"object"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"displayOrder":{"type":"number"},"rules":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"conditions":{"type":"array","items":{"oneOf":[{"title":"Condition","properties":{"operator":{"type":"string"},"data":{"type":"array","items":{"type":"string"}},"attribute":{"type":"string"}},"type":"object"},{"$ref":"#/components/schemas/NewCondition"}]}},"effects":{"type":"array","items":{"properties":{"effect":{"type":"string"},"pointsRule":{"type":"string"}},"type":"object"}}},"type":"object"}},"limits":{"$ref":"#/components/schemas/Limit"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslationsResponse"},"limitUsages":{"properties":{"points":{"description":"These fields are not updated immediately after the status changes.","properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer"}},"type":"object"}},"type":"object"}},"type":"object"},"visibility":{"$ref":"#/components/schemas/Visibility"},"milestones":{"type":"array","items":{"$ref":"#/components/schemas/Milestone"}},"challengeAvailability":{"$ref":"#/components/schemas/AchievementActivity"},"challengeLimit":{"$ref":"#/components/schemas/ChallengeLimit"},"customFields":{"type":"object","nullable":true,"additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object"},"Milestone":{"properties":{"translations":{"properties":{"en":{"properties":{"name":{"type":"string"},"description":{"type":"string"}},"type":"object"}},"type":"object"},"milestoneId":{"type":"string"},"completeRule":{"$ref":"#/components/schemas/CompleteRule"},"aggregation":{"$ref":"#/components/schemas/Aggregation"},"uniqueReferee":{"type":"boolean"},"event":{"type":"string"},"trigger":{"type":"string"},"type":{"type":"string"},"conditions":{"type":"array","items":{"type":"object"}},"limit":{"$ref":"#/components/schemas/ChallengeLimit"}},"type":"object"},"CompleteRule":{"properties":{"periodGoal":{"oneOf":[{"type":"string"},{"type":"number"}]},"period":{"$ref":"#/components/schemas/Period"},"uniqueAttribute":{"type":"string"}},"type":"object"},"Period":{"properties":{"type":{"type":"string"},"consecutive":{"type":"integer"},"value":{"type":"integer"}},"type":"object"},"Aggregation":{"properties":{"type":{"type":"string"},"rule":{"type":"string"}},"type":"object"},"ChallengeLimit":{"properties":{"interval":{"$ref":"#/components/schemas/LimitInterval"},"value":{"type":"integer"}},"type":"object"},"LimitInterval":{"properties":{"type":{"type":"string"},"value":{"type":"integer"}},"type":"object"},"AchievementActivity":{"properties":{"data":{"oneOf":[{"type":"string"},{"properties":{"from":{"type":"string"},"to":{"type":"string"}},"type":"object"},{"type":"array","items":{"type":"string"}}]},"operator":{"type":"string"}},"type":"object"},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/campaign":{"get":{"tags":["Campaign"],"summary":"Get campaigns list","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\nThis method returns detailed information about all Campaigns created in the system.\\n\\n\nIf sorting is not chosen, the rows will be returned in an unspecified order.  \\n\nTo sort a result, use an `_orderBy` parameter in query.\n","operationId":"campaignGetList","parameters":[{"$ref":"#/components/parameters/storeCode"},{"name":"type","in":"query","required":false,"style":"deepObject","explode":true,"schema":{"type":"string","enum":["direct","referral"]}},{"name":"trigger","in":"query","required":false,"style":"deepObject","explode":true,"schema":{"type":"string","enum":["transaction","return_transaction","custom_event","internal_event","time","achievement","custom_event_unique_code","challenge"]}},{"name":"event","in":"query","required":false,"style":"deepObject","explode":true,"schema":{"type":"string"}},{"name":"campaignId","in":"query","description":"Campaign ID","required":false,"style":"deepObject","explode":true,"schema":{"type":"string","format":"uuid"}},{"name":"name","in":"query","description":"Campaign name","required":false,"style":"deepObject","explode":true,"schema":{"type":"string"}},{"name":"active","in":"query","description":"Active","required":false,"style":"deepObject","explode":true,"schema":{"type":"boolean"}},{"name":"available","in":"query","description":"Available","required":false,"schema":{"type":"boolean"}},{"name":"startsAt","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"endsAt","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"labels","in":"query","description":"Filter with Campaign custom attributes.\n\nExample: `labels=(key;value)`\n","required":false,"style":"deepObject","explode":true,"schema":{"type":"string"}},{"name":"format","in":"query","description":"If set to html, the descriptions will be in HTML format. Omit for raw output.","required":false,"style":"deepObject","schema":{"type":"string","format":"html|raw"}},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/itemsOnPage"},{"$ref":"#/components/parameters/orderBy"}],"responses":{"200":{"description":"List of campaigns.","content":{"application/json":{"schema":{"oneOf":[{"title":"Campaign","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CampaignResponse"}},"total":{"$ref":"#/components/schemas/SearchableTotalResponse"}},"type":"object"},{"title":"MultiReferralCampaign","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/MultiReferralCampaignResponse"}},"total":{"$ref":"#/components/schemas/SearchableTotalResponse"}},"type":"object"},{"title":"UniqueCodeCampaign","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/UniqueCodeCampaignResponse"}},"total":{"$ref":"#/components/schemas/SearchableTotalResponse"}},"type":"object"},{"title":"TimeTriggerCampaign","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/TimeTriggerCampaignResponse"}},"total":{"$ref":"#/components/schemas/SearchableTotalResponse"}},"type":"object"},{"title":"LeaderboardCampaign","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/LeaderboardCampaignResponse"}},"total":{"$ref":"#/components/schemas/SearchableTotalResponse"}},"type":"object"},{"title":"ChallengeCampaign","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ChallengeCampaignResponse"}},"total":{"$ref":"#/components/schemas/SearchableTotalResponse"}},"type":"object"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"}}}}}}
````

## Add a new campaign

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br>\
> This method allows creating a new Campaign.\<br>\<br>\
> \<strong>Custom-fields semantics on POST:\</strong> \<ul>\
> &#x20; \<li>\<code>customFields\</code> omitted, \<code>null\</code>, or \<code>{}\</code> →\
> &#x20;   the campaign is created with no custom-field values; required-field validation\
> &#x20;   still runs and the request fails with 400 if any active campaign custom-field\
> &#x20;   group contains a required field.\</li>\
> &#x20; \<li>\<code>customFields: { groupKey: { fieldKey: value, ... }, ... }\</code> →\
> &#x20;   the provided values are persisted on the new campaign; required-field validation\
> &#x20;   runs against the payload.\</li>\
> \</ul> The feature flag \<code>CUSTOM\_FIELD\_CAMPAIGN\</code> must be enabled; when disabled the \<code>customFields\</code> key is silently ignored.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}}},"schemas":{"CampaignRequestBody":{"title":"Campaign","required":["campaign"],"properties":{"campaign":{"required":["type","trigger","translations","activity","rules"],"properties":{"triggerStrategy":{"$ref":"#/components/schemas/TriggerStrategy"},"visibility":{"$ref":"#/components/schemas/Visibility"},"audience":{"$ref":"#/components/schemas/Audience"},"rules":{"$ref":"#/components/schemas/Rule"},"transactionItemsFilters":{"description":"Field that you can use to filter transaction items, which you can then use in the condition by providing the code, only allowed for transaction trigger","type":"array","items":{"$ref":"#/components/schemas/TransactionItemsFilters"}},"limits":{"$ref":"#/components/schemas/Limit"},"type":{"type":"string","enum":["direct","referral"]},"trigger":{"type":"string","enum":["transaction","return_transaction","custom_event","internal_event","time","achievement","custom_event_unique_code"]},"event":{"description":"Allowed only for campaign with trigger event","type":"string"},"activity":{"required":["startsAt"],"properties":{"startsAt":{"type":"string"},"endsAt":{"type":"string","nullable":true}},"type":"object"},"displayOrder":{"type":"number"},"active":{"type":"boolean"},"labels":{"type":"array","items":{"required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"memberFilter":{"description":"Only allowed for time trigger","properties":{"strategy":{}},"type":"object"},"translations":{"$ref":"#/components/schemas/CampaignTranslations"},"customFields":{"type":"object","nullable":true,"description":"Custom-field values grouped by group key. PUT semantics: omitted or null → existing values kept (no-op); empty object {} → all values cleared (validation still runs); non-empty object → wholesale entity replace (every group not in the payload is also wiped). Requires the CUSTOM_FIELD_CAMPAIGN feature flag; when disabled the field is silently ignored. See the endpoint description for full semantics.","additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"TriggerStrategy":{"properties":{"type":{"type":"string","enum":["birthday","registration_anniversary","daily","weekly","monthly"]},"executionSchedule":{"description":"Required for `weekly` and `monthly` type of campaign.","properties":{"dayOfWeek":{"description":"List of days when campaign should be executed. 0 for Sunday, 6 for Saturday.","type":"array","items":{"type":"integer","enum":[0,1,2,3,4,5,6]},"nullable":true},"dayOfMonth":{"description":"List of month days when campaign should be executed. 'L' for the last day of the month.","type":"array","items":{"oneOf":[{"type":"integer","enum":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},{"type":"string","enum":["L"]}]},"nullable":true}},"type":"object","nullable":true}},"type":"object"},"Visibility":{"description":"Visibility settings for the campaign. Optional field.","properties":{"target":{"type":"string","enum":["segment","tier","none"]},"tiers":{"description":"Visibility settings for the campaign. Optional field.","type":"array","items":{"type":"string"}},"segments":{"description":"Visibility settings for the campaign. Optional field.","type":"array","items":{"type":"string"}}},"type":"object","additionalProperties":false},"Audience":{"description":"Audience settings for the campaign. Optional field.","properties":{"target":{"type":"string","enum":["segment","tier"]},"tiers":{"type":"array","items":{"type":"string"}},"segments":{"type":"array","items":{"type":"string"}}},"type":"object","nullable":true},"Rule":{"type":"array","items":{"required":["effects"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"target":{"description":"Allowed only when the campaign type is `referral`. Specifies which member the rule applies to: `self` (the referrer) or `referral` (the referred person).","type":"string","enum":["self","referrer"]},"effects":{"type":"array","items":{"required":["effect"],"properties":{"effect":{"type":"string","enum":["give_points","give_reward","deduct_unit","assign_member_custom_attribute","remove_member_custom_attribute","grant_badge","cancel_transaction_effects"]},"pointsRule":{"description":"Only allowed for `give_points` and `deduct_unit` effect"},"walletCode":{"description":"Only allowed for `give_points` and `deduct_unit` effect","type":"string"},"unitsLockRule":{"description":"The field allows you to set a custom pending for units given by campaign effects. Only allowed for `give_points` effect","required":["lockStrategy"],"properties":{"lockStrategy":{"type":"string","enum":["expression","from_wallet","no_pending"]},"expression":{"description":"This field is required for `lockStrategy = expression`","type":"string"}},"type":"object","additionalProperties":false},"unitsExpirationRule":{"description":"The field allows you to set a custom expiration for units given by campaign effects. Only allowed for `give_points` effect","required":["expirationStrategy"],"properties":{"expirationStrategy":{"type":"string","enum":["expression","from_wallet","never_expires"]},"expression":{"description":"This field is required for `lockStrategy = expression`","type":"string"}},"type":"object","additionalProperties":false},"rewardId":{"description":"Only allowed for `give_reward` effect","type":"string","format":"uuid"},"couponValueRule":{"description":"Only allowed for `give_reward` effect","type":"string"},"customAttributeKey":{"description":"Only allowed for `assign_member_custom_attribute` effect","type":"string"},"customAttributeValueRule":{"description":"Only allowed for `assign_member_custom_attribute` effect","type":"string"},"badgeSystemCode":{"description":"Only allowed for `grant_badge` effect","type":"string"}},"type":"object","additionalProperties":false}},"conditions":{"type":"array","items":{"oneOf":[{"title":"Condition","required":["operator","data"],"properties":{"attribute":{"type":"string"},"operator":{"type":"string","enum":["expression","is_equal","has_at_least_one_label","contains","not_contains","is_not_equal","is_not_one_of","is_one_of","matches_regex","is_greater","is_greater_or_equal","is_less","is_less_or_equal","ends_with","starts_with","is_after","is_before","is_between","is_day_of_week","is_month_of_year","is_not_between","is_day_of_month","is_time_between","is_one_of_group_values","is_not_one_of_group_values","not_contains_one_of","contains_one_of"]},"data":{}},"type":"object"},{"$ref":"#/components/schemas/NewCondition"}]}}},"type":"object"}},"NewCondition":{"title":"New condition","required":["value","condition"],"properties":{"value":{"required":["field"],"properties":{"field":{"type":"string","enum":["customer.email","customer.wallets","referrer.wallets","customer.badges","referrer.badges","transaction.items","challenge.trigger","challenge.completions","challenge.milestoneProgresses"]},"params":{"description":"The `wallet` object applies only to the `customer.wallets` and `referrer.wallets` fields. The `walletTypeCode` field is used to precisely specify which wallet the condition should apply to. The `field` property defines which wallet field is used to retrieve the value for the condition.","type":"object","oneOf":[{"title":"wallet","required":["walletTypeCode","field"],"properties":{"walletTypeCode":{"type":"string"},"field":{"type":"string","enum":["activeUnits","spentUnits","earnedUnits","lockedUnits","blockUnits","expiredUnits"]}},"type":"object","additionalProperties":false},{"title":"badge","required":["badgeTypeId"],"properties":{"badgeTypeId":{"type":"string","format":"uuid"}},"type":"object","additionalProperties":false},{"title":"milestoneByRelationId","required":["milestoneRelationId"],"properties":{"milestoneRelationId":{"type":"string"}},"type":"object","additionalProperties":false},{"title":"milestoneById","required":["milestoneId"],"properties":{"milestoneId":{"type":"string","format":"uuid"}},"type":"object","additionalProperties":false}]},"filterCode":{"description":"In this field you can specify which transaction items filters you want to use in condition","type":"string"},"aggregation":{"description":"Available only for transaction.items","required":["type"],"properties":{"type":{"type":"string","enum":["sum","count"]},"field":{"type":"string"}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"condition":{"$ref":"#/components/schemas/Condition"}},"type":"object"},"Condition":{"required":["operator","value"],"properties":{"operator":{"type":"string","enum":["eq","neq","between","not_between","starts_with","ends_with","match","not_match","gt","gte","lt","lte","is_after","is_before","in","not_in","one_of","not_one_of","in_value_group","not_in_value_group","one_of_value_group","not_one_of_value_group"]},"value":{"oneOf":[{"description":"For operators `eq`, `neq`, `starts_with`, `ends_with`, `match`, `not_match` the value can be a string. For `match` and `not_match`, the string must be a valid regular expression.","type":"string"},{"description":"For operators `eq`, `neq`, `gt`, `gte`, `lt`, `lte` , the value can be a number.","type":"number"},{"description":"For operators `eq`, `neq`, the value can be a bool.","type":"boolean"},{"title":"datetime","description":"For operators `eq`, `neq` `is_after`, `is_before`, the value can be a datetime.","type":"string","format":"datetime","pattern":"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?Z$"},{"title":"array","type":"array","items":{"description":"For `in`, `not_in`, `one_of`, `not_one_of` operators, the values can be in array.","oneOf":[{"type":"number"},{"type":"string"},{"title":"custom attribute","properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}]}},{"title":"between","description":"For `between`, `not_between` operators, the value is an object with 'from' and 'to'.","required":["from","to"],"properties":{"from":{"oneOf":[{"type":"number"},{"title":"datetime","type":"string","format":"datetime"}]},"to":{"oneOf":[{"type":"number"},{"title":"datetime","type":"string","format":"datetime"}]}},"type":"object"},{"title":"group of values","required":["groupValuesIds"],"properties":{"groupValuesIds":{"description":"For `in_value_group`, `not_in_value_group` operators, the value is an object with `groupValuesIds` array.","type":"array","items":{"type":"string","format":"uuid"}}},"type":"object"},{"title":"one of group of values","description":"For `one_of_value_group`, `not_one_of_value_group` operators, the value is an object with labelKey and `groupValuesIds` array.","required":["groupValuesIds","labelKey"],"properties":{"labelKey":{"type":"string"},"groupValuesIds":{"type":"array","items":{"type":"string","format":"uuid"}}},"type":"object"}]}},"type":"object","additionalProperties":false},"TransactionItemsFilters":{"required":["code"],"properties":{"code":{"type":"string"},"name":{"type":"string"},"filters":{"type":"array","items":{"required":["value","condition"],"properties":{"value":{"required":["field"],"properties":{"field":{"type":"string","enum":["sku","name","qty","grossValue","category","maker","labels"]}},"type":"object","additionalProperties":false},"condition":{"$ref":"#/components/schemas/Condition"}},"type":"object","additionalProperties":false}}},"type":"object","additionalProperties":false},"Limit":{"properties":{"points":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"},"pointsPerMember":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"},"executionsPerMember":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"}},"type":"object"},"CampaignTranslations":{"description":"This field is used to save the name and description in the language of your choice","required":["en"],"properties":{"en":{"required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"}},"type":"object"},"pl":{"required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"}},"type":"object"}},"type":"object"},"AchievementCampaignRequestBody":{"title":"AchievementCampaign","required":["campaign"],"properties":{"campaign":{"required":["type","trigger","translations","activity","rules","achievementId"],"properties":{"triggerStrategy":{"$ref":"#/components/schemas/TriggerStrategy"},"visibility":{"$ref":"#/components/schemas/Visibility"},"audience":{"$ref":"#/components/schemas/Audience"},"rules":{"$ref":"#/components/schemas/Rule"},"limits":{"$ref":"#/components/schemas/Limit"},"type":{"type":"string","enum":["direct","referral"]},"trigger":{"type":"string"},"activity":{"required":["startsAt"],"properties":{"startsAt":{"type":"string"},"endsAt":{"type":"string","nullable":true}},"type":"object"},"displayOrder":{"type":"number"},"active":{"type":"boolean"},"labels":{"type":"array","items":{"required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslations"},"achievementId":{"type":"string","format":"uuid","deprecated":true},"customFields":{"type":"object","nullable":true,"description":"Custom-field values grouped by group key. PUT semantics: omitted or null → existing values kept (no-op); empty object {} → all values cleared (validation still runs); non-empty object → wholesale entity replace (every group not in the payload is also wiped). Requires the CUSTOM_FIELD_CAMPAIGN feature flag; when disabled the field is silently ignored. See the endpoint description for full semantics.","additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"UniqueCodeCampaignRequestBody":{"title":"RedemptionCampaign","required":["campaign"],"properties":{"campaign":{"description":"Campaign details combining common fields with specific strategy requirements.","type":"object","allOf":[{"required":["type","trigger","translations","activity","eventCodeAttribute","rules","event"],"properties":{"type":{"type":"string"},"trigger":{"type":"string"},"activity":{"required":["startsAt"],"properties":{"startsAt":{"type":"string"},"endsAt":{"type":"string","nullable":true}},"type":"object"},"displayOrder":{"type":"number"},"active":{"type":"boolean"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslations"},"rules":{"$ref":"#/components/schemas/Rule"},"limits":{"$ref":"#/components/schemas/Limit"},"visibility":{"$ref":"#/components/schemas/Visibility"},"audience":{"$ref":"#/components/schemas/Audience"},"event":{"type":"string"},"eventCodeAttribute":{"type":"string"},"customFields":{"type":"object","nullable":true,"description":"Custom-field values grouped by group key. POST-only schema (unique-code campaign creation): omitted, null, or empty {} → no values written; non-empty → persisted on the new campaign. Required-field validation always runs (enforceRequired). Requires the CUSTOM_FIELD_CAMPAIGN feature flag; when disabled the field is silently ignored.","additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object"},{"oneOf":[{"title":"Internal Generator (Default)","required":["generateCodes","codeGenerator"],"properties":{"isExternalCodeSource":{"description":"Defaults to false. If false or omitted, generator fields are required.","type":"boolean"},"generateCodes":{"type":"integer"},"codeGenerator":{"required":["characterSet","length"],"properties":{"characterSet":{"type":"string"},"length":{"type":"integer"},"prefix":{"type":"string"}},"type":"object","additionalProperties":false}},"type":"object"},{"title":"External Source (Import)","required":["isExternalCodeSource"],"properties":{"isExternalCodeSource":{"description":"Set to true to skip code generation and import codes manually.","type":"boolean","enum":[true]}},"type":"object"}]}]}},"type":"object","additionalProperties":false},"MultiReferralCampaignRequestBody":{"title":"MultiReferralCampaign","description":"When campaign is referral type, you can specify multi level","required":["campaign"],"properties":{"campaign":{"required":["multiLevel","type","trigger","translations","activity","rules"],"properties":{"triggerStrategy":{"$ref":"#/components/schemas/TriggerStrategy"},"visibility":{"$ref":"#/components/schemas/Visibility"},"audience":{"$ref":"#/components/schemas/Audience"},"rules":{"$ref":"#/components/schemas/Rule"},"transactionItemsFilters":{"description":"Field that you can use to filter transaction items, which you can then use in the condition by providing the code, only allowed for transaction trigger","type":"array","items":{"$ref":"#/components/schemas/TransactionItemsFilters"}},"limits":{"$ref":"#/components/schemas/Limit"},"type":{"type":"string","enum":["direct","referral"]},"multiLevel":{"type":"number"},"trigger":{"type":"string","enum":["transaction","return_transaction","custom_event","internal_event","time","achievement","custom_event_unique_code"]},"event":{"type":"string"},"activity":{"required":["startsAt"],"properties":{"startsAt":{"type":"string"},"endsAt":{"type":"string","nullable":true}},"type":"object"},"displayOrder":{"type":"number"},"active":{"type":"boolean"},"labels":{"type":"array","items":{"required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"memberFilter":{"description":"Only allowed for time trigger","properties":{"strategy":{}},"type":"object"},"translations":{"$ref":"#/components/schemas/CampaignTranslations"},"customFields":{"type":"object","nullable":true,"description":"Custom-field values grouped by group key. PUT semantics: omitted or null → existing values kept (no-op); empty object {} → all values cleared (validation still runs); non-empty object → wholesale entity replace (every group not in the payload is also wiped). Requires the CUSTOM_FIELD_CAMPAIGN feature flag; when disabled the field is silently ignored. See the endpoint description for full semantics.","additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"LeaderboardCampaignRequestBody":{"title":"LeaderboardCampaign","required":["campaign"],"properties":{"campaign":{"required":["type","trigger","translations","activity","leaderboard"],"properties":{"triggerStrategy":{"$ref":"#/components/schemas/TriggerStrategy"},"visibility":{"$ref":"#/components/schemas/Visibility"},"audience":{"$ref":"#/components/schemas/Audience"},"rules":{"$ref":"#/components/schemas/Rule"},"type":{"type":"string","enum":["direct","referral"]},"trigger":{"type":"string"},"activity":{"required":["startsAt"],"properties":{"startsAt":{"type":"string"},"endsAt":{"type":"string","nullable":true}},"type":"object"},"displayOrder":{"type":"number"},"active":{"type":"boolean"},"labels":{"type":"array","items":{"required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslations"},"leaderboard":{"$ref":"#/components/schemas/Leaderboard"},"customFields":{"type":"object","nullable":true,"description":"Custom-field values grouped by group key. PUT semantics: omitted or null → existing values kept (no-op); empty object {} → all values cleared (validation still runs); non-empty object → wholesale entity replace (every group not in the payload is also wiped). Requires the CUSTOM_FIELD_CAMPAIGN feature flag; when disabled the field is silently ignored. See the endpoint description for full semantics.","additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"Leaderboard":{"properties":{"metric":{"required":["type","walletTypeCode"],"properties":{"type":{"type":"string","enum":["earned_units_cumulative"]},"walletTypeCode":{"type":"string"}},"type":"object"},"cycles":{"description":"Optional cycle definition. Without `cycles` the leaderboard is timeless (a single open-ended iteration). Only one cycle is supported.\n","type":"array","maxItems":1,"items":{"required":["type"],"properties":{"type":{"type":"string","enum":["end_of_the_month"]},"code":{"description":"Caller-defined cycle code returned alongside leaderboard rankings. Optional — when omitted the server applies a default code.\n","type":"string"}},"type":"object"}},"groupingField":{"description":"Splits the leaderboard into sub-rankings per distinct group value. Members without a resolvable group value are excluded from the grouped leaderboard. The grouping configuration is set at campaign creation and is read-only afterwards. Submitting a `groupingField` on update (PUT) that differs from the stored one — including adding or removing it — is rejected with HTTP 400 to keep historical iterations consistent. An identical `groupingField` (or none) is accepted.\n","required":["type","key"],"properties":{"type":{"type":"string","description":"`address_field` groups by an address sub-field on the member profile; `custom_attribute` groups by a member custom attribute key.\n","enum":["address_field","custom_attribute"]},"key":{"type":"string","description":"For `address_field`, one of: `city`, `country`, `province`, `postal`. For `custom_attribute`, the custom attribute key on the member profile.\n"}},"type":"object"}},"type":"object"},"ChallengeCampaignRequestBody":{"title":"ChallengeCampaign","required":["campaign"],"properties":{"campaign":{"required":["type","trigger","translations","activity","rules","milestones"],"properties":{"triggerStrategy":{"$ref":"#/components/schemas/TriggerStrategy"},"visibility":{"$ref":"#/components/schemas/Visibility"},"audience":{"$ref":"#/components/schemas/Audience"},"rules":{"$ref":"#/components/schemas/Rule"},"limits":{"$ref":"#/components/schemas/Limit"},"type":{"type":"string","enum":["direct","referral"]},"trigger":{"type":"string"},"activity":{"required":["startsAt"],"properties":{"startsAt":{"type":"string"},"endsAt":{"type":"string","nullable":true}},"type":"object"},"displayOrder":{"type":"number"},"active":{"type":"boolean"},"labels":{"type":"array","items":{"required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"translations":{"$ref":"#/components/schemas/CampaignTranslations"},"challengeLimit":{"$ref":"#/components/schemas/ChallengeLimit"},"challengeAvailability":{"$ref":"#/components/schemas/AchievementActivity"},"milestones":{"type":"array","items":{"$ref":"#/components/schemas/Milestone"}},"customFields":{"type":"object","nullable":true,"description":"Custom-field values grouped by group key. PUT semantics: omitted or null → existing values kept (no-op); empty object {} → all values cleared (validation still runs); non-empty object → wholesale entity replace (every group not in the payload is also wiped). Requires the CUSTOM_FIELD_CAMPAIGN feature flag; when disabled the field is silently ignored. See the endpoint description for full semantics.","additionalProperties":{"type":"object","additionalProperties":true}}},"type":"object","additionalProperties":false}},"type":"object","additionalProperties":false},"ChallengeLimit":{"properties":{"interval":{"$ref":"#/components/schemas/LimitInterval"},"value":{"type":"integer"}},"type":"object"},"LimitInterval":{"properties":{"type":{"type":"string"},"value":{"type":"integer"}},"type":"object"},"AchievementActivity":{"properties":{"data":{"oneOf":[{"type":"string"},{"properties":{"from":{"type":"string"},"to":{"type":"string"}},"type":"object"},{"type":"array","items":{"type":"string"}}]},"operator":{"type":"string"}},"type":"object"},"Milestone":{"properties":{"translations":{"properties":{"en":{"properties":{"name":{"type":"string"},"description":{"type":"string"}},"type":"object"}},"type":"object"},"milestoneId":{"type":"string"},"completeRule":{"$ref":"#/components/schemas/CompleteRule"},"aggregation":{"$ref":"#/components/schemas/Aggregation"},"uniqueReferee":{"type":"boolean"},"event":{"type":"string"},"trigger":{"type":"string"},"type":{"type":"string"},"conditions":{"type":"array","items":{"type":"object"}},"limit":{"$ref":"#/components/schemas/ChallengeLimit"}},"type":"object"},"CompleteRule":{"properties":{"periodGoal":{"oneOf":[{"type":"string"},{"type":"number"}]},"period":{"$ref":"#/components/schemas/Period"},"uniqueAttribute":{"type":"string"}},"type":"object"},"Period":{"properties":{"type":{"type":"string"},"consecutive":{"type":"integer"},"value":{"type":"integer"}},"type":"object"},"Aggregation":{"properties":{"type":{"type":"string"},"rule":{"type":"string"}},"type":"object"},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/campaign":{"post":{"tags":["Campaign"],"summary":"Add a new campaign","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\nThis method allows creating a new Campaign.<br><br>\n<strong>Custom-fields semantics on POST:</strong> <ul>\n  <li><code>customFields</code> omitted, <code>null</code>, or <code>{}</code> →\n    the campaign is created with no custom-field values; required-field validation\n    still runs and the request fails with 400 if any active campaign custom-field\n    group contains a required field.</li>\n  <li><code>customFields: { groupKey: { fieldKey: value, ... }, ... }</code> →\n    the provided values are persisted on the new campaign; required-field validation\n    runs against the payload.</li>\n</ul> The feature flag <code>CUSTOM_FIELD_CAMPAIGN</code> must be enabled; when disabled the <code>customFields</code> key is silently ignored.\n","operationId":"_campaignPost","parameters":[{"$ref":"#/components/parameters/storeCode"}],"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/CampaignRequestBody"},{"$ref":"#/components/schemas/AchievementCampaignRequestBody"},{"$ref":"#/components/schemas/UniqueCodeCampaignRequestBody"},{"$ref":"#/components/schemas/MultiReferralCampaignRequestBody"},{"$ref":"#/components/schemas/LeaderboardCampaignRequestBody"},{"$ref":"#/components/schemas/ChallengeCampaignRequestBody"}]}}}},"responses":{"200":{"description":"Return created campaign ID.","content":{"application/json":{"schema":{"required":["campaignId"],"properties":{"campaignId":{"type":"string","format":"uuid"}},"type":"object","additionalProperties":false}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Get a list of available campaigns for the member.

> \<label style="background-color: #BFE1F6;padding:5px;">Integration\</label>\<br>\<br>\
> This method returns all active Campaigns for Member.\
> The logged in member can only see their own available campaigns.\
> Endpoint returns all active campaigns, for campaigns that have not reached the limit it adds \`"limitReached": false\`,\
> and for campaigns that have reached the limit \`"limitReached": true\`.\
> If there is a dynamic effect in the campaign, the endpoint may return that the\
> campaign limit is not reached, although the effect may exceed the limit and points will not be awarded \
> If sorting is not chosen, the rows will be returned in an unspecified order.\
> To sort a result, use an \`\_orderBy\` parameter in query.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"page":{"name":"_page","in":"query","description":"Number of page with results, starts from 1","required":false,"schema":{"type":"integer","default":1,"minimum":1}},"itemsOnPage":{"name":"_itemsOnPage","in":"query","description":"Items on one page","required":false,"schema":{"type":"integer","default":10,"maximum":50,"minimum":1}},"orderBy":{"name":"_orderBy","in":"query","description":"Sorting order. If sorting is not chosen, the rows will be returned in an unspecified order. Sort order: * `asc` - Ascending, from A to Z * `desc` - Descending, from Z to A","required":false,"style":"deepObject","explode":true,"schema":{"type":"object","additionalProperties":{"type":"string","enum":["asc","desc"]}}}},"schemas":{"AvailableCampaign":{"required":["campaignId","name","active","activity","rules","translations","createdAt","displayOrder","labels","type","trigger","limitReached","limits","memberFilter","limitUsages"],"properties":{"campaignId":{"type":"string","format":"uuid"},"active":{"type":"boolean"},"activity":{"required":["startsAt"],"properties":{"startsAt":{"type":"string"},"endsAt":{"type":"string","nullable":true}},"type":"object","additionalProperties":false},"rules":{"type":"array","items":{"required":["conditions","effects"],"properties":{"conditions":{"type":"array","items":{"properties":{"operator":{"type":"string"},"data":{"type":"array","items":{"type":"string"}},"attribute":{"type":"string"}},"type":"object"}},"effects":{"type":"array","items":{"required":["effect"],"properties":{"effect":{"type":"string"},"pointsRule":{"type":"string"}},"type":"object"}}},"type":"object"}},"limits":{"$ref":"#/components/schemas/Limit"},"translations":{"type":"array","items":{"required":["id","name","locale"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"id":{"type":"integer"},"locale":{"type":"string"}},"type":"object","additionalProperties":false}},"createdAt":{"type":"string","format":"date-time"},"memberFilter":{"type":"object"},"displayOrder":{"type":"number"},"labels":{"type":"array","items":{"required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object","additionalProperties":false}},"multiLevel":{"type":"number"},"codeGenerator":{"type":"object"},"eventCodeAttribute":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"trigger":{"type":"string"},"event":{"type":"string"},"achievementId":{"type":"string","format":"uuid"},"relatedAchievement":{"$ref":"#/components/schemas/RelatedAchievement"},"limitReached":{"description":"This property indicates whether the limit for campaign is reached by member","type":"boolean"},"limitUsages":{"properties":{"points":{"description":"These fields are not updated immediately after the status changes.","properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer","deprecated":true}},"type":"object"}},"type":"object"}},"type":"object"}},"type":"object","additionalProperties":false},"Limit":{"properties":{"points":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"},"pointsPerMember":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"},"executionsPerMember":{"required":["value"],"properties":{"interval":{"properties":{"type":{"type":"string"},"value":{"type":"integer","deprecated":true}},"type":"object"},"value":{"type":"number","format":"float"}},"type":"object"}},"type":"object"},"RelatedAchievement":{"properties":{"achievementId":{"type":"string","format":"uuid"},"achievementName":{"type":"string"},"limitReached":{"description":"This property indicates whether the limit for achievement is reached by member","type":"boolean"},"memberProgress":{"$ref":"#/components/schemas/MemberAchievementProgress"},"lastTrigger":{"description":"Last trigger which triggered related achievement","properties":{"triggerId":{"type":"string","format":"uuid"},"triggerType":{"type":"string","enum":["transaction","custom_event"]}},"type":"object"}},"type":"object","deprecated":true},"MemberAchievementProgress":{"properties":{"completedCount":{"type":"integer"},"rules":{"type":"array","items":{"properties":{"achievementRuleId":{"type":"string"},"periodGoal":{"type":"number","format":"float"},"currentPeriodValue":{"type":"number","format":"float"},"consecutivePeriods":{"type":"integer"},"completedConsecutivePeriods":{"type":"integer"},"periodType":{"type":"string"},"type":{"type":"string"},"trigger":{"type":"string"},"periodValue":{"type":"number","format":"float"}},"type":"object"}}},"type":"object"},"SearchableTotalResponse":{"required":["all","filtered","estimated"],"properties":{"all":{"type":"integer","deprecated":true},"filtered":{"type":"integer","deprecated":true},"estimated":{"description":"Field estimated is used to show that the results are estimated. It might happen when there are more than 5000 results due to performance optimization.","type":"boolean","deprecated":true}},"type":"object","deprecated":true},"MemberAvailableCampaign":{"required":["campaignId","translations","name","limitReached"],"properties":{"campaignId":{"type":"string","format":"uuid"},"translations":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"id":{"type":"integer"},"locale":{"type":"string"}},"type":"object"}},"name":{"type":"string"},"description":{"type":"string"},"relatedAchievement":{"$ref":"#/components/schemas/RelatedAchievement"},"limitReached":{"description":"This property indicates if the campaign is available to a member","type":"boolean"},"limitUsages":{"properties":{"pointsPerMember":{"properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer","deprecated":true}},"type":"object"}},"type":"object"},"executionsPerMember":{"properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer","deprecated":true}},"type":"object"}},"type":"object"}},"type":"object"}},"type":"object","additionalProperties":false},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/member/{member}/campaign":{"get":{"tags":["Campaign"],"summary":"Get a list of available campaigns for the member.","description":"<label style=\"background-color: #BFE1F6;padding:5px;\">Integration</label><br><br>\nThis method returns all active Campaigns for Member.\nThe logged in member can only see their own available campaigns.\nEndpoint returns all active campaigns, for campaigns that have not reached the limit it adds `\"limitReached\": false`,\nand for campaigns that have reached the limit `\"limitReached\": true`.\nIf there is a dynamic effect in the campaign, the endpoint may return that the\ncampaign limit is not reached, although the effect may exceed the limit and points will not be awarded \nIf sorting is not chosen, the rows will be returned in an unspecified order.\nTo sort a result, use an `_orderBy` parameter in query.\n","operationId":"_campaignAvailableMember","parameters":[{"$ref":"#/components/parameters/storeCode"},{"name":"member","in":"path","required":true,"schema":{"type":"string","pattern":"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|email=[a-zA-Z0-9!#$%&'\\.*+\\-@=?^_{|}~;]+|phone=[0-9+]+|loyaltyCardNumber=[0-9a-zA-Z\\._-]+"}},{"name":"type","in":"query","required":false,"style":"deepObject","explode":true,"schema":{"type":"string"}},{"name":"trigger","in":"query","required":false,"style":"deepObject","explode":true,"schema":{"type":"string"}},{"name":"event","in":"query","required":false,"style":"deepObject","explode":true,"schema":{"type":"string"}},{"name":"campaignId","in":"query","required":false,"style":"deepObject","explode":true,"schema":{"type":"string"}},{"name":"showAll","in":"query","description":"This parameter allows to show all campaign even not active","required":false,"style":"deepObject","explode":true,"schema":{"type":"boolean"}},{"name":"name","in":"query","description":"Campaign name","required":false,"style":"deepObject","explode":true,"schema":{"type":"string"}},{"name":"startsAt","in":"query","required":false,"style":"deepObject","explode":true,"schema":{"type":"string","format":"date-time"}},{"name":"endsAt","in":"query","required":false,"style":"deepObject","explode":true,"schema":{"type":"string","format":"date-time"}},{"name":"labels","in":"query","description":"Filter with Campaign custom attributes.\n\nExample: `labels=(key;value)`\n","required":false,"style":"deepObject","explode":true,"schema":{"type":"string"}},{"name":"format","in":"query","description":"If set to html, the descriptions will be in HTML format. Omit for raw output.","required":false,"style":"deepObject","explode":true,"schema":{"type":"string","format":"html|raw"}},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/itemsOnPage"},{"$ref":"#/components/parameters/orderBy"}],"responses":{"200":{"description":"List of available member campaigns.","content":{"application/json":{"schema":{"oneOf":[{"title":"AvailableCampaign","required":["items","total"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AvailableCampaign"}},"total":{"$ref":"#/components/schemas/SearchableTotalResponse"}},"type":"object","additionalProperties":false},{"title":"MemberAvailableCampaign","required":["items","total"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/MemberAvailableCampaign"}},"total":{"$ref":"#/components/schemas/SearchableTotalResponse"}},"type":"object","additionalProperties":false}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"}}}}}}
````

## Get a list of visible campaigns for the member

> \<label style="background-color: #BFE1F6;padding:5px;">Integration\</label>\<br>\<br><br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"member":{"name":"member","in":"path","description":"Member ID","required":true,"schema":{"type":"string","format":"uuid"}},"page":{"name":"_page","in":"query","description":"Number of page with results, starts from 1","required":false,"schema":{"type":"integer","default":1,"minimum":1}},"itemsOnPage":{"name":"_itemsOnPage","in":"query","description":"Items on one page","required":false,"schema":{"type":"integer","default":10,"maximum":50,"minimum":1}},"orderBy":{"name":"_orderBy","in":"query","description":"Sorting order. If sorting is not chosen, the rows will be returned in an unspecified order. Sort order: * `asc` - Ascending, from A to Z * `desc` - Descending, from Z to A","required":false,"style":"deepObject","explode":true,"schema":{"type":"object","additionalProperties":{"type":"string","enum":["asc","desc"]}}}},"schemas":{"VisibleCampaign":{"required":["campaignId","active","activity","translations","createdAt","type","trigger"],"properties":{"campaignId":{"type":"string","format":"uuid"},"name":{"type":"string"},"active":{"type":"boolean"},"activity":{"$ref":"#/components/schemas/Activity"},"translations":{"type":"object","additionalProperties":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"}},"additionalProperties":false}},"description":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"type":{"type":"string"},"trigger":{"type":"string"}},"type":"object","additionalProperties":false},"Activity":{"properties":{"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"}},"type":"object"},"SearchableTotalResponse":{"required":["all","filtered","estimated"],"properties":{"all":{"type":"integer","deprecated":true},"filtered":{"type":"integer","deprecated":true},"estimated":{"description":"Field estimated is used to show that the results are estimated. It might happen when there are more than 5000 results due to performance optimization.","type":"boolean","deprecated":true}},"type":"object","deprecated":true},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/member/{member}/campaign/visible":{"get":{"tags":["Campaign"],"summary":"Get a list of visible campaigns for the member","description":"<label style=\"background-color: #BFE1F6;padding:5px;\">Integration</label><br><br>\n","operationId":"campaignVisibleMember","parameters":[{"$ref":"#/components/parameters/storeCode"},{"$ref":"#/components/parameters/member"},{"name":"campaignId","in":"query","description":"Campaign ID","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"name","in":"query","description":"Campaign name","required":false,"schema":{"type":"string"}},{"name":"trigger","in":"query","description":"Campaign trigger","required":false,"schema":{"type":"string"}},{"name":"startsAt","in":"query","description":"Campaign start date","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"endsAt","in":"query","description":"Campaign end date","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"active","in":"query","description":"Campaign active status","required":false,"schema":{"type":"boolean"}},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/itemsOnPage"},{"$ref":"#/components/parameters/orderBy"}],"responses":{"200":{"description":"List of visible member campaigns.","content":{"application/json":{"schema":{"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/VisibleCampaign"}},"total":{"$ref":"#/components/schemas/SearchableTotalResponse"}},"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"}}}}}}
````

## Get redemption codes list

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br><br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"page":{"name":"_page","in":"query","description":"Number of page with results, starts from 1","required":false,"schema":{"type":"integer","default":1,"minimum":1}},"itemsOnPage":{"name":"_itemsOnPage","in":"query","description":"Items on one page","required":false,"schema":{"type":"integer","default":10,"maximum":50,"minimum":1}},"orderBy":{"name":"_orderBy","in":"query","description":"Sorting order. If sorting is not chosen, the rows will be returned in an unspecified order. Sort order: * `asc` - Ascending, from A to Z * `desc` - Descending, from Z to A","required":false,"style":"deepObject","explode":true,"schema":{"type":"object","additionalProperties":{"type":"string","enum":["asc","desc"]}}}},"schemas":{"CampaignCode":{"properties":{"codeId":{"type":"string"},"code":{"type":"string"},"status":{"type":"string"},"usedAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"}},"type":"object"},"SearchableTotalResponse2":{"properties":{"all":{"type":"integer","deprecated":true},"filtered":{"type":"integer","deprecated":true},"estimated":{"description":"Field estimated is used to show that the results are estimated. It might happen when there are more than 5000 results due to performance optimization.","type":"boolean","deprecated":true}},"type":"object","deprecated":true},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/campaign/{campaign}/codes":{"get":{"tags":["Campaign"],"summary":"Get redemption codes list","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\n","operationId":"campaignCodesGetList","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string"}},{"name":"code","in":"query","required":false,"schema":{"type":"string"}},{"name":"codeId","in":"query","required":false,"schema":{"type":"string"}},{"name":"usedAt","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"createdAt","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/itemsOnPage"},{"$ref":"#/components/parameters/orderBy"},{"name":"storeCode","in":"path","required":true,"schema":{"type":"string"}},{"name":"campaign","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Codes","content":{"application/json":{"schema":{"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CampaignCode"}},"total":{"$ref":"#/components/schemas/SearchableTotalResponse2"}},"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Generate redemption codes

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br><br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"campaign":{"name":"campaign","in":"path","description":"Campaign ID","required":true,"schema":{"type":"string","format":"uuid"}}},"schemas":{"PostGenerateCodes":{"properties":{"generate":{"required":["numberOfCodes"],"properties":{"numberOfCodes":{"type":"integer"}},"type":"object"}},"type":"object"},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"NoContent":{"description":"Success. No content."},"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/campaign/{campaign}/codes/generate":{"post":{"tags":["Campaign"],"summary":"Generate redemption codes","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\n","operationId":"campaignCodesPost","parameters":[{"$ref":"#/components/parameters/storeCode"},{"$ref":"#/components/parameters/campaign"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostGenerateCodes"}}}},"responses":{"204":{"$ref":"#/components/responses/NoContent"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Simulate campaigns result

> \<label style="background-color: #BFE1F6;padding:5px;">Integration\</label>\<br>\<br>\
> This method returns detailed information about all Campaigns created in the system.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}}},"schemas":{"SimulateFormType":{"required":["trigger"],"properties":{"trigger":{"type":"string","enum":["transaction","custom_event","internal_event","return_transaction"]},"customer":{"$ref":"#/components/schemas/SimulatedCustomer"},"referrer":{"$ref":"#/components/schemas/SimulatedCustomer"}},"type":"object"},"SimulatedCustomer":{"properties":{"id":{"description":"Unique Member identifier. Specifying an existing ID will cause the simulation to fetch the specific Member data for simulation purposes.","type":"string","format":"uuid"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"birthDate":{"type":"string"},"address":{"$ref":"#/components/schemas/CustomerAddressFormType"},"loyaltyCardNumber":{"type":"string"},"legalConsent":{"type":"boolean"},"marketingConsent":{"type":"boolean"},"dataProcessingConsent":{"type":"boolean"},"gender":{"type":"string"},"registeredDate":{"type":"string"},"firstTransactionDate":{"type":"string"},"lastTransactionDate":{"type":"string"},"levelAchievementDate":{"type":"string"},"levelId":{"type":"string","format":"uuid"},"tiers":{"type":"array","items":{"type":"string","format":"uuid"}},"numberOfPurchases":{"type":"string"},"purchaseAmount":{"type":"string"},"averagePurchaseAmount":{"type":"string"},"activePoints":{"type":"string"},"spentPoints":{"type":"string"},"earnedPoints":{"type":"string"},"lockedPoints":{"type":"string"},"blockedPoints":{"type":"string"},"expiredPoints":{"type":"string"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"segments":{"type":"array","items":{"type":"string","format":"uuid"}}},"type":"object"},"CustomerAddressFormType":{"properties":{"street":{"type":"string"},"address1":{"type":"string"},"address2":{"type":"string"},"postal":{"type":"string"},"city":{"type":"string"},"province":{"type":"string"},"country":{"description":"The country code in ISO 3166-1 alpha-2 format. This should be a two-letter uppercase string representing a valid country code. Examples:  - `US` (United States) - `PL` (Poland)","type":"string"}},"type":"object"},"SimulatedTransaction":{"required":["documentNumber","purchasedAt"],"properties":{"id":{"type":"string","format":"uuid"},"grossValue":{"deprecated":true,"oneOf":[{"type":"string"},{"type":"number"}]},"documentNumber":{"type":"string"},"linkedDocumentNumber":{"description":"Required only for `documentType = return`. The field indicates the transaction you want to return","type":"string"},"documentType":{"type":"string","enum":["sell","return"]},"purchasedAt":{"type":"string"},"purchasePlace":{"type":"string"},"shippingCity":{"type":"string","deprecated":true},"channelId":{"type":"string","format":"uuid"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}},"items":{"type":"array","items":{"properties":{"sku":{"type":"string"},"name":{"type":"string"},"qty":{"oneOf":[{"type":"string"},{"type":"number"}]},"grossValue":{"oneOf":[{"type":"string"},{"type":"number"}]},"category":{"type":"string"},"maker":{"type":"string"},"labels":{"type":"array","items":{"properties":{"key":{"type":"string"},"value":{"type":"string"}},"type":"object"}}},"type":"object"}}},"type":"object","additionalProperties":false},"SimulatedCustomEvent":{"required":["type","eventDate"],"properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string"},"eventDate":{"type":"string"},"body":{"type":"object"}},"type":"object","additionalProperties":false},"SimulatedInternalEvent":{"required":["type","eventDate"],"properties":{"type":{"type":"string"},"eventDate":{"type":"string"},"body":{"type":"object"}},"type":"object","additionalProperties":false},"SimulateResult":{"required":["effects","evaluationWarnings"],"properties":{"effects":{"type":"array","items":{"required":["type","target","campaign"],"properties":{"type":{"type":"string","enum":["give_points","give_reward","deduct_unit","assign_member_custom_attribute","remove_member_custom_attribute","grant_badge","cancel_transaction_effects"]},"campaign":{"$ref":"#/components/schemas/Campaign"},"points":{"type":"number","format":"float"},"wallet":{"type":"string"},"rewardId":{"type":"string"},"expression":{"type":"string"},"badgeSystemCode":{"type":"string"},"target":{"type":"string","enum":["self","referrer"]}},"type":"object","additionalProperties":false}},"evaluationWarnings":{"type":"array","items":{"required":["campaignId","message"],"properties":{"campaignId":{"type":"string","format":"uuid"},"message":{"type":"string"}},"type":"object","additionalProperties":false}},"simulatedMember":{"required":["memberId"],"properties":{"memberId":{"type":"string","format":"uuid"},"wallets":{"type":"array","items":{"properties":{"walletId":{"type":"string","format":"uuid","nullable":true},"walletType":{"properties":{"code":{"type":"string"},"name":{"type":"string"},"isDefault":{"type":"boolean"},"active":{"type":"boolean"},"unitSingularName":{"type":"string"},"unitPluralName":{"type":"string"},"rewardSpending":{"type":"boolean"}},"type":"object","additionalProperties":false},"account":{"properties":{"activeUnits":{"type":"number","format":"float"}},"type":"object"}},"type":"object","additionalProperties":false}}},"type":"object","nullable":true,"additionalProperties":false}},"type":"object","additionalProperties":false},"Campaign":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"trigger":{"type":"string"},"campaignId":{"type":"string","format":"uuid"},"activity":{"properties":{"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time","nullable":true}},"type":"object"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"displayOrder":{"type":"number"},"rules":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"conditions":{"type":"array","items":{"properties":{"operator":{"type":"string"},"data":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}}]},"attribute":{"type":"string"}},"type":"object"}},"effects":{"type":"array","items":{"properties":{"effect":{"type":"string"},"pointsRule":{"type":"string"},"unitsExpirationDateRule":{"properties":{"expirationStrategy":{"type":"string"},"expression":{"type":"string"}},"type":"object"}},"type":"object"}}},"type":"object"}},"labels":{"type":"array","items":{"properties":{"key":{"type":"string","minLength":1},"value":{"type":"string","minLength":1}},"type":"object"}},"translations":{"type":"array","items":{"properties":{"name":{"type":"string"},"description":{"type":"string"},"id":{"type":"integer"},"locale":{"type":"string"}},"type":"object"}},"limitUsages":{"properties":{"points":{"properties":{"currentValue":{"type":"number","format":"float"},"limitValue":{"type":"number","format":"float"},"remaining":{"type":"number","format":"float"},"interval":{"properties":{"type":{"type":"string","enum":["calendarHours","calendarDays","calendarWeeks","calendarMonths","calendarYears"]},"value":{"type":"integer"}},"type":"object"}},"type":"object"}},"type":"object"},"triggerStrategy":{"$ref":"#/components/schemas/TriggerStrategy"}},"type":"object"},"TriggerStrategy":{"properties":{"type":{"type":"string","enum":["birthday","registration_anniversary","daily","weekly","monthly"]},"executionSchedule":{"description":"Required for `weekly` and `monthly` type of campaign.","properties":{"dayOfWeek":{"description":"List of days when campaign should be executed. 0 for Sunday, 6 for Saturday.","type":"array","items":{"type":"integer","enum":[0,1,2,3,4,5,6]},"nullable":true},"dayOfMonth":{"description":"List of month days when campaign should be executed. 'L' for the last day of the month.","type":"array","items":{"oneOf":[{"type":"integer","enum":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]},{"type":"string","enum":["L"]}]},"nullable":true}},"type":"object","nullable":true}},"type":"object"},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/campaign/simulate":{"post":{"tags":["Campaign"],"summary":"Simulate campaigns result","description":"<label style=\"background-color: #BFE1F6;padding:5px;\">Integration</label><br><br>\nThis method returns detailed information about all Campaigns created in the system.\n","operationId":"_campaignPostSimulate","parameters":[{"$ref":"#/components/parameters/storeCode"}],"requestBody":{"description":"","content":{"application/json":{"schema":{"oneOf":[{"title":"CampaignTransaction","properties":{"simulate":{"required":["transaction"],"allOf":[{"$ref":"#/components/schemas/SimulateFormType"},{"properties":{"transaction":{"$ref":"#/components/schemas/SimulatedTransaction"}},"type":"object"}],"additionalProperties":false}},"type":"object"},{"title":"CampaignCustomEvent","required":["simulate"],"properties":{"simulate":{"required":["custom_event"],"allOf":[{"$ref":"#/components/schemas/SimulateFormType"},{"properties":{"custom_event":{"$ref":"#/components/schemas/SimulatedCustomEvent"}},"type":"object"}],"additionalProperties":false}},"type":"object","additionalProperties":false},{"title":"CampaignInternalEvent","properties":{"simulate":{"required":["internal_event"],"allOf":[{"$ref":"#/components/schemas/SimulateFormType"},{"properties":{"internal_event":{"$ref":"#/components/schemas/SimulatedInternalEvent"}},"type":"object"}],"additionalProperties":false}},"type":"object"}]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimulateResult"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Get campaign leaderboard

> \<label style="background-color: #BFE1F6;padding:5px;">Integration\</label>\<br>\<br>\
> This method returns the leaderboard for a specific campaign, showing members ranked by their scores.\<br>\<br><br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"campaign":{"name":"campaign","in":"path","description":"Campaign ID","required":true,"schema":{"type":"string","format":"uuid"}}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/campaign/{campaign}/leaderboard":{"get":{"tags":["Campaign"],"summary":"Get campaign leaderboard","description":"<label style=\"background-color: #BFE1F6;padding:5px;\">Integration</label><br><br>\nThis method returns the leaderboard for a specific campaign, showing members ranked by their scores.<br><br>\n","operationId":"campaignLeaderboardGet","parameters":[{"$ref":"#/components/parameters/storeCode"},{"$ref":"#/components/parameters/campaign"},{"name":"type","in":"query","description":"The type of cycle for which the ranking is to be returned.","required":false,"style":"deepObject","explode":true,"schema":{"type":"string"}},{"name":"group","in":"query","description":"Scope the ranking to a single group of a grouped leaderboard. Required for grouped leaderboards — calling the endpoint without `group` on a grouped leaderboard returns an empty list (`items: []`, `total.all: 0`). Ignored for non-grouped leaderboards. Only the EQUAL operator is accepted; operators like `[neq]` are rejected with HTTP 400. Maximum length: 255.\n","required":false,"schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Campaign leaderboard with member rankings.","content":{"application/json":{"schema":{"properties":{"items":{"type":"array","items":{"properties":{"member":{"properties":{"customerId":{"type":"string","format":"uuid"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"loyaltyCardNumber":{"type":"string"}},"type":"object"},"ranking":{"properties":{"score":{"description":"Member's score in the leaderboard","type":"number","format":"float"},"recalculatedAt":{"description":"When the position was last recalculated","type":"string","format":"date-time"},"position":{"description":"Current position in the leaderboard","type":"integer"},"changedPositionAt":{"description":"When the position changed or initial date","type":"string","format":"date-time"},"progress":{"properties":{"general":{"description":"Position change since the beginning of the leaderboard","type":"integer"},"recalculated":{"description":"Position change since the last recalculation","type":"integer"},"period":{"description":"Position change since the last reset","type":"integer"}},"type":"object"}},"type":"object"}},"type":"object"}},"total":{"properties":{"all":{"description":"Total number of members in the leaderboard","type":"integer"},"filtered":{"description":"Number of members after applying filters","type":"integer"},"estimated":{"description":"Whether the total count is estimated","type":"boolean"}},"type":"object"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## List distinct group values for a grouped leaderboard

> \<label style="background-color: #BFE1F6;padding:5px;">Integration\</label>\<br>\<br>\
> Returns the distinct group values present on the leaderboard's currently running iteration. Use these values to populate the \`group\` query parameter of the leaderboard ranking endpoint.\<br>\<br>\
> Returns an empty list when: - the campaign's leaderboard is not grouped, - no iteration is currently running (the leaderboard hasn't started or just\
> &#x20; completed),\
> \- the running iteration has no ranking rows yet.\<br>\<br>\
> Returns 404 when the campaign does not exist for the given store, is not a leaderboard campaign, or belongs to a different tenant.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"campaign":{"name":"campaign","in":"path","description":"Campaign ID","required":true,"schema":{"type":"string","format":"uuid"}}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/campaign/{campaign}/leaderboard/group":{"get":{"tags":["Campaign"],"summary":"List distinct group values for a grouped leaderboard","description":"<label style=\"background-color: #BFE1F6;padding:5px;\">Integration</label><br><br>\nReturns the distinct group values present on the leaderboard's currently running iteration. Use these values to populate the `group` query parameter of the leaderboard ranking endpoint.<br><br>\nReturns an empty list when: - the campaign's leaderboard is not grouped, - no iteration is currently running (the leaderboard hasn't started or just\n  completed),\n- the running iteration has no ranking rows yet.<br><br>\nReturns 404 when the campaign does not exist for the given store, is not a leaderboard campaign, or belongs to a different tenant.\n","operationId":"campaignLeaderboardGroupGet","parameters":[{"$ref":"#/components/parameters/storeCode"},{"$ref":"#/components/parameters/campaign"},{"name":"name[startsWith]","in":"query","description":"Case-insensitive, left-anchored prefix filter on the group value (matches `value%`). Only the `startsWith` operator is supported — a disallowed operator such as `name[like]` returns HTTP 400. The short form `name=<prefix>` is treated identically to `name[startsWith]=<prefix>`.\n","required":false,"schema":{"type":"string"}},{"name":"_page","in":"query","description":"1-based page index.","required":false,"schema":{"type":"integer","minimum":1,"default":1}},{"name":"_itemsOnPage","in":"query","description":"Page size.","required":false,"schema":{"type":"integer","minimum":1,"default":10}},{"name":"_orderBy[groupValue]","in":"query","description":"Sort direction for the `groupValue` column. Only `asc` and `desc` are accepted.","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"asc"}}],"responses":{"200":{"description":"Distinct group values for the running iteration.","content":{"application/json":{"schema":{"properties":{"items":{"type":"array","items":{"type":"string"}},"total":{"properties":{"all":{"description":"Total number of distinct group values, ignoring the name filter.","type":"integer"},"filtered":{"description":"Number of distinct group values after applying the name filter.","type":"integer"},"estimated":{"description":"Whether the total count is estimated.","type":"boolean"}},"type":"object"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Get member's ranking in a specific campaign

> \<label style="background-color: #BFE1F6;padding:5px;">Integration\</label>\<br>\<br>\
> This method returns detailed information about a member's ranking in a specific campaign, including surrounding members.\<br>\<br><br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"campaign":{"name":"campaign","in":"path","description":"Campaign ID","required":true,"schema":{"type":"string","format":"uuid"}}},"responses":{"Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/campaign/{campaign}/leaderboard/member/{member}":{"get":{"tags":["Campaign"],"summary":"Get member's ranking in a specific campaign","description":"<label style=\"background-color: #BFE1F6;padding:5px;\">Integration</label><br><br>\nThis method returns detailed information about a member's ranking in a specific campaign, including surrounding members.<br><br>\n","operationId":"campaignMemberLeaderboardGet","parameters":[{"$ref":"#/components/parameters/storeCode"},{"$ref":"#/components/parameters/campaign"},{"name":"member","in":"path","description":"Member identifier (UUID)","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"type","in":"query","description":"The type of cycle for which the ranking is to be returned.","required":false,"style":"deepObject","explode":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Member's ranking details with surrounding members.","content":{"application/json":{"schema":{"properties":{"groupValue":{"description":"Group label the member is ranked under for grouped leaderboards (e.g. the city or custom attribute value). Empty string for non-grouped leaderboards. Members with no resolvable group value on a grouped leaderboard are not found here (404).\n","type":"string"},"score":{"description":"Member's score in the campaign","type":"number","format":"float"},"recalculatedAt":{"description":"When the position was last recalculated","type":"string","format":"date-time"},"position":{"description":"Current position in the leaderboard","type":"integer"},"changedPositionAt":{"description":"When the position changed or initial date","type":"string","format":"date-time"},"progress":{"properties":{"general":{"description":"Position change since the beginning of the leaderboard","type":"integer"},"recalculated":{"description":"Position change since the last recalculation","type":"integer"},"period":{"description":"Position change since the last reset","type":"integer"}},"type":"object"},"surrounding":{"properties":{"higher":{"description":"Members ranked higher than the current member","type":"array","items":{"properties":{"member":{"properties":{"customerId":{"type":"string","format":"uuid"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"loyaltyCardNumber":{"type":"string"}},"type":"object"},"ranking":{"properties":{"score":{"description":"Member's score in the campaign","type":"number","format":"float"},"recalculatedAt":{"description":"When the position was last recalculated","type":"string","format":"date-time"},"position":{"description":"Current position in the leaderboard","type":"integer"},"changedPositionAt":{"description":"When the position changed or initial date","type":"string","format":"date-time"},"progress":{"properties":{"general":{"description":"Position change since the beginning of the leaderboard","type":"integer"},"recalculated":{"description":"Position change since the last recalculation","type":"integer"},"period":{"description":"Position change since the last reset","type":"integer"}},"type":"object"}},"type":"object"}},"type":"object"}},"lower":{"description":"Members ranked lower than the current member","type":"array","items":{"properties":{"member":{"properties":{"customerId":{"type":"string","format":"uuid"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"loyaltyCardNumber":{"type":"string"}},"type":"object"},"ranking":{"properties":{"score":{"description":"Member's score in the campaign","type":"number","format":"float"},"recalculatedAt":{"description":"When the position was last recalculated","type":"string","format":"date-time"},"position":{"description":"Current position in the leaderboard","type":"integer"},"changedPositionAt":{"description":"When the position changed or initial date","type":"string","format":"date-time"},"progress":{"properties":{"general":{"description":"Position change since the beginning of the leaderboard","type":"integer"},"recalculated":{"description":"Position change since the last recalculation","type":"integer"},"period":{"description":"Position change since the last reset","type":"integer"}},"type":"object"}},"type":"object"}},"type":"object"}}},"type":"object"}},"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Get member's challenge status

> \<label style="background-color: #D4EDBC;padding:5px;">Integration\</label>\<br>\<br><br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"page":{"name":"_page","in":"query","description":"Number of page with results, starts from 1","required":false,"schema":{"type":"integer","default":1,"minimum":1}},"itemsOnPage":{"name":"_itemsOnPage","in":"query","description":"Items on one page","required":false,"schema":{"type":"integer","default":10,"maximum":50,"minimum":1}},"orderBy":{"name":"_orderBy","in":"query","description":"Sorting order. If sorting is not chosen, the rows will be returned in an unspecified order. Sort order: * `asc` - Ascending, from A to Z * `desc` - Descending, from Z to A","required":false,"style":"deepObject","explode":true,"schema":{"type":"object","additionalProperties":{"type":"string","enum":["asc","desc"]}}}},"schemas":{"MemberChallenge":{"properties":{"campaignId":{"type":"string","format":"uuid"},"campaignName":{"type":"string"},"campaignDescription":{"type":"string"},"limitReached":{"type":"boolean"},"memberProgress":{"$ref":"#/components/schemas/MemberChallengeProgress"}},"type":"object"},"MemberChallengeProgress":{"properties":{"completedCount":{"type":"integer"},"milestones":{"type":"array","items":{"properties":{"milestoneId":{"type":"string"},"periodGoal":{"type":"number","format":"float"},"currentPeriodValue":{"type":"number","format":"float"},"consecutivePeriods":{"type":"integer"},"completedConsecutivePeriods":{"type":"integer"},"periodType":{"type":"string"},"type":{"type":"string"},"trigger":{"type":"string"},"periodValue":{"type":"number","format":"float"}},"type":"object"}}},"type":"object"},"SearchableTotalResponse":{"required":["all","filtered","estimated"],"properties":{"all":{"type":"integer","deprecated":true},"filtered":{"type":"integer","deprecated":true},"estimated":{"description":"Field estimated is used to show that the results are estimated. It might happen when there are more than 5000 results due to performance optimization.","type":"boolean","deprecated":true}},"type":"object","deprecated":true},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/member/{member}/challenge":{"get":{"tags":["Campaign"],"summary":"Get member's challenge status","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Integration</label><br><br>\n","operationId":"challengeProgressMember","parameters":[{"$ref":"#/components/parameters/storeCode"},{"name":"member","in":"path","required":true,"schema":{"type":"string","pattern":"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|email=[a-zA-Z0-9!#$%&'\\.*+\\-@=?^_`{|}~;]+|phone=[0-9+]+|loyaltyCardNumber=[0-9a-zA-Z\\._-]+"}},{"name":"name","in":"query","required":false,"schema":{"type":"string"}},{"name":"createdAt","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"campaignId","in":"query","required":false,"schema":{"type":"string"}},{"name":"completionCount","in":"query","required":false,"schema":{"type":"integer"}},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/itemsOnPage"},{"$ref":"#/components/parameters/orderBy"}],"responses":{"200":{"description":"List of active challenge progress for member","content":{"application/json":{"schema":{"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/MemberChallenge"}},"total":{"$ref":"#/components/schemas/SearchableTotalResponse"}},"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Get member's challenge triggers list

> \<label style="background-color: #D4EDBC;padding:5px;">Integration\</label>\<br>\<br>\
> This endpoint provides a log of all events that contributed to the progress of a member's challenge.\
> \
> If sorting is not chosen, the rows will be returned in an unspecified order.\
> To sort a result, use an \`\_orderBy\` parameter in query.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"page":{"name":"_page","in":"query","description":"Number of page with results, starts from 1","required":false,"schema":{"type":"integer","default":1,"minimum":1}},"itemsOnPage":{"name":"_itemsOnPage","in":"query","description":"Items on one page","required":false,"schema":{"type":"integer","default":10,"maximum":50,"minimum":1}},"orderBy":{"name":"_orderBy","in":"query","description":"Sorting order. If sorting is not chosen, the rows will be returned in an unspecified order. Sort order: * `asc` - Ascending, from A to Z * `desc` - Descending, from Z to A","required":false,"style":"deepObject","explode":true,"schema":{"type":"object","additionalProperties":{"type":"string","enum":["asc","desc"]}}}},"schemas":{"SearchableTotalResponse":{"required":["all","filtered","estimated"],"properties":{"all":{"type":"integer","deprecated":true},"filtered":{"type":"integer","deprecated":true},"estimated":{"description":"Field estimated is used to show that the results are estimated. It might happen when there are more than 5000 results due to performance optimization.","type":"boolean","deprecated":true}},"type":"object","deprecated":true},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/challenge/trigger/member/{member}":{"get":{"tags":["Campaign"],"summary":"Get member's challenge triggers list","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Integration</label><br><br>\nThis endpoint provides a log of all events that contributed to the progress of a member's challenge.\n\nIf sorting is not chosen, the rows will be returned in an unspecified order.\nTo sort a result, use an `_orderBy` parameter in query.\n","operationId":"_challengeMemberTriggers","parameters":[{"$ref":"#/components/parameters/storeCode"},{"name":"member","in":"path","required":true,"schema":{"type":"string","pattern":"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|email=[a-zA-Z0-9!#$%&'\\.*+\\-@=?^_`{|}~;]+|phone=[0-9+]+|loyaltyCardNumber=[0-9a-zA-Z\\._-]+"}},{"name":"campaignId","in":"query","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"milestoneId","in":"query","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"triggerId","in":"query","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"createdAt","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/itemsOnPage"},{"$ref":"#/components/parameters/orderBy"}],"responses":{"200":{"description":"List of challenge triggers for a member","content":{"application/json":{"schema":{"properties":{"items":{"type":"array","items":{"required":["milestoneId","triggerId","createdAt"],"properties":{"milestoneId":{"type":"string","format":"uuid"},"milestoneName":{"type":"string","nullable":true},"triggerId":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"campaignId":{"type":"string","format":"uuid","nullable":true},"campaignName":{"type":"string","nullable":true}},"type":"object","additionalProperties":false}},"total":{"$ref":"#/components/schemas/SearchableTotalResponse"}},"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Update challenge progress for member

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br><br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Campaign","description":"These endpoints will allow you to easily manage campaigns."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}}},"schemas":{"UpdateMemberChallengeProgressFormType":{"properties":{"completedCount":{"type":"integer"},"milestones":{"type":"array","items":{"required":["milestoneId","currentPeriodValue"],"properties":{"milestoneId":{"type":"string","format":"uuid"},"currentPeriodValue":{"type":"number","format":"float"},"completedConsecutivePeriods":{"type":"integer"}},"type":"object"}}},"type":"object"},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"NoContent":{"description":"Success. No content."},"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/member/{member}/challenge/{challenge}/progress":{"patch":{"tags":["Campaign"],"summary":"Update challenge progress for member","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\n","operationId":"challengeProgressMemberPatch","parameters":[{"$ref":"#/components/parameters/storeCode"},{"name":"challenge","in":"path","description":"Challenge campaign ID","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"member","in":"path","required":true,"schema":{"type":"string","pattern":"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|email=[a-zA-Z0-9!#$%&'\\.*+\\-@=?^_{|}~;]+|phone=[0-9+]+|loyaltyCardNumber=[0-9a-zA-Z\\._-]+"}}],"requestBody":{"description":"","content":{"application/json":{"schema":{"properties":{"memberProgress":{"allOf":[{"$ref":"#/components/schemas/UpdateMemberChallengeProgressFormType"},{"properties":{"milestones":{"type":"array","items":{"required":["milestoneId","currentPeriodValue"],"properties":{"milestoneId":{"type":"string","format":"uuid"},"currentPeriodValue":{"type":"number","format":"float"},"completedConsecutivePeriods":{"type":"integer"}},"type":"object"}}},"type":"object"}]}},"type":"object"}}}},"responses":{"204":{"$ref":"#/components/responses/NoContent"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.openloyalty.io/api-reference/campaign.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
