Snag Docs logo

Create new badge

This endpoint allows you to configure a new badge

POSThttps://admin.snagsolutions.io/api/loyalty/badges

This endpoint allows you to configure a new badge

Loading code example
Loading code example

Authorizations

apiKeyAuthstringheaderrequired

API key passed in the header.

Body

Body

organizationIdstring<uuid>required

UUID of the organization (optional, converted to lowercase)

websiteIdstring<uuid>required

UUID of the website (optional, converted to lowercase)

namestringrequired

The name of the badge

hideInUiboolean

Whether to hide this badge in the user interface

Default: false
descriptionstring

The description of the badge

imageUrlstring<uri>required

The URL of the badge image

rewardsarray<object>

Array of rewards granted when the badge is achieved

rewards.rewardType"points" | "multiplier" | "badge" | "token"required

Type of reward (points or multiplier)

Allowed values: "points" | "multiplier" | "badge" | "token"
rewards.loyaltyCurrencyIdstring<uuid>

UUID of the loyalty currency for this reward

rewards.loyaltyCurrencyIdsarray<string<uuid>>

Array of loyalty currency IDs for multiplier rewards (empty means all currencies)

rewards.amountnumber

Points amount to reward (for points reward type)

rewards.multipliernumber

Multiplier to reward (for multiplier reward type)

rewards.isRetroactiveboolean

Whether the multiplier should be applied to the user's existing balance

Default: false
conditionsarray<object>required

Array of conditions for the badge

conditions.type"rule" | "rules" | "points" | "section" | "level" | "api" | "badge" | "badges" | "csv"

The type of rule

Allowed values: "rule" | "rules" | "points" | "section" | "level" | "api" | "badge" | "badges" | "csv"
conditions.descriptionstring

The description of the rule

conditions.amountnumber

The amount of the rule

conditions.repeatCountnumber

The number of times the rule should be repeated to fulfill the condition

conditions.requiredCountnumber

The number of rules that need to be fulfilled to satisfy the condition

conditions.loyaltyRuleChainIdstring<uuid>

UUID of the loyalty rule chain (optional, converted to lowercase)

conditions.loyaltyRuleIdsarray<string<uuid>>

Array of UUIDs of the rules (optional, converted to lowercase)

conditions.loyaltyRuleGroupIdsarray<string<uuid>>

Array of UUIDs of the rule group (optional, converted to lowercase)

conditions.loyaltyLeaderboardViewIdsarray<string<uuid>>

Array of UUIDs of the Loyalty Leaderboard (optional, converted to lowercase)

conditions.loyaltyCurrencyIdsarray<string<uuid>>

Array of UUIDs of the currency (optional, converted to lowercase)

conditions.loyaltyBadgeIdsarray<string<uuid>>

Array of UUIDs of the badge (optional, converted to lowercase)

conditions.csvUrlstring<uri>

URL of the CSV file (optional)

csvFilesarray<object>
csvFiles.srcstring<uri>required
csvFiles.namestring
Length: <= 250
csvFiles.descriptionstring
Length: <= 250

Response

application/json

200

idstring<uuid>required

UUID of the badge (converted to lowercase)

namestringrequired

The name of the badge

descriptionstringrequired

The description of the badge

imageUrlstring<uri>required

The URL of the badge image

hideInUiboolean

Whether to hide this badge in the user interface

Default: false
loyaltyConditionsarray<object>required

Array of conditions of the badge

loyaltyConditions.idstring<uuid>required

UUID of the condition (converted to lowercase)

loyaltyConditions.type"rule" | "rules" | "points" | "section" | "level" | "api" | "badge" | "badges" | "csv"required

The type of the condition

Allowed values: "rule" | "rules" | "points" | "section" | "level" | "api" | "badge" | "badges" | "csv"
loyaltyConditions.descriptionstringrequired

The description of the condition

loyaltyConditions.amountnumberrequired

The amount of the condition

loyaltyConditions.repeatCountnumberrequired

The repeat count of the condition

loyaltyConditions.requiredCountnumberrequired

The required count of the condition

loyaltyConditions.loyaltyRuleGroupIdstring<uuid>required

UUID of the rule group (converted to lowercase)

loyaltyConditions.associationarray<object>required
loyaltyConditions.loyaltyCurrencyIdstring<uuid>required

UUID of the currency (converted to lowercase)

loyaltyConditions.csvUrlstring<uri>required

URL of the CSV file

loyaltyConditions.csvFilesarray<object>

Array of CSV files associated with the condition

rewardsarray<object>

Array of rewards granted when the badge is achieved

rewards.idstring<uuid>required

UUID of the badge reward

rewards.rewardType"points" | "multiplier" | "badge" | "token"required

Type of reward (points or multiplier)

Allowed values: "points" | "multiplier" | "badge" | "token"
rewards.loyaltyCurrencyIdstring<uuid>required

UUID of the loyalty currency for this reward

rewards.loyaltyCurrencyIdsarray<string<uuid>>

Array of loyalty currency IDs for multiplier rewards (empty means all currencies)

rewards.amountnumberrequired

Points amount to reward (for points reward type)

rewards.multipliernumberrequired

Multiplier to reward (for multiplier reward type)

rewards.isRetroactivebooleanrequired

Whether the multiplier should be applied to the user's existing balance

loyaltyBadgeUsersarray<object>

Array of user badges

loyaltyBadgeUsers.idstring<uuid>required

UUID of the user badge (converted to lowercase)

loyaltyBadgeUsers.userIdstring<uuid>required

UUID of the user (converted to lowercase)

loyaltyBadgeUsers.websiteIdstring<uuid>required

UUID of the website (converted to lowercase)

loyaltyBadgeUsers.organizationIdstring<uuid>required

UUID of the organization (converted to lowercase)

loyaltyBadgeUsers.hideInUiboolean

Whether to hide this badge in the user interface

Default: false
loyaltyBadgeUsers.status"active" | "inactive" | "revoked"required

The status of the badge

Allowed values: "active" | "inactive" | "revoked"
loyaltyBadgeUsers.loyaltyBadgeIdstring<uuid>required

UUID of the badge (converted to lowercase)

loyaltyBadgeUsers.progressany

Array of progress for the badge

loyaltyBadgeUsers.dismissedInUiboolean

Whether the user has dismissed the badge in the UI

loyaltyBadgeUsers.userobject

User associated with the user badge

loyaltyBadgeUsers.createdAtstring<date-time>required

The date and time the user badge was created

loyaltyBadgeUsers.completedAtstring<date-time>

The date and time the user badge was granted

loyaltyBadgeUsers.updatedAtstring<date-time>required

The date and time the user badge was updated

loyaltyRulesarray<object>

Array of loyalty rules associated with the badge

loyaltyRules.idstring<uuid>required

UUID of the loyalty rule (converted to lowercase)

loyaltyRules.namestringrequired

The name of the loyalty rule

dataJobsarray<object>

Array of data jobs associated with the badge

dataJobs.idstring<uuid>required

UUID of the data job (converted to lowercase)

dataJobs.status"pending" | "processing" | "complete" | "failed" | "cancelled"required

The status of the data job

Allowed values: "pending" | "processing" | "complete" | "failed" | "cancelled"
dataJobs.messagestring

The message associated with the data job

dataJobs.createdAtstring<date-time>required

The date and time the data job was created

dataJobs.updatedAtstring<date-time>required

The date and time the data job was updated

createdAtstring<date-time>required

The date and time the badge was created

updatedAtstring<date-time>required

The date and time the badge was updated