curl --request POST \
--url https://admin.snagsolutions.io/api/loyalty/rules \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"websiteId": "123e4567-e89b-12d3-a456-426614174002",
"name": "Referral Bonus Rule",
"type": "TokenHold",
"frequency": "daily",
"interval": "weekly",
"startTime": "2024-01-01T00:00:00Z",
"endTime": "2024-12-31T23:59:00Z",
"effectiveStartTime": "2024-01-01T00:00:00Z",
"effectiveEndTime": "2024-12-31T23:59:00Z",
"amount": "10.5",
"metadata": {
"isCheckInOnEveryTxn": true,
"hasPaidFullRoyalty": false,
"royaltyAddress": "0x1234567890abcdef1234567890abcdef12345678",
"royaltyPercentage": 5,
"hasVerifiedTwitter": true,
"onlyRewardExistingUser": true,
"hasNeverSold": false,
"onlyNative": true,
"hasFillSource": true,
"fillSource": "opensea.io",
"liquidity": {
"network": "mainnet",
"protocol": "Uniswap V2",
"onlyRewardInRangeLiquidity": true,
"liquidityPerDay": 1000,
"customFunction": "x = y * 1000",
"calculationType": "fixed",
"pools": [
{
"id": "0xabcdefabcdefabcdefabcdefabcdefabcdef"
}
]
},
"twitterUsername": "@example_user",
"twitterUserId": "1234567890",
"twitterHashtag": "#loyalty",
"enableVerifiedMultiplier": true,
"verifiedMultiplier": 1.5,
"isMultiplierApplied": true,
"onlyKnownUsers": false,
"firstReferralReward": 10,
"referrerReward": 50,
"referrerRewardLoyaltyCurrencyId": "1234567890",
"secondReferralReward": 5,
"enableStreaks": true,
"promoCode": "PROMO123",
"promoCodeType": "code",
"promoCodeLength": 10,
"promoCodeCsvUrl": "https://example.com/promo_codes.csv",
"enableJoinDiscordServers": true,
"discordServersToJoin": [
{
"id": "123456789012345678",
"channels": [
{
"id": "987654321098765432",
"text": "Hello",
"emojis": [
{
"id": "1f600"
}
]
}
],
"roles": [
{
"id": "role123"
}
]
}
],
"streakArray": [
{
"streakMilestone": 5,
"streakAmount": 10
}
],
"dripQuestsToComplete": [
{
"id": "drip123"
}
],
"collection": [
{
"address": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"network": "mainnet",
"multiplier": 2
}
],
"range": [
{
"startRange": 1,
"endRange": 10,
"amount": 5,
"loyaltyBadgeId": "badge123",
"loyaltyMultiplierAmount": 1.5
}
],
"customRewardsApiKey": "api-key-1234",
"link": "https://example.com",
"socialPlatform": "X(Twitter)",
"socialPlatformName": "Twitter",
"socialPlatformLogo": "https://example.com/logo.png",
"rewardPerImpression": true,
"snapshotProposals": [
{
"id": "proposal123",
"space": "space123"
}
],
"cta": {
"label": "Click Here",
"href": "https://example.com"
},
"hasSaleCurrency": false,
"isTokenHoldMultiplier": true,
"saleCurrency": "USD",
"isRetroactive": true,
"timeDelayToVerifySeconds": 300,
"referralRequirements": {
"points": {
"amount": 50,
"loyaltyCurrecyId": "currency123"
},
"achievePoints": true,
"completeProfile": false,
"connectTwitter": true,
"connectDiscord": true,
"connectEmail": true
},
"multiplierLoyaltyCurrencyIds": [
"currency123",
"currency456"
],
"verifyPlaceHolderText": "Enter your verification code here.",
"verificationTextMinimumLength": 10,
"buttonText": "Verify Now",
"telegramChannelId": "telegram-channel-123",
"twitterAccountUrl": "https://twitter.com/example_user",
"twitterPostUrl": "https://twitter.com/example/status/1234567890",
"checkLike": true,
"checkRepost": true,
"checkComment": true,
"maxLikes": 200,
"maxReposts": 200,
"maxComments": 200,
"reactionStats": {
"likeCount": 123,
"repostCount": 123,
"commentCount": 123,
"syncedAt": "<string>"
},
"checkText": "loyalty",
"requirePostLink": true,
"requirePostMediaLink": true,
"preGeneratedPostText": true,
"rewardCriteria": "IMPRESSIONS_COUNT",
"smartContract": {
"contractId": "123e4567-e89b-12d3-a456-426614174000",
"event": "Transfer",
"type": "event",
"criteria": "everyEvent",
"params": [
{
"name": "value",
"condition": ">=",
"value": "100"
}
],
"addressMapping": "0x123...789",
"amountMultiplier": {
"valueMapping": "amount"
}
},
"walletType": "evm",
"imageUrl": "https://example.com/image.png",
"onlyRewardSingleTokenOwnership": true,
"skipMultiplier": true,
"completeProfileConditions": {
"twitter": true,
"discord": false
},
"steamAppId": "1234567890",
"githubRepoUrl": "https://github.com/owner/repo",
"githubBranchName": "main",
"resetProgressOnClaim": true,
"rewardPerAction": true,
"rewardByBatch": true,
"batchSize": 100,
"youtubeVideoId": "1234567890",
"youtubeChannelId": "1234567890",
"redditPostId": "1234567890",
"isRestrictedToNewUsers": false,
"allowMultipleRedemptions": false,
"rewardBadgePerRange": false,
"swap": {
"relayReferrerId": "<string>",
"from": {
"chain": "any",
"tokens": [
{
"address": "<string>",
"chainId": "<string>"
}
],
"trackAmount": true
},
"to": {
"chain": "any",
"tokens": [
{
"address": "<string>",
"chainId": "<string>"
}
],
"trackAmount": true
},
"requireCrossChainSwap": true
},
"rewardPerValue": false,
"conditionDescription": "Complete the specific task on external platform",
"directRpc": false,
"erc20Type": "erc20",
"rewardQualityPosts": false,
"minimumFollowerCount": 25,
"autoCheckInRuleIds": [
"123e4567-e89b-12d3-a456-426614174000"
],
"robinhoodSymbols": [
"<string>"
]
},
"backgroundAssetUrl": "https://example.com/background.png",
"description": "A loyalty rule rewarding users for referrals.",
"network": "mainnet",
"customRewardsCsvUrl": "https://example.com/rewards.csv",
"customRewardsApiUrl": "https://api.example.com/rewards",
"subscriptionId": "sub12345",
"functionId": "func12345",
"collectionAddress": "0x1234567890abcdef1234567890abcdef12345678",
"collections": [
{
"address": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"network": "mainnet",
"symbol": "COLL"
}
],
"hideInUi": false,
"trackProgress": true,
"progressType": "percentage",
"showBeforeStart": false,
"isRequired": true,
"oauthCredentialsId": "123e4567-e89b-12d3-a456-426614174003",
"loyaltyCurrencyId": "456e1234-e89b-12d3-a456-426614174003",
"loyaltyRuleGroupId": "123e4567-e89b-12d3-a456-426614174004",
"rewardType": "points",
"loyaltyBadgeId": "123e4567-e89b-12d3-a456-426614174004",
"mediaUrl": "https://example.com/media.png",
"loyaltyUserAllotmentCsvUrl": "https://example.com/loyalty-user-allotment.csv",
"maxAmountPerInterval": 100,
"maxAmountInterval": "daily",
"shopifyStoreUrl": "https://example.com",
"externalIntegrationId": "123e4567-e89b-12d3-a456-426614174005",
"duplicatedFromId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rewardLifetime": "permanent",
"claimType": "auto",
"contractIds": [
"123e4567-e89b-12d3-a456-426614174005"
],
"dappDeployedWithin": "daily",
"dappDataWindow": "daily",
"isDappRule": false
}
'import requests
url = "https://admin.snagsolutions.io/api/loyalty/rules"
payload = {
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"websiteId": "123e4567-e89b-12d3-a456-426614174002",
"name": "Referral Bonus Rule",
"type": "TokenHold",
"frequency": "daily",
"interval": "weekly",
"startTime": "2024-01-01T00:00:00Z",
"endTime": "2024-12-31T23:59:00Z",
"effectiveStartTime": "2024-01-01T00:00:00Z",
"effectiveEndTime": "2024-12-31T23:59:00Z",
"amount": "10.5",
"metadata": {
"isCheckInOnEveryTxn": True,
"hasPaidFullRoyalty": False,
"royaltyAddress": "0x1234567890abcdef1234567890abcdef12345678",
"royaltyPercentage": 5,
"hasVerifiedTwitter": True,
"onlyRewardExistingUser": True,
"hasNeverSold": False,
"onlyNative": True,
"hasFillSource": True,
"fillSource": "opensea.io",
"liquidity": {
"network": "mainnet",
"protocol": "Uniswap V2",
"onlyRewardInRangeLiquidity": True,
"liquidityPerDay": 1000,
"customFunction": "x = y * 1000",
"calculationType": "fixed",
"pools": [{ "id": "0xabcdefabcdefabcdefabcdefabcdefabcdef" }]
},
"twitterUsername": "@example_user",
"twitterUserId": "1234567890",
"twitterHashtag": "#loyalty",
"enableVerifiedMultiplier": True,
"verifiedMultiplier": 1.5,
"isMultiplierApplied": True,
"onlyKnownUsers": False,
"firstReferralReward": 10,
"referrerReward": 50,
"referrerRewardLoyaltyCurrencyId": "1234567890",
"secondReferralReward": 5,
"enableStreaks": True,
"promoCode": "PROMO123",
"promoCodeType": "code",
"promoCodeLength": 10,
"promoCodeCsvUrl": "https://example.com/promo_codes.csv",
"enableJoinDiscordServers": True,
"discordServersToJoin": [
{
"id": "123456789012345678",
"channels": [
{
"id": "987654321098765432",
"text": "Hello",
"emojis": [{ "id": "1f600" }]
}
],
"roles": [{ "id": "role123" }]
}
],
"streakArray": [
{
"streakMilestone": 5,
"streakAmount": 10
}
],
"dripQuestsToComplete": [{ "id": "drip123" }],
"collection": [
{
"address": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"network": "mainnet",
"multiplier": 2
}
],
"range": [
{
"startRange": 1,
"endRange": 10,
"amount": 5,
"loyaltyBadgeId": "badge123",
"loyaltyMultiplierAmount": 1.5
}
],
"customRewardsApiKey": "api-key-1234",
"link": "https://example.com",
"socialPlatform": "X(Twitter)",
"socialPlatformName": "Twitter",
"socialPlatformLogo": "https://example.com/logo.png",
"rewardPerImpression": True,
"snapshotProposals": [
{
"id": "proposal123",
"space": "space123"
}
],
"cta": {
"label": "Click Here",
"href": "https://example.com"
},
"hasSaleCurrency": False,
"isTokenHoldMultiplier": True,
"saleCurrency": "USD",
"isRetroactive": True,
"timeDelayToVerifySeconds": 300,
"referralRequirements": {
"points": {
"amount": 50,
"loyaltyCurrecyId": "currency123"
},
"achievePoints": True,
"completeProfile": False,
"connectTwitter": True,
"connectDiscord": True,
"connectEmail": True
},
"multiplierLoyaltyCurrencyIds": ["currency123", "currency456"],
"verifyPlaceHolderText": "Enter your verification code here.",
"verificationTextMinimumLength": 10,
"buttonText": "Verify Now",
"telegramChannelId": "telegram-channel-123",
"twitterAccountUrl": "https://twitter.com/example_user",
"twitterPostUrl": "https://twitter.com/example/status/1234567890",
"checkLike": True,
"checkRepost": True,
"checkComment": True,
"maxLikes": 200,
"maxReposts": 200,
"maxComments": 200,
"reactionStats": {
"likeCount": 123,
"repostCount": 123,
"commentCount": 123,
"syncedAt": "<string>"
},
"checkText": "loyalty",
"requirePostLink": True,
"requirePostMediaLink": True,
"preGeneratedPostText": True,
"rewardCriteria": "IMPRESSIONS_COUNT",
"smartContract": {
"contractId": "123e4567-e89b-12d3-a456-426614174000",
"event": "Transfer",
"type": "event",
"criteria": "everyEvent",
"params": [
{
"name": "value",
"condition": ">=",
"value": "100"
}
],
"addressMapping": "0x123...789",
"amountMultiplier": { "valueMapping": "amount" }
},
"walletType": "evm",
"imageUrl": "https://example.com/image.png",
"onlyRewardSingleTokenOwnership": True,
"skipMultiplier": True,
"completeProfileConditions": {
"twitter": True,
"discord": False
},
"steamAppId": "1234567890",
"githubRepoUrl": "https://github.com/owner/repo",
"githubBranchName": "main",
"resetProgressOnClaim": True,
"rewardPerAction": True,
"rewardByBatch": True,
"batchSize": 100,
"youtubeVideoId": "1234567890",
"youtubeChannelId": "1234567890",
"redditPostId": "1234567890",
"isRestrictedToNewUsers": False,
"allowMultipleRedemptions": False,
"rewardBadgePerRange": False,
"swap": {
"relayReferrerId": "<string>",
"from": {
"chain": "any",
"tokens": [
{
"address": "<string>",
"chainId": "<string>"
}
],
"trackAmount": True
},
"to": {
"chain": "any",
"tokens": [
{
"address": "<string>",
"chainId": "<string>"
}
],
"trackAmount": True
},
"requireCrossChainSwap": True
},
"rewardPerValue": False,
"conditionDescription": "Complete the specific task on external platform",
"directRpc": False,
"erc20Type": "erc20",
"rewardQualityPosts": False,
"minimumFollowerCount": 25,
"autoCheckInRuleIds": ["123e4567-e89b-12d3-a456-426614174000"],
"robinhoodSymbols": ["<string>"]
},
"backgroundAssetUrl": "https://example.com/background.png",
"description": "A loyalty rule rewarding users for referrals.",
"network": "mainnet",
"customRewardsCsvUrl": "https://example.com/rewards.csv",
"customRewardsApiUrl": "https://api.example.com/rewards",
"subscriptionId": "sub12345",
"functionId": "func12345",
"collectionAddress": "0x1234567890abcdef1234567890abcdef12345678",
"collections": [
{
"address": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"network": "mainnet",
"symbol": "COLL"
}
],
"hideInUi": False,
"trackProgress": True,
"progressType": "percentage",
"showBeforeStart": False,
"isRequired": True,
"oauthCredentialsId": "123e4567-e89b-12d3-a456-426614174003",
"loyaltyCurrencyId": "456e1234-e89b-12d3-a456-426614174003",
"loyaltyRuleGroupId": "123e4567-e89b-12d3-a456-426614174004",
"rewardType": "points",
"loyaltyBadgeId": "123e4567-e89b-12d3-a456-426614174004",
"mediaUrl": "https://example.com/media.png",
"loyaltyUserAllotmentCsvUrl": "https://example.com/loyalty-user-allotment.csv",
"maxAmountPerInterval": 100,
"maxAmountInterval": "daily",
"shopifyStoreUrl": "https://example.com",
"externalIntegrationId": "123e4567-e89b-12d3-a456-426614174005",
"duplicatedFromId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rewardLifetime": "permanent",
"claimType": "auto",
"contractIds": ["123e4567-e89b-12d3-a456-426614174005"],
"dappDeployedWithin": "daily",
"dappDataWindow": "daily",
"isDappRule": False
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
organizationId: '123e4567-e89b-12d3-a456-426614174001',
websiteId: '123e4567-e89b-12d3-a456-426614174002',
name: 'Referral Bonus Rule',
type: 'TokenHold',
frequency: 'daily',
interval: 'weekly',
startTime: '2024-01-01T00:00:00Z',
endTime: '2024-12-31T23:59:00Z',
effectiveStartTime: '2024-01-01T00:00:00Z',
effectiveEndTime: '2024-12-31T23:59:00Z',
amount: '10.5',
metadata: {
isCheckInOnEveryTxn: true,
hasPaidFullRoyalty: false,
royaltyAddress: '0x1234567890abcdef1234567890abcdef12345678',
royaltyPercentage: 5,
hasVerifiedTwitter: true,
onlyRewardExistingUser: true,
hasNeverSold: false,
onlyNative: true,
hasFillSource: true,
fillSource: 'opensea.io',
liquidity: {
network: 'mainnet',
protocol: 'Uniswap V2',
onlyRewardInRangeLiquidity: true,
liquidityPerDay: 1000,
customFunction: 'x = y * 1000',
calculationType: 'fixed',
pools: [{id: '0xabcdefabcdefabcdefabcdefabcdefabcdef'}]
},
twitterUsername: '@example_user',
twitterUserId: '1234567890',
twitterHashtag: '#loyalty',
enableVerifiedMultiplier: true,
verifiedMultiplier: 1.5,
isMultiplierApplied: true,
onlyKnownUsers: false,
firstReferralReward: 10,
referrerReward: 50,
referrerRewardLoyaltyCurrencyId: '1234567890',
secondReferralReward: 5,
enableStreaks: true,
promoCode: 'PROMO123',
promoCodeType: 'code',
promoCodeLength: 10,
promoCodeCsvUrl: 'https://example.com/promo_codes.csv',
enableJoinDiscordServers: true,
discordServersToJoin: [
{
id: '123456789012345678',
channels: [{id: '987654321098765432', text: 'Hello', emojis: [{id: '1f600'}]}],
roles: [{id: 'role123'}]
}
],
streakArray: [{streakMilestone: 5, streakAmount: 10}],
dripQuestsToComplete: [{id: 'drip123'}],
collection: [
{
address: '0xabcdefabcdefabcdefabcdefabcdefabcdef',
network: 'mainnet',
multiplier: 2
}
],
range: [
{
startRange: 1,
endRange: 10,
amount: 5,
loyaltyBadgeId: 'badge123',
loyaltyMultiplierAmount: 1.5
}
],
customRewardsApiKey: 'api-key-1234',
link: 'https://example.com',
socialPlatform: 'X(Twitter)',
socialPlatformName: 'Twitter',
socialPlatformLogo: 'https://example.com/logo.png',
rewardPerImpression: true,
snapshotProposals: [{id: 'proposal123', space: 'space123'}],
cta: {label: 'Click Here', href: 'https://example.com'},
hasSaleCurrency: false,
isTokenHoldMultiplier: true,
saleCurrency: 'USD',
isRetroactive: true,
timeDelayToVerifySeconds: 300,
referralRequirements: {
points: {amount: 50, loyaltyCurrecyId: 'currency123'},
achievePoints: true,
completeProfile: false,
connectTwitter: true,
connectDiscord: true,
connectEmail: true
},
multiplierLoyaltyCurrencyIds: ['currency123', 'currency456'],
verifyPlaceHolderText: 'Enter your verification code here.',
verificationTextMinimumLength: 10,
buttonText: 'Verify Now',
telegramChannelId: 'telegram-channel-123',
twitterAccountUrl: 'https://twitter.com/example_user',
twitterPostUrl: 'https://twitter.com/example/status/1234567890',
checkLike: true,
checkRepost: true,
checkComment: true,
maxLikes: 200,
maxReposts: 200,
maxComments: 200,
reactionStats: {likeCount: 123, repostCount: 123, commentCount: 123, syncedAt: '<string>'},
checkText: 'loyalty',
requirePostLink: true,
requirePostMediaLink: true,
preGeneratedPostText: true,
rewardCriteria: 'IMPRESSIONS_COUNT',
smartContract: {
contractId: '123e4567-e89b-12d3-a456-426614174000',
event: 'Transfer',
type: 'event',
criteria: 'everyEvent',
params: [{name: 'value', condition: '>=', value: '100'}],
addressMapping: '0x123...789',
amountMultiplier: {valueMapping: 'amount'}
},
walletType: 'evm',
imageUrl: 'https://example.com/image.png',
onlyRewardSingleTokenOwnership: true,
skipMultiplier: true,
completeProfileConditions: {twitter: true, discord: false},
steamAppId: '1234567890',
githubRepoUrl: 'https://github.com/owner/repo',
githubBranchName: 'main',
resetProgressOnClaim: true,
rewardPerAction: true,
rewardByBatch: true,
batchSize: 100,
youtubeVideoId: '1234567890',
youtubeChannelId: '1234567890',
redditPostId: '1234567890',
isRestrictedToNewUsers: false,
allowMultipleRedemptions: false,
rewardBadgePerRange: false,
swap: {
relayReferrerId: '<string>',
from: {
chain: 'any',
tokens: [{address: '<string>', chainId: '<string>'}],
trackAmount: true
},
to: {
chain: 'any',
tokens: [{address: '<string>', chainId: '<string>'}],
trackAmount: true
},
requireCrossChainSwap: true
},
rewardPerValue: false,
conditionDescription: 'Complete the specific task on external platform',
directRpc: false,
erc20Type: 'erc20',
rewardQualityPosts: false,
minimumFollowerCount: 25,
autoCheckInRuleIds: ['123e4567-e89b-12d3-a456-426614174000'],
robinhoodSymbols: ['<string>']
},
backgroundAssetUrl: 'https://example.com/background.png',
description: 'A loyalty rule rewarding users for referrals.',
network: 'mainnet',
customRewardsCsvUrl: 'https://example.com/rewards.csv',
customRewardsApiUrl: 'https://api.example.com/rewards',
subscriptionId: 'sub12345',
functionId: 'func12345',
collectionAddress: '0x1234567890abcdef1234567890abcdef12345678',
collections: [
{
address: '0xabcdefabcdefabcdefabcdefabcdefabcdef',
network: 'mainnet',
symbol: 'COLL'
}
],
hideInUi: false,
trackProgress: true,
progressType: 'percentage',
showBeforeStart: false,
isRequired: true,
oauthCredentialsId: '123e4567-e89b-12d3-a456-426614174003',
loyaltyCurrencyId: '456e1234-e89b-12d3-a456-426614174003',
loyaltyRuleGroupId: '123e4567-e89b-12d3-a456-426614174004',
rewardType: 'points',
loyaltyBadgeId: '123e4567-e89b-12d3-a456-426614174004',
mediaUrl: 'https://example.com/media.png',
loyaltyUserAllotmentCsvUrl: 'https://example.com/loyalty-user-allotment.csv',
maxAmountPerInterval: 100,
maxAmountInterval: 'daily',
shopifyStoreUrl: 'https://example.com',
externalIntegrationId: '123e4567-e89b-12d3-a456-426614174005',
duplicatedFromId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
rewardLifetime: 'permanent',
claimType: 'auto',
contractIds: ['123e4567-e89b-12d3-a456-426614174005'],
dappDeployedWithin: 'daily',
dappDataWindow: 'daily',
isDappRule: false
})
};
fetch('https://admin.snagsolutions.io/api/loyalty/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://admin.snagsolutions.io/api/loyalty/rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'organizationId' => '123e4567-e89b-12d3-a456-426614174001',
'websiteId' => '123e4567-e89b-12d3-a456-426614174002',
'name' => 'Referral Bonus Rule',
'type' => 'TokenHold',
'frequency' => 'daily',
'interval' => 'weekly',
'startTime' => '2024-01-01T00:00:00Z',
'endTime' => '2024-12-31T23:59:00Z',
'effectiveStartTime' => '2024-01-01T00:00:00Z',
'effectiveEndTime' => '2024-12-31T23:59:00Z',
'amount' => '10.5',
'metadata' => [
'isCheckInOnEveryTxn' => true,
'hasPaidFullRoyalty' => false,
'royaltyAddress' => '0x1234567890abcdef1234567890abcdef12345678',
'royaltyPercentage' => 5,
'hasVerifiedTwitter' => true,
'onlyRewardExistingUser' => true,
'hasNeverSold' => false,
'onlyNative' => true,
'hasFillSource' => true,
'fillSource' => 'opensea.io',
'liquidity' => [
'network' => 'mainnet',
'protocol' => 'Uniswap V2',
'onlyRewardInRangeLiquidity' => true,
'liquidityPerDay' => 1000,
'customFunction' => 'x = y * 1000',
'calculationType' => 'fixed',
'pools' => [
[
'id' => '0xabcdefabcdefabcdefabcdefabcdefabcdef'
]
]
],
'twitterUsername' => '@example_user',
'twitterUserId' => '1234567890',
'twitterHashtag' => '#loyalty',
'enableVerifiedMultiplier' => true,
'verifiedMultiplier' => 1.5,
'isMultiplierApplied' => true,
'onlyKnownUsers' => false,
'firstReferralReward' => 10,
'referrerReward' => 50,
'referrerRewardLoyaltyCurrencyId' => '1234567890',
'secondReferralReward' => 5,
'enableStreaks' => true,
'promoCode' => 'PROMO123',
'promoCodeType' => 'code',
'promoCodeLength' => 10,
'promoCodeCsvUrl' => 'https://example.com/promo_codes.csv',
'enableJoinDiscordServers' => true,
'discordServersToJoin' => [
[
'id' => '123456789012345678',
'channels' => [
[
'id' => '987654321098765432',
'text' => 'Hello',
'emojis' => [
[
'id' => '1f600'
]
]
]
],
'roles' => [
[
'id' => 'role123'
]
]
]
],
'streakArray' => [
[
'streakMilestone' => 5,
'streakAmount' => 10
]
],
'dripQuestsToComplete' => [
[
'id' => 'drip123'
]
],
'collection' => [
[
'address' => '0xabcdefabcdefabcdefabcdefabcdefabcdef',
'network' => 'mainnet',
'multiplier' => 2
]
],
'range' => [
[
'startRange' => 1,
'endRange' => 10,
'amount' => 5,
'loyaltyBadgeId' => 'badge123',
'loyaltyMultiplierAmount' => 1.5
]
],
'customRewardsApiKey' => 'api-key-1234',
'link' => 'https://example.com',
'socialPlatform' => 'X(Twitter)',
'socialPlatformName' => 'Twitter',
'socialPlatformLogo' => 'https://example.com/logo.png',
'rewardPerImpression' => true,
'snapshotProposals' => [
[
'id' => 'proposal123',
'space' => 'space123'
]
],
'cta' => [
'label' => 'Click Here',
'href' => 'https://example.com'
],
'hasSaleCurrency' => false,
'isTokenHoldMultiplier' => true,
'saleCurrency' => 'USD',
'isRetroactive' => true,
'timeDelayToVerifySeconds' => 300,
'referralRequirements' => [
'points' => [
'amount' => 50,
'loyaltyCurrecyId' => 'currency123'
],
'achievePoints' => true,
'completeProfile' => false,
'connectTwitter' => true,
'connectDiscord' => true,
'connectEmail' => true
],
'multiplierLoyaltyCurrencyIds' => [
'currency123',
'currency456'
],
'verifyPlaceHolderText' => 'Enter your verification code here.',
'verificationTextMinimumLength' => 10,
'buttonText' => 'Verify Now',
'telegramChannelId' => 'telegram-channel-123',
'twitterAccountUrl' => 'https://twitter.com/example_user',
'twitterPostUrl' => 'https://twitter.com/example/status/1234567890',
'checkLike' => true,
'checkRepost' => true,
'checkComment' => true,
'maxLikes' => 200,
'maxReposts' => 200,
'maxComments' => 200,
'reactionStats' => [
'likeCount' => 123,
'repostCount' => 123,
'commentCount' => 123,
'syncedAt' => '<string>'
],
'checkText' => 'loyalty',
'requirePostLink' => true,
'requirePostMediaLink' => true,
'preGeneratedPostText' => true,
'rewardCriteria' => 'IMPRESSIONS_COUNT',
'smartContract' => [
'contractId' => '123e4567-e89b-12d3-a456-426614174000',
'event' => 'Transfer',
'type' => 'event',
'criteria' => 'everyEvent',
'params' => [
[
'name' => 'value',
'condition' => '>=',
'value' => '100'
]
],
'addressMapping' => '0x123...789',
'amountMultiplier' => [
'valueMapping' => 'amount'
]
],
'walletType' => 'evm',
'imageUrl' => 'https://example.com/image.png',
'onlyRewardSingleTokenOwnership' => true,
'skipMultiplier' => true,
'completeProfileConditions' => [
'twitter' => true,
'discord' => false
],
'steamAppId' => '1234567890',
'githubRepoUrl' => 'https://github.com/owner/repo',
'githubBranchName' => 'main',
'resetProgressOnClaim' => true,
'rewardPerAction' => true,
'rewardByBatch' => true,
'batchSize' => 100,
'youtubeVideoId' => '1234567890',
'youtubeChannelId' => '1234567890',
'redditPostId' => '1234567890',
'isRestrictedToNewUsers' => false,
'allowMultipleRedemptions' => false,
'rewardBadgePerRange' => false,
'swap' => [
'relayReferrerId' => '<string>',
'from' => [
'chain' => 'any',
'tokens' => [
[
'address' => '<string>',
'chainId' => '<string>'
]
],
'trackAmount' => true
],
'to' => [
'chain' => 'any',
'tokens' => [
[
'address' => '<string>',
'chainId' => '<string>'
]
],
'trackAmount' => true
],
'requireCrossChainSwap' => true
],
'rewardPerValue' => false,
'conditionDescription' => 'Complete the specific task on external platform',
'directRpc' => false,
'erc20Type' => 'erc20',
'rewardQualityPosts' => false,
'minimumFollowerCount' => 25,
'autoCheckInRuleIds' => [
'123e4567-e89b-12d3-a456-426614174000'
],
'robinhoodSymbols' => [
'<string>'
]
],
'backgroundAssetUrl' => 'https://example.com/background.png',
'description' => 'A loyalty rule rewarding users for referrals.',
'network' => 'mainnet',
'customRewardsCsvUrl' => 'https://example.com/rewards.csv',
'customRewardsApiUrl' => 'https://api.example.com/rewards',
'subscriptionId' => 'sub12345',
'functionId' => 'func12345',
'collectionAddress' => '0x1234567890abcdef1234567890abcdef12345678',
'collections' => [
[
'address' => '0xabcdefabcdefabcdefabcdefabcdefabcdef',
'network' => 'mainnet',
'symbol' => 'COLL'
]
],
'hideInUi' => false,
'trackProgress' => true,
'progressType' => 'percentage',
'showBeforeStart' => false,
'isRequired' => true,
'oauthCredentialsId' => '123e4567-e89b-12d3-a456-426614174003',
'loyaltyCurrencyId' => '456e1234-e89b-12d3-a456-426614174003',
'loyaltyRuleGroupId' => '123e4567-e89b-12d3-a456-426614174004',
'rewardType' => 'points',
'loyaltyBadgeId' => '123e4567-e89b-12d3-a456-426614174004',
'mediaUrl' => 'https://example.com/media.png',
'loyaltyUserAllotmentCsvUrl' => 'https://example.com/loyalty-user-allotment.csv',
'maxAmountPerInterval' => 100,
'maxAmountInterval' => 'daily',
'shopifyStoreUrl' => 'https://example.com',
'externalIntegrationId' => '123e4567-e89b-12d3-a456-426614174005',
'duplicatedFromId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'rewardLifetime' => 'permanent',
'claimType' => 'auto',
'contractIds' => [
'123e4567-e89b-12d3-a456-426614174005'
],
'dappDeployedWithin' => 'daily',
'dappDataWindow' => 'daily',
'isDappRule' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://admin.snagsolutions.io/api/loyalty/rules"
payload := strings.NewReader("{\n \"organizationId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"websiteId\": \"123e4567-e89b-12d3-a456-426614174002\",\n \"name\": \"Referral Bonus Rule\",\n \"type\": \"TokenHold\",\n \"frequency\": \"daily\",\n \"interval\": \"weekly\",\n \"startTime\": \"2024-01-01T00:00:00Z\",\n \"endTime\": \"2024-12-31T23:59:00Z\",\n \"effectiveStartTime\": \"2024-01-01T00:00:00Z\",\n \"effectiveEndTime\": \"2024-12-31T23:59:00Z\",\n \"amount\": \"10.5\",\n \"metadata\": {\n \"isCheckInOnEveryTxn\": true,\n \"hasPaidFullRoyalty\": false,\n \"royaltyAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"royaltyPercentage\": 5,\n \"hasVerifiedTwitter\": true,\n \"onlyRewardExistingUser\": true,\n \"hasNeverSold\": false,\n \"onlyNative\": true,\n \"hasFillSource\": true,\n \"fillSource\": \"opensea.io\",\n \"liquidity\": {\n \"network\": \"mainnet\",\n \"protocol\": \"Uniswap V2\",\n \"onlyRewardInRangeLiquidity\": true,\n \"liquidityPerDay\": 1000,\n \"customFunction\": \"x = y * 1000\",\n \"calculationType\": \"fixed\",\n \"pools\": [\n {\n \"id\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\"\n }\n ]\n },\n \"twitterUsername\": \"@example_user\",\n \"twitterUserId\": \"1234567890\",\n \"twitterHashtag\": \"#loyalty\",\n \"enableVerifiedMultiplier\": true,\n \"verifiedMultiplier\": 1.5,\n \"isMultiplierApplied\": true,\n \"onlyKnownUsers\": false,\n \"firstReferralReward\": 10,\n \"referrerReward\": 50,\n \"referrerRewardLoyaltyCurrencyId\": \"1234567890\",\n \"secondReferralReward\": 5,\n \"enableStreaks\": true,\n \"promoCode\": \"PROMO123\",\n \"promoCodeType\": \"code\",\n \"promoCodeLength\": 10,\n \"promoCodeCsvUrl\": \"https://example.com/promo_codes.csv\",\n \"enableJoinDiscordServers\": true,\n \"discordServersToJoin\": [\n {\n \"id\": \"123456789012345678\",\n \"channels\": [\n {\n \"id\": \"987654321098765432\",\n \"text\": \"Hello\",\n \"emojis\": [\n {\n \"id\": \"1f600\"\n }\n ]\n }\n ],\n \"roles\": [\n {\n \"id\": \"role123\"\n }\n ]\n }\n ],\n \"streakArray\": [\n {\n \"streakMilestone\": 5,\n \"streakAmount\": 10\n }\n ],\n \"dripQuestsToComplete\": [\n {\n \"id\": \"drip123\"\n }\n ],\n \"collection\": [\n {\n \"address\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\",\n \"network\": \"mainnet\",\n \"multiplier\": 2\n }\n ],\n \"range\": [\n {\n \"startRange\": 1,\n \"endRange\": 10,\n \"amount\": 5,\n \"loyaltyBadgeId\": \"badge123\",\n \"loyaltyMultiplierAmount\": 1.5\n }\n ],\n \"customRewardsApiKey\": \"api-key-1234\",\n \"link\": \"https://example.com\",\n \"socialPlatform\": \"X(Twitter)\",\n \"socialPlatformName\": \"Twitter\",\n \"socialPlatformLogo\": \"https://example.com/logo.png\",\n \"rewardPerImpression\": true,\n \"snapshotProposals\": [\n {\n \"id\": \"proposal123\",\n \"space\": \"space123\"\n }\n ],\n \"cta\": {\n \"label\": \"Click Here\",\n \"href\": \"https://example.com\"\n },\n \"hasSaleCurrency\": false,\n \"isTokenHoldMultiplier\": true,\n \"saleCurrency\": \"USD\",\n \"isRetroactive\": true,\n \"timeDelayToVerifySeconds\": 300,\n \"referralRequirements\": {\n \"points\": {\n \"amount\": 50,\n \"loyaltyCurrecyId\": \"currency123\"\n },\n \"achievePoints\": true,\n \"completeProfile\": false,\n \"connectTwitter\": true,\n \"connectDiscord\": true,\n \"connectEmail\": true\n },\n \"multiplierLoyaltyCurrencyIds\": [\n \"currency123\",\n \"currency456\"\n ],\n \"verifyPlaceHolderText\": \"Enter your verification code here.\",\n \"verificationTextMinimumLength\": 10,\n \"buttonText\": \"Verify Now\",\n \"telegramChannelId\": \"telegram-channel-123\",\n \"twitterAccountUrl\": \"https://twitter.com/example_user\",\n \"twitterPostUrl\": \"https://twitter.com/example/status/1234567890\",\n \"checkLike\": true,\n \"checkRepost\": true,\n \"checkComment\": true,\n \"maxLikes\": 200,\n \"maxReposts\": 200,\n \"maxComments\": 200,\n \"reactionStats\": {\n \"likeCount\": 123,\n \"repostCount\": 123,\n \"commentCount\": 123,\n \"syncedAt\": \"<string>\"\n },\n \"checkText\": \"loyalty\",\n \"requirePostLink\": true,\n \"requirePostMediaLink\": true,\n \"preGeneratedPostText\": true,\n \"rewardCriteria\": \"IMPRESSIONS_COUNT\",\n \"smartContract\": {\n \"contractId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"event\": \"Transfer\",\n \"type\": \"event\",\n \"criteria\": \"everyEvent\",\n \"params\": [\n {\n \"name\": \"value\",\n \"condition\": \">=\",\n \"value\": \"100\"\n }\n ],\n \"addressMapping\": \"0x123...789\",\n \"amountMultiplier\": {\n \"valueMapping\": \"amount\"\n }\n },\n \"walletType\": \"evm\",\n \"imageUrl\": \"https://example.com/image.png\",\n \"onlyRewardSingleTokenOwnership\": true,\n \"skipMultiplier\": true,\n \"completeProfileConditions\": {\n \"twitter\": true,\n \"discord\": false\n },\n \"steamAppId\": \"1234567890\",\n \"githubRepoUrl\": \"https://github.com/owner/repo\",\n \"githubBranchName\": \"main\",\n \"resetProgressOnClaim\": true,\n \"rewardPerAction\": true,\n \"rewardByBatch\": true,\n \"batchSize\": 100,\n \"youtubeVideoId\": \"1234567890\",\n \"youtubeChannelId\": \"1234567890\",\n \"redditPostId\": \"1234567890\",\n \"isRestrictedToNewUsers\": false,\n \"allowMultipleRedemptions\": false,\n \"rewardBadgePerRange\": false,\n \"swap\": {\n \"relayReferrerId\": \"<string>\",\n \"from\": {\n \"chain\": \"any\",\n \"tokens\": [\n {\n \"address\": \"<string>\",\n \"chainId\": \"<string>\"\n }\n ],\n \"trackAmount\": true\n },\n \"to\": {\n \"chain\": \"any\",\n \"tokens\": [\n {\n \"address\": \"<string>\",\n \"chainId\": \"<string>\"\n }\n ],\n \"trackAmount\": true\n },\n \"requireCrossChainSwap\": true\n },\n \"rewardPerValue\": false,\n \"conditionDescription\": \"Complete the specific task on external platform\",\n \"directRpc\": false,\n \"erc20Type\": \"erc20\",\n \"rewardQualityPosts\": false,\n \"minimumFollowerCount\": 25,\n \"autoCheckInRuleIds\": [\n \"123e4567-e89b-12d3-a456-426614174000\"\n ],\n \"robinhoodSymbols\": [\n \"<string>\"\n ]\n },\n \"backgroundAssetUrl\": \"https://example.com/background.png\",\n \"description\": \"A loyalty rule rewarding users for referrals.\",\n \"network\": \"mainnet\",\n \"customRewardsCsvUrl\": \"https://example.com/rewards.csv\",\n \"customRewardsApiUrl\": \"https://api.example.com/rewards\",\n \"subscriptionId\": \"sub12345\",\n \"functionId\": \"func12345\",\n \"collectionAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"collections\": [\n {\n \"address\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\",\n \"network\": \"mainnet\",\n \"symbol\": \"COLL\"\n }\n ],\n \"hideInUi\": false,\n \"trackProgress\": true,\n \"progressType\": \"percentage\",\n \"showBeforeStart\": false,\n \"isRequired\": true,\n \"oauthCredentialsId\": \"123e4567-e89b-12d3-a456-426614174003\",\n \"loyaltyCurrencyId\": \"456e1234-e89b-12d3-a456-426614174003\",\n \"loyaltyRuleGroupId\": \"123e4567-e89b-12d3-a456-426614174004\",\n \"rewardType\": \"points\",\n \"loyaltyBadgeId\": \"123e4567-e89b-12d3-a456-426614174004\",\n \"mediaUrl\": \"https://example.com/media.png\",\n \"loyaltyUserAllotmentCsvUrl\": \"https://example.com/loyalty-user-allotment.csv\",\n \"maxAmountPerInterval\": 100,\n \"maxAmountInterval\": \"daily\",\n \"shopifyStoreUrl\": \"https://example.com\",\n \"externalIntegrationId\": \"123e4567-e89b-12d3-a456-426614174005\",\n \"duplicatedFromId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rewardLifetime\": \"permanent\",\n \"claimType\": \"auto\",\n \"contractIds\": [\n \"123e4567-e89b-12d3-a456-426614174005\"\n ],\n \"dappDeployedWithin\": \"daily\",\n \"dappDataWindow\": \"daily\",\n \"isDappRule\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://admin.snagsolutions.io/api/loyalty/rules")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"organizationId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"websiteId\": \"123e4567-e89b-12d3-a456-426614174002\",\n \"name\": \"Referral Bonus Rule\",\n \"type\": \"TokenHold\",\n \"frequency\": \"daily\",\n \"interval\": \"weekly\",\n \"startTime\": \"2024-01-01T00:00:00Z\",\n \"endTime\": \"2024-12-31T23:59:00Z\",\n \"effectiveStartTime\": \"2024-01-01T00:00:00Z\",\n \"effectiveEndTime\": \"2024-12-31T23:59:00Z\",\n \"amount\": \"10.5\",\n \"metadata\": {\n \"isCheckInOnEveryTxn\": true,\n \"hasPaidFullRoyalty\": false,\n \"royaltyAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"royaltyPercentage\": 5,\n \"hasVerifiedTwitter\": true,\n \"onlyRewardExistingUser\": true,\n \"hasNeverSold\": false,\n \"onlyNative\": true,\n \"hasFillSource\": true,\n \"fillSource\": \"opensea.io\",\n \"liquidity\": {\n \"network\": \"mainnet\",\n \"protocol\": \"Uniswap V2\",\n \"onlyRewardInRangeLiquidity\": true,\n \"liquidityPerDay\": 1000,\n \"customFunction\": \"x = y * 1000\",\n \"calculationType\": \"fixed\",\n \"pools\": [\n {\n \"id\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\"\n }\n ]\n },\n \"twitterUsername\": \"@example_user\",\n \"twitterUserId\": \"1234567890\",\n \"twitterHashtag\": \"#loyalty\",\n \"enableVerifiedMultiplier\": true,\n \"verifiedMultiplier\": 1.5,\n \"isMultiplierApplied\": true,\n \"onlyKnownUsers\": false,\n \"firstReferralReward\": 10,\n \"referrerReward\": 50,\n \"referrerRewardLoyaltyCurrencyId\": \"1234567890\",\n \"secondReferralReward\": 5,\n \"enableStreaks\": true,\n \"promoCode\": \"PROMO123\",\n \"promoCodeType\": \"code\",\n \"promoCodeLength\": 10,\n \"promoCodeCsvUrl\": \"https://example.com/promo_codes.csv\",\n \"enableJoinDiscordServers\": true,\n \"discordServersToJoin\": [\n {\n \"id\": \"123456789012345678\",\n \"channels\": [\n {\n \"id\": \"987654321098765432\",\n \"text\": \"Hello\",\n \"emojis\": [\n {\n \"id\": \"1f600\"\n }\n ]\n }\n ],\n \"roles\": [\n {\n \"id\": \"role123\"\n }\n ]\n }\n ],\n \"streakArray\": [\n {\n \"streakMilestone\": 5,\n \"streakAmount\": 10\n }\n ],\n \"dripQuestsToComplete\": [\n {\n \"id\": \"drip123\"\n }\n ],\n \"collection\": [\n {\n \"address\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\",\n \"network\": \"mainnet\",\n \"multiplier\": 2\n }\n ],\n \"range\": [\n {\n \"startRange\": 1,\n \"endRange\": 10,\n \"amount\": 5,\n \"loyaltyBadgeId\": \"badge123\",\n \"loyaltyMultiplierAmount\": 1.5\n }\n ],\n \"customRewardsApiKey\": \"api-key-1234\",\n \"link\": \"https://example.com\",\n \"socialPlatform\": \"X(Twitter)\",\n \"socialPlatformName\": \"Twitter\",\n \"socialPlatformLogo\": \"https://example.com/logo.png\",\n \"rewardPerImpression\": true,\n \"snapshotProposals\": [\n {\n \"id\": \"proposal123\",\n \"space\": \"space123\"\n }\n ],\n \"cta\": {\n \"label\": \"Click Here\",\n \"href\": \"https://example.com\"\n },\n \"hasSaleCurrency\": false,\n \"isTokenHoldMultiplier\": true,\n \"saleCurrency\": \"USD\",\n \"isRetroactive\": true,\n \"timeDelayToVerifySeconds\": 300,\n \"referralRequirements\": {\n \"points\": {\n \"amount\": 50,\n \"loyaltyCurrecyId\": \"currency123\"\n },\n \"achievePoints\": true,\n \"completeProfile\": false,\n \"connectTwitter\": true,\n \"connectDiscord\": true,\n \"connectEmail\": true\n },\n \"multiplierLoyaltyCurrencyIds\": [\n \"currency123\",\n \"currency456\"\n ],\n \"verifyPlaceHolderText\": \"Enter your verification code here.\",\n \"verificationTextMinimumLength\": 10,\n \"buttonText\": \"Verify Now\",\n \"telegramChannelId\": \"telegram-channel-123\",\n \"twitterAccountUrl\": \"https://twitter.com/example_user\",\n \"twitterPostUrl\": \"https://twitter.com/example/status/1234567890\",\n \"checkLike\": true,\n \"checkRepost\": true,\n \"checkComment\": true,\n \"maxLikes\": 200,\n \"maxReposts\": 200,\n \"maxComments\": 200,\n \"reactionStats\": {\n \"likeCount\": 123,\n \"repostCount\": 123,\n \"commentCount\": 123,\n \"syncedAt\": \"<string>\"\n },\n \"checkText\": \"loyalty\",\n \"requirePostLink\": true,\n \"requirePostMediaLink\": true,\n \"preGeneratedPostText\": true,\n \"rewardCriteria\": \"IMPRESSIONS_COUNT\",\n \"smartContract\": {\n \"contractId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"event\": \"Transfer\",\n \"type\": \"event\",\n \"criteria\": \"everyEvent\",\n \"params\": [\n {\n \"name\": \"value\",\n \"condition\": \">=\",\n \"value\": \"100\"\n }\n ],\n \"addressMapping\": \"0x123...789\",\n \"amountMultiplier\": {\n \"valueMapping\": \"amount\"\n }\n },\n \"walletType\": \"evm\",\n \"imageUrl\": \"https://example.com/image.png\",\n \"onlyRewardSingleTokenOwnership\": true,\n \"skipMultiplier\": true,\n \"completeProfileConditions\": {\n \"twitter\": true,\n \"discord\": false\n },\n \"steamAppId\": \"1234567890\",\n \"githubRepoUrl\": \"https://github.com/owner/repo\",\n \"githubBranchName\": \"main\",\n \"resetProgressOnClaim\": true,\n \"rewardPerAction\": true,\n \"rewardByBatch\": true,\n \"batchSize\": 100,\n \"youtubeVideoId\": \"1234567890\",\n \"youtubeChannelId\": \"1234567890\",\n \"redditPostId\": \"1234567890\",\n \"isRestrictedToNewUsers\": false,\n \"allowMultipleRedemptions\": false,\n \"rewardBadgePerRange\": false,\n \"swap\": {\n \"relayReferrerId\": \"<string>\",\n \"from\": {\n \"chain\": \"any\",\n \"tokens\": [\n {\n \"address\": \"<string>\",\n \"chainId\": \"<string>\"\n }\n ],\n \"trackAmount\": true\n },\n \"to\": {\n \"chain\": \"any\",\n \"tokens\": [\n {\n \"address\": \"<string>\",\n \"chainId\": \"<string>\"\n }\n ],\n \"trackAmount\": true\n },\n \"requireCrossChainSwap\": true\n },\n \"rewardPerValue\": false,\n \"conditionDescription\": \"Complete the specific task on external platform\",\n \"directRpc\": false,\n \"erc20Type\": \"erc20\",\n \"rewardQualityPosts\": false,\n \"minimumFollowerCount\": 25,\n \"autoCheckInRuleIds\": [\n \"123e4567-e89b-12d3-a456-426614174000\"\n ],\n \"robinhoodSymbols\": [\n \"<string>\"\n ]\n },\n \"backgroundAssetUrl\": \"https://example.com/background.png\",\n \"description\": \"A loyalty rule rewarding users for referrals.\",\n \"network\": \"mainnet\",\n \"customRewardsCsvUrl\": \"https://example.com/rewards.csv\",\n \"customRewardsApiUrl\": \"https://api.example.com/rewards\",\n \"subscriptionId\": \"sub12345\",\n \"functionId\": \"func12345\",\n \"collectionAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"collections\": [\n {\n \"address\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\",\n \"network\": \"mainnet\",\n \"symbol\": \"COLL\"\n }\n ],\n \"hideInUi\": false,\n \"trackProgress\": true,\n \"progressType\": \"percentage\",\n \"showBeforeStart\": false,\n \"isRequired\": true,\n \"oauthCredentialsId\": \"123e4567-e89b-12d3-a456-426614174003\",\n \"loyaltyCurrencyId\": \"456e1234-e89b-12d3-a456-426614174003\",\n \"loyaltyRuleGroupId\": \"123e4567-e89b-12d3-a456-426614174004\",\n \"rewardType\": \"points\",\n \"loyaltyBadgeId\": \"123e4567-e89b-12d3-a456-426614174004\",\n \"mediaUrl\": \"https://example.com/media.png\",\n \"loyaltyUserAllotmentCsvUrl\": \"https://example.com/loyalty-user-allotment.csv\",\n \"maxAmountPerInterval\": 100,\n \"maxAmountInterval\": \"daily\",\n \"shopifyStoreUrl\": \"https://example.com\",\n \"externalIntegrationId\": \"123e4567-e89b-12d3-a456-426614174005\",\n \"duplicatedFromId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rewardLifetime\": \"permanent\",\n \"claimType\": \"auto\",\n \"contractIds\": [\n \"123e4567-e89b-12d3-a456-426614174005\"\n ],\n \"dappDeployedWithin\": \"daily\",\n \"dappDataWindow\": \"daily\",\n \"isDappRule\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://admin.snagsolutions.io/api/loyalty/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"organizationId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"websiteId\": \"123e4567-e89b-12d3-a456-426614174002\",\n \"name\": \"Referral Bonus Rule\",\n \"type\": \"TokenHold\",\n \"frequency\": \"daily\",\n \"interval\": \"weekly\",\n \"startTime\": \"2024-01-01T00:00:00Z\",\n \"endTime\": \"2024-12-31T23:59:00Z\",\n \"effectiveStartTime\": \"2024-01-01T00:00:00Z\",\n \"effectiveEndTime\": \"2024-12-31T23:59:00Z\",\n \"amount\": \"10.5\",\n \"metadata\": {\n \"isCheckInOnEveryTxn\": true,\n \"hasPaidFullRoyalty\": false,\n \"royaltyAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"royaltyPercentage\": 5,\n \"hasVerifiedTwitter\": true,\n \"onlyRewardExistingUser\": true,\n \"hasNeverSold\": false,\n \"onlyNative\": true,\n \"hasFillSource\": true,\n \"fillSource\": \"opensea.io\",\n \"liquidity\": {\n \"network\": \"mainnet\",\n \"protocol\": \"Uniswap V2\",\n \"onlyRewardInRangeLiquidity\": true,\n \"liquidityPerDay\": 1000,\n \"customFunction\": \"x = y * 1000\",\n \"calculationType\": \"fixed\",\n \"pools\": [\n {\n \"id\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\"\n }\n ]\n },\n \"twitterUsername\": \"@example_user\",\n \"twitterUserId\": \"1234567890\",\n \"twitterHashtag\": \"#loyalty\",\n \"enableVerifiedMultiplier\": true,\n \"verifiedMultiplier\": 1.5,\n \"isMultiplierApplied\": true,\n \"onlyKnownUsers\": false,\n \"firstReferralReward\": 10,\n \"referrerReward\": 50,\n \"referrerRewardLoyaltyCurrencyId\": \"1234567890\",\n \"secondReferralReward\": 5,\n \"enableStreaks\": true,\n \"promoCode\": \"PROMO123\",\n \"promoCodeType\": \"code\",\n \"promoCodeLength\": 10,\n \"promoCodeCsvUrl\": \"https://example.com/promo_codes.csv\",\n \"enableJoinDiscordServers\": true,\n \"discordServersToJoin\": [\n {\n \"id\": \"123456789012345678\",\n \"channels\": [\n {\n \"id\": \"987654321098765432\",\n \"text\": \"Hello\",\n \"emojis\": [\n {\n \"id\": \"1f600\"\n }\n ]\n }\n ],\n \"roles\": [\n {\n \"id\": \"role123\"\n }\n ]\n }\n ],\n \"streakArray\": [\n {\n \"streakMilestone\": 5,\n \"streakAmount\": 10\n }\n ],\n \"dripQuestsToComplete\": [\n {\n \"id\": \"drip123\"\n }\n ],\n \"collection\": [\n {\n \"address\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\",\n \"network\": \"mainnet\",\n \"multiplier\": 2\n }\n ],\n \"range\": [\n {\n \"startRange\": 1,\n \"endRange\": 10,\n \"amount\": 5,\n \"loyaltyBadgeId\": \"badge123\",\n \"loyaltyMultiplierAmount\": 1.5\n }\n ],\n \"customRewardsApiKey\": \"api-key-1234\",\n \"link\": \"https://example.com\",\n \"socialPlatform\": \"X(Twitter)\",\n \"socialPlatformName\": \"Twitter\",\n \"socialPlatformLogo\": \"https://example.com/logo.png\",\n \"rewardPerImpression\": true,\n \"snapshotProposals\": [\n {\n \"id\": \"proposal123\",\n \"space\": \"space123\"\n }\n ],\n \"cta\": {\n \"label\": \"Click Here\",\n \"href\": \"https://example.com\"\n },\n \"hasSaleCurrency\": false,\n \"isTokenHoldMultiplier\": true,\n \"saleCurrency\": \"USD\",\n \"isRetroactive\": true,\n \"timeDelayToVerifySeconds\": 300,\n \"referralRequirements\": {\n \"points\": {\n \"amount\": 50,\n \"loyaltyCurrecyId\": \"currency123\"\n },\n \"achievePoints\": true,\n \"completeProfile\": false,\n \"connectTwitter\": true,\n \"connectDiscord\": true,\n \"connectEmail\": true\n },\n \"multiplierLoyaltyCurrencyIds\": [\n \"currency123\",\n \"currency456\"\n ],\n \"verifyPlaceHolderText\": \"Enter your verification code here.\",\n \"verificationTextMinimumLength\": 10,\n \"buttonText\": \"Verify Now\",\n \"telegramChannelId\": \"telegram-channel-123\",\n \"twitterAccountUrl\": \"https://twitter.com/example_user\",\n \"twitterPostUrl\": \"https://twitter.com/example/status/1234567890\",\n \"checkLike\": true,\n \"checkRepost\": true,\n \"checkComment\": true,\n \"maxLikes\": 200,\n \"maxReposts\": 200,\n \"maxComments\": 200,\n \"reactionStats\": {\n \"likeCount\": 123,\n \"repostCount\": 123,\n \"commentCount\": 123,\n \"syncedAt\": \"<string>\"\n },\n \"checkText\": \"loyalty\",\n \"requirePostLink\": true,\n \"requirePostMediaLink\": true,\n \"preGeneratedPostText\": true,\n \"rewardCriteria\": \"IMPRESSIONS_COUNT\",\n \"smartContract\": {\n \"contractId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"event\": \"Transfer\",\n \"type\": \"event\",\n \"criteria\": \"everyEvent\",\n \"params\": [\n {\n \"name\": \"value\",\n \"condition\": \">=\",\n \"value\": \"100\"\n }\n ],\n \"addressMapping\": \"0x123...789\",\n \"amountMultiplier\": {\n \"valueMapping\": \"amount\"\n }\n },\n \"walletType\": \"evm\",\n \"imageUrl\": \"https://example.com/image.png\",\n \"onlyRewardSingleTokenOwnership\": true,\n \"skipMultiplier\": true,\n \"completeProfileConditions\": {\n \"twitter\": true,\n \"discord\": false\n },\n \"steamAppId\": \"1234567890\",\n \"githubRepoUrl\": \"https://github.com/owner/repo\",\n \"githubBranchName\": \"main\",\n \"resetProgressOnClaim\": true,\n \"rewardPerAction\": true,\n \"rewardByBatch\": true,\n \"batchSize\": 100,\n \"youtubeVideoId\": \"1234567890\",\n \"youtubeChannelId\": \"1234567890\",\n \"redditPostId\": \"1234567890\",\n \"isRestrictedToNewUsers\": false,\n \"allowMultipleRedemptions\": false,\n \"rewardBadgePerRange\": false,\n \"swap\": {\n \"relayReferrerId\": \"<string>\",\n \"from\": {\n \"chain\": \"any\",\n \"tokens\": [\n {\n \"address\": \"<string>\",\n \"chainId\": \"<string>\"\n }\n ],\n \"trackAmount\": true\n },\n \"to\": {\n \"chain\": \"any\",\n \"tokens\": [\n {\n \"address\": \"<string>\",\n \"chainId\": \"<string>\"\n }\n ],\n \"trackAmount\": true\n },\n \"requireCrossChainSwap\": true\n },\n \"rewardPerValue\": false,\n \"conditionDescription\": \"Complete the specific task on external platform\",\n \"directRpc\": false,\n \"erc20Type\": \"erc20\",\n \"rewardQualityPosts\": false,\n \"minimumFollowerCount\": 25,\n \"autoCheckInRuleIds\": [\n \"123e4567-e89b-12d3-a456-426614174000\"\n ],\n \"robinhoodSymbols\": [\n \"<string>\"\n ]\n },\n \"backgroundAssetUrl\": \"https://example.com/background.png\",\n \"description\": \"A loyalty rule rewarding users for referrals.\",\n \"network\": \"mainnet\",\n \"customRewardsCsvUrl\": \"https://example.com/rewards.csv\",\n \"customRewardsApiUrl\": \"https://api.example.com/rewards\",\n \"subscriptionId\": \"sub12345\",\n \"functionId\": \"func12345\",\n \"collectionAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"collections\": [\n {\n \"address\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\",\n \"network\": \"mainnet\",\n \"symbol\": \"COLL\"\n }\n ],\n \"hideInUi\": false,\n \"trackProgress\": true,\n \"progressType\": \"percentage\",\n \"showBeforeStart\": false,\n \"isRequired\": true,\n \"oauthCredentialsId\": \"123e4567-e89b-12d3-a456-426614174003\",\n \"loyaltyCurrencyId\": \"456e1234-e89b-12d3-a456-426614174003\",\n \"loyaltyRuleGroupId\": \"123e4567-e89b-12d3-a456-426614174004\",\n \"rewardType\": \"points\",\n \"loyaltyBadgeId\": \"123e4567-e89b-12d3-a456-426614174004\",\n \"mediaUrl\": \"https://example.com/media.png\",\n \"loyaltyUserAllotmentCsvUrl\": \"https://example.com/loyalty-user-allotment.csv\",\n \"maxAmountPerInterval\": 100,\n \"maxAmountInterval\": \"daily\",\n \"shopifyStoreUrl\": \"https://example.com\",\n \"externalIntegrationId\": \"123e4567-e89b-12d3-a456-426614174005\",\n \"duplicatedFromId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rewardLifetime\": \"permanent\",\n \"claimType\": \"auto\",\n \"contractIds\": [\n \"123e4567-e89b-12d3-a456-426614174005\"\n ],\n \"dappDeployedWithin\": \"daily\",\n \"dappDataWindow\": \"daily\",\n \"isDappRule\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"websiteId": "123e4567-e89b-12d3-a456-426614174002",
"name": "Referral Bonus Rule",
"type": "TokenHold",
"frequency": "daily",
"interval": "weekly",
"startTime": "2024-01-01T00:00:00Z",
"endTime": "2024-12-31T23:59:00Z",
"effectiveStartTime": "2024-01-01T00:00:00Z",
"effectiveEndTime": "2024-12-31T23:59:00Z",
"amount": "10.5",
"metadata": {
"isCheckInOnEveryTxn": true,
"hasPaidFullRoyalty": false,
"royaltyAddress": "0x1234567890abcdef1234567890abcdef12345678",
"royaltyPercentage": 5,
"hasVerifiedTwitter": true,
"onlyRewardExistingUser": true,
"hasNeverSold": false,
"onlyNative": true,
"hasFillSource": true,
"fillSource": "opensea.io",
"liquidity": {
"network": "mainnet",
"protocol": "Uniswap V2",
"onlyRewardInRangeLiquidity": true,
"liquidityPerDay": 1000,
"customFunction": "x = y * 1000",
"calculationType": "fixed",
"pools": [
{
"id": "0xabcdefabcdefabcdefabcdefabcdefabcdef"
}
]
},
"twitterUsername": "@example_user",
"twitterUserId": "1234567890",
"twitterHashtag": "#loyalty",
"enableVerifiedMultiplier": true,
"verifiedMultiplier": 1.5,
"isMultiplierApplied": true,
"onlyKnownUsers": false,
"firstReferralReward": 10,
"referrerReward": 50,
"referrerRewardLoyaltyCurrencyId": "1234567890",
"secondReferralReward": 5,
"enableStreaks": true,
"promoCode": "PROMO123",
"promoCodeType": "code",
"promoCodeLength": 10,
"promoCodeCsvUrl": "https://example.com/promo_codes.csv",
"enableJoinDiscordServers": true,
"discordServersToJoin": [
{
"id": "123456789012345678",
"channels": [
{
"id": "987654321098765432",
"text": "Hello",
"emojis": [
{
"id": "1f600"
}
]
}
],
"roles": [
{
"id": "role123"
}
]
}
],
"streakArray": [
{
"streakMilestone": 5,
"streakAmount": 10
}
],
"dripQuestsToComplete": [
{
"id": "drip123"
}
],
"collection": [
{
"address": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"network": "mainnet",
"multiplier": 2
}
],
"range": [
{
"startRange": 1,
"endRange": 10,
"amount": 5,
"loyaltyBadgeId": "badge123",
"loyaltyMultiplierAmount": 1.5
}
],
"customRewardsApiKey": "api-key-1234",
"link": "https://example.com",
"socialPlatform": "X(Twitter)",
"socialPlatformName": "Twitter",
"socialPlatformLogo": "https://example.com/logo.png",
"rewardPerImpression": true,
"snapshotProposals": [
{
"id": "proposal123",
"space": "space123"
}
],
"cta": {
"label": "Click Here",
"href": "https://example.com"
},
"hasSaleCurrency": false,
"isTokenHoldMultiplier": true,
"saleCurrency": "USD",
"isRetroactive": true,
"timeDelayToVerifySeconds": 300,
"referralRequirements": {
"points": {
"amount": 50,
"loyaltyCurrecyId": "currency123"
},
"achievePoints": true,
"completeProfile": false,
"connectTwitter": true,
"connectDiscord": true,
"connectEmail": true
},
"multiplierLoyaltyCurrencyIds": [
"currency123",
"currency456"
],
"verifyPlaceHolderText": "Enter your verification code here.",
"verificationTextMinimumLength": 10,
"buttonText": "Verify Now",
"telegramChannelId": "telegram-channel-123",
"twitterAccountUrl": "https://twitter.com/example_user",
"twitterPostUrl": "https://twitter.com/example/status/1234567890",
"checkLike": true,
"checkRepost": true,
"checkComment": true,
"maxLikes": 200,
"maxReposts": 200,
"maxComments": 200,
"reactionStats": {
"likeCount": 123,
"repostCount": 123,
"commentCount": 123,
"syncedAt": "<string>"
},
"checkText": "loyalty",
"requirePostLink": true,
"requirePostMediaLink": true,
"preGeneratedPostText": true,
"rewardCriteria": "IMPRESSIONS_COUNT",
"smartContract": {
"contractId": "123e4567-e89b-12d3-a456-426614174000",
"event": "Transfer",
"type": "event",
"criteria": "everyEvent",
"params": [
{
"name": "value",
"condition": ">=",
"value": "100"
}
],
"addressMapping": "0x123...789",
"amountMultiplier": {
"valueMapping": "amount"
}
},
"walletType": "evm",
"imageUrl": "https://example.com/image.png",
"onlyRewardSingleTokenOwnership": true,
"skipMultiplier": true,
"completeProfileConditions": {
"twitter": true,
"discord": false
},
"steamAppId": "1234567890",
"githubRepoUrl": "https://github.com/owner/repo",
"githubBranchName": "main",
"resetProgressOnClaim": true,
"rewardPerAction": true,
"rewardByBatch": true,
"batchSize": 100,
"youtubeVideoId": "1234567890",
"youtubeChannelId": "1234567890",
"redditPostId": "1234567890",
"isRestrictedToNewUsers": false,
"allowMultipleRedemptions": false,
"rewardBadgePerRange": false,
"swap": {
"relayReferrerId": "<string>",
"from": {
"chain": 123,
"tokens": [
{
"address": "<string>",
"chainId": "<string>"
}
],
"trackAmount": true
},
"to": {
"chain": 123,
"tokens": [
{
"address": "<string>",
"chainId": "<string>"
}
],
"trackAmount": true
},
"requireCrossChainSwap": true
},
"rewardPerValue": false,
"conditionDescription": "Complete the specific task on external platform",
"directRpc": false,
"erc20Type": "erc20",
"rewardQualityPosts": false,
"minimumFollowerCount": 25,
"autoCheckInRuleIds": [
"123e4567-e89b-12d3-a456-426614174000"
],
"robinhoodSymbols": [
"<string>"
]
},
"backgroundAssetUrl": "https://example.com/background.png",
"description": "A loyalty rule rewarding users for referrals.",
"network": "mainnet",
"customRewardsCsvUrl": "https://example.com/rewards.csv",
"customRewardsApiUrl": "https://api.example.com/rewards",
"subscriptionId": "sub12345",
"functionId": "func12345",
"collectionAddress": "0x1234567890abcdef1234567890abcdef12345678",
"collections": [
{
"address": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"network": "mainnet",
"symbol": "COLL"
}
],
"hideInUi": false,
"trackProgress": true,
"progressType": "percentage",
"showBeforeStart": false,
"isRequired": true,
"oauthCredentialsId": "123e4567-e89b-12d3-a456-426614174003",
"loyaltyCurrencyId": "456e1234-e89b-12d3-a456-426614174003",
"tokenReward": {
"relayerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isNative": true
},
"loyaltyRuleGroupId": "123e4567-e89b-12d3-a456-426614174004",
"rewardType": "points",
"loyaltyBadgeId": "123e4567-e89b-12d3-a456-426614174004",
"mediaUrl": "https://example.com/media.png",
"loyaltyUserAllotmentCsvUrl": "https://example.com/loyalty-user-allotment.csv",
"maxAmountPerInterval": 100,
"maxAmountInterval": "daily",
"shopifyStoreUrl": "https://example.com",
"externalIntegrationId": "123e4567-e89b-12d3-a456-426614174005",
"duplicatedFromId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rewardLifetime": "permanent",
"claimType": "auto",
"contractIds": [
"123e4567-e89b-12d3-a456-426614174005"
],
"dappDeployedWithin": "daily",
"dappDataWindow": "daily",
"isDappRule": false
}"Forbidden, Could not validate api key"Create Loyalty Rule
Create a new Loyalty Rule
curl --request POST \
--url https://admin.snagsolutions.io/api/loyalty/rules \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"websiteId": "123e4567-e89b-12d3-a456-426614174002",
"name": "Referral Bonus Rule",
"type": "TokenHold",
"frequency": "daily",
"interval": "weekly",
"startTime": "2024-01-01T00:00:00Z",
"endTime": "2024-12-31T23:59:00Z",
"effectiveStartTime": "2024-01-01T00:00:00Z",
"effectiveEndTime": "2024-12-31T23:59:00Z",
"amount": "10.5",
"metadata": {
"isCheckInOnEveryTxn": true,
"hasPaidFullRoyalty": false,
"royaltyAddress": "0x1234567890abcdef1234567890abcdef12345678",
"royaltyPercentage": 5,
"hasVerifiedTwitter": true,
"onlyRewardExistingUser": true,
"hasNeverSold": false,
"onlyNative": true,
"hasFillSource": true,
"fillSource": "opensea.io",
"liquidity": {
"network": "mainnet",
"protocol": "Uniswap V2",
"onlyRewardInRangeLiquidity": true,
"liquidityPerDay": 1000,
"customFunction": "x = y * 1000",
"calculationType": "fixed",
"pools": [
{
"id": "0xabcdefabcdefabcdefabcdefabcdefabcdef"
}
]
},
"twitterUsername": "@example_user",
"twitterUserId": "1234567890",
"twitterHashtag": "#loyalty",
"enableVerifiedMultiplier": true,
"verifiedMultiplier": 1.5,
"isMultiplierApplied": true,
"onlyKnownUsers": false,
"firstReferralReward": 10,
"referrerReward": 50,
"referrerRewardLoyaltyCurrencyId": "1234567890",
"secondReferralReward": 5,
"enableStreaks": true,
"promoCode": "PROMO123",
"promoCodeType": "code",
"promoCodeLength": 10,
"promoCodeCsvUrl": "https://example.com/promo_codes.csv",
"enableJoinDiscordServers": true,
"discordServersToJoin": [
{
"id": "123456789012345678",
"channels": [
{
"id": "987654321098765432",
"text": "Hello",
"emojis": [
{
"id": "1f600"
}
]
}
],
"roles": [
{
"id": "role123"
}
]
}
],
"streakArray": [
{
"streakMilestone": 5,
"streakAmount": 10
}
],
"dripQuestsToComplete": [
{
"id": "drip123"
}
],
"collection": [
{
"address": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"network": "mainnet",
"multiplier": 2
}
],
"range": [
{
"startRange": 1,
"endRange": 10,
"amount": 5,
"loyaltyBadgeId": "badge123",
"loyaltyMultiplierAmount": 1.5
}
],
"customRewardsApiKey": "api-key-1234",
"link": "https://example.com",
"socialPlatform": "X(Twitter)",
"socialPlatformName": "Twitter",
"socialPlatformLogo": "https://example.com/logo.png",
"rewardPerImpression": true,
"snapshotProposals": [
{
"id": "proposal123",
"space": "space123"
}
],
"cta": {
"label": "Click Here",
"href": "https://example.com"
},
"hasSaleCurrency": false,
"isTokenHoldMultiplier": true,
"saleCurrency": "USD",
"isRetroactive": true,
"timeDelayToVerifySeconds": 300,
"referralRequirements": {
"points": {
"amount": 50,
"loyaltyCurrecyId": "currency123"
},
"achievePoints": true,
"completeProfile": false,
"connectTwitter": true,
"connectDiscord": true,
"connectEmail": true
},
"multiplierLoyaltyCurrencyIds": [
"currency123",
"currency456"
],
"verifyPlaceHolderText": "Enter your verification code here.",
"verificationTextMinimumLength": 10,
"buttonText": "Verify Now",
"telegramChannelId": "telegram-channel-123",
"twitterAccountUrl": "https://twitter.com/example_user",
"twitterPostUrl": "https://twitter.com/example/status/1234567890",
"checkLike": true,
"checkRepost": true,
"checkComment": true,
"maxLikes": 200,
"maxReposts": 200,
"maxComments": 200,
"reactionStats": {
"likeCount": 123,
"repostCount": 123,
"commentCount": 123,
"syncedAt": "<string>"
},
"checkText": "loyalty",
"requirePostLink": true,
"requirePostMediaLink": true,
"preGeneratedPostText": true,
"rewardCriteria": "IMPRESSIONS_COUNT",
"smartContract": {
"contractId": "123e4567-e89b-12d3-a456-426614174000",
"event": "Transfer",
"type": "event",
"criteria": "everyEvent",
"params": [
{
"name": "value",
"condition": ">=",
"value": "100"
}
],
"addressMapping": "0x123...789",
"amountMultiplier": {
"valueMapping": "amount"
}
},
"walletType": "evm",
"imageUrl": "https://example.com/image.png",
"onlyRewardSingleTokenOwnership": true,
"skipMultiplier": true,
"completeProfileConditions": {
"twitter": true,
"discord": false
},
"steamAppId": "1234567890",
"githubRepoUrl": "https://github.com/owner/repo",
"githubBranchName": "main",
"resetProgressOnClaim": true,
"rewardPerAction": true,
"rewardByBatch": true,
"batchSize": 100,
"youtubeVideoId": "1234567890",
"youtubeChannelId": "1234567890",
"redditPostId": "1234567890",
"isRestrictedToNewUsers": false,
"allowMultipleRedemptions": false,
"rewardBadgePerRange": false,
"swap": {
"relayReferrerId": "<string>",
"from": {
"chain": "any",
"tokens": [
{
"address": "<string>",
"chainId": "<string>"
}
],
"trackAmount": true
},
"to": {
"chain": "any",
"tokens": [
{
"address": "<string>",
"chainId": "<string>"
}
],
"trackAmount": true
},
"requireCrossChainSwap": true
},
"rewardPerValue": false,
"conditionDescription": "Complete the specific task on external platform",
"directRpc": false,
"erc20Type": "erc20",
"rewardQualityPosts": false,
"minimumFollowerCount": 25,
"autoCheckInRuleIds": [
"123e4567-e89b-12d3-a456-426614174000"
],
"robinhoodSymbols": [
"<string>"
]
},
"backgroundAssetUrl": "https://example.com/background.png",
"description": "A loyalty rule rewarding users for referrals.",
"network": "mainnet",
"customRewardsCsvUrl": "https://example.com/rewards.csv",
"customRewardsApiUrl": "https://api.example.com/rewards",
"subscriptionId": "sub12345",
"functionId": "func12345",
"collectionAddress": "0x1234567890abcdef1234567890abcdef12345678",
"collections": [
{
"address": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"network": "mainnet",
"symbol": "COLL"
}
],
"hideInUi": false,
"trackProgress": true,
"progressType": "percentage",
"showBeforeStart": false,
"isRequired": true,
"oauthCredentialsId": "123e4567-e89b-12d3-a456-426614174003",
"loyaltyCurrencyId": "456e1234-e89b-12d3-a456-426614174003",
"loyaltyRuleGroupId": "123e4567-e89b-12d3-a456-426614174004",
"rewardType": "points",
"loyaltyBadgeId": "123e4567-e89b-12d3-a456-426614174004",
"mediaUrl": "https://example.com/media.png",
"loyaltyUserAllotmentCsvUrl": "https://example.com/loyalty-user-allotment.csv",
"maxAmountPerInterval": 100,
"maxAmountInterval": "daily",
"shopifyStoreUrl": "https://example.com",
"externalIntegrationId": "123e4567-e89b-12d3-a456-426614174005",
"duplicatedFromId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rewardLifetime": "permanent",
"claimType": "auto",
"contractIds": [
"123e4567-e89b-12d3-a456-426614174005"
],
"dappDeployedWithin": "daily",
"dappDataWindow": "daily",
"isDappRule": false
}
'import requests
url = "https://admin.snagsolutions.io/api/loyalty/rules"
payload = {
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"websiteId": "123e4567-e89b-12d3-a456-426614174002",
"name": "Referral Bonus Rule",
"type": "TokenHold",
"frequency": "daily",
"interval": "weekly",
"startTime": "2024-01-01T00:00:00Z",
"endTime": "2024-12-31T23:59:00Z",
"effectiveStartTime": "2024-01-01T00:00:00Z",
"effectiveEndTime": "2024-12-31T23:59:00Z",
"amount": "10.5",
"metadata": {
"isCheckInOnEveryTxn": True,
"hasPaidFullRoyalty": False,
"royaltyAddress": "0x1234567890abcdef1234567890abcdef12345678",
"royaltyPercentage": 5,
"hasVerifiedTwitter": True,
"onlyRewardExistingUser": True,
"hasNeverSold": False,
"onlyNative": True,
"hasFillSource": True,
"fillSource": "opensea.io",
"liquidity": {
"network": "mainnet",
"protocol": "Uniswap V2",
"onlyRewardInRangeLiquidity": True,
"liquidityPerDay": 1000,
"customFunction": "x = y * 1000",
"calculationType": "fixed",
"pools": [{ "id": "0xabcdefabcdefabcdefabcdefabcdefabcdef" }]
},
"twitterUsername": "@example_user",
"twitterUserId": "1234567890",
"twitterHashtag": "#loyalty",
"enableVerifiedMultiplier": True,
"verifiedMultiplier": 1.5,
"isMultiplierApplied": True,
"onlyKnownUsers": False,
"firstReferralReward": 10,
"referrerReward": 50,
"referrerRewardLoyaltyCurrencyId": "1234567890",
"secondReferralReward": 5,
"enableStreaks": True,
"promoCode": "PROMO123",
"promoCodeType": "code",
"promoCodeLength": 10,
"promoCodeCsvUrl": "https://example.com/promo_codes.csv",
"enableJoinDiscordServers": True,
"discordServersToJoin": [
{
"id": "123456789012345678",
"channels": [
{
"id": "987654321098765432",
"text": "Hello",
"emojis": [{ "id": "1f600" }]
}
],
"roles": [{ "id": "role123" }]
}
],
"streakArray": [
{
"streakMilestone": 5,
"streakAmount": 10
}
],
"dripQuestsToComplete": [{ "id": "drip123" }],
"collection": [
{
"address": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"network": "mainnet",
"multiplier": 2
}
],
"range": [
{
"startRange": 1,
"endRange": 10,
"amount": 5,
"loyaltyBadgeId": "badge123",
"loyaltyMultiplierAmount": 1.5
}
],
"customRewardsApiKey": "api-key-1234",
"link": "https://example.com",
"socialPlatform": "X(Twitter)",
"socialPlatformName": "Twitter",
"socialPlatformLogo": "https://example.com/logo.png",
"rewardPerImpression": True,
"snapshotProposals": [
{
"id": "proposal123",
"space": "space123"
}
],
"cta": {
"label": "Click Here",
"href": "https://example.com"
},
"hasSaleCurrency": False,
"isTokenHoldMultiplier": True,
"saleCurrency": "USD",
"isRetroactive": True,
"timeDelayToVerifySeconds": 300,
"referralRequirements": {
"points": {
"amount": 50,
"loyaltyCurrecyId": "currency123"
},
"achievePoints": True,
"completeProfile": False,
"connectTwitter": True,
"connectDiscord": True,
"connectEmail": True
},
"multiplierLoyaltyCurrencyIds": ["currency123", "currency456"],
"verifyPlaceHolderText": "Enter your verification code here.",
"verificationTextMinimumLength": 10,
"buttonText": "Verify Now",
"telegramChannelId": "telegram-channel-123",
"twitterAccountUrl": "https://twitter.com/example_user",
"twitterPostUrl": "https://twitter.com/example/status/1234567890",
"checkLike": True,
"checkRepost": True,
"checkComment": True,
"maxLikes": 200,
"maxReposts": 200,
"maxComments": 200,
"reactionStats": {
"likeCount": 123,
"repostCount": 123,
"commentCount": 123,
"syncedAt": "<string>"
},
"checkText": "loyalty",
"requirePostLink": True,
"requirePostMediaLink": True,
"preGeneratedPostText": True,
"rewardCriteria": "IMPRESSIONS_COUNT",
"smartContract": {
"contractId": "123e4567-e89b-12d3-a456-426614174000",
"event": "Transfer",
"type": "event",
"criteria": "everyEvent",
"params": [
{
"name": "value",
"condition": ">=",
"value": "100"
}
],
"addressMapping": "0x123...789",
"amountMultiplier": { "valueMapping": "amount" }
},
"walletType": "evm",
"imageUrl": "https://example.com/image.png",
"onlyRewardSingleTokenOwnership": True,
"skipMultiplier": True,
"completeProfileConditions": {
"twitter": True,
"discord": False
},
"steamAppId": "1234567890",
"githubRepoUrl": "https://github.com/owner/repo",
"githubBranchName": "main",
"resetProgressOnClaim": True,
"rewardPerAction": True,
"rewardByBatch": True,
"batchSize": 100,
"youtubeVideoId": "1234567890",
"youtubeChannelId": "1234567890",
"redditPostId": "1234567890",
"isRestrictedToNewUsers": False,
"allowMultipleRedemptions": False,
"rewardBadgePerRange": False,
"swap": {
"relayReferrerId": "<string>",
"from": {
"chain": "any",
"tokens": [
{
"address": "<string>",
"chainId": "<string>"
}
],
"trackAmount": True
},
"to": {
"chain": "any",
"tokens": [
{
"address": "<string>",
"chainId": "<string>"
}
],
"trackAmount": True
},
"requireCrossChainSwap": True
},
"rewardPerValue": False,
"conditionDescription": "Complete the specific task on external platform",
"directRpc": False,
"erc20Type": "erc20",
"rewardQualityPosts": False,
"minimumFollowerCount": 25,
"autoCheckInRuleIds": ["123e4567-e89b-12d3-a456-426614174000"],
"robinhoodSymbols": ["<string>"]
},
"backgroundAssetUrl": "https://example.com/background.png",
"description": "A loyalty rule rewarding users for referrals.",
"network": "mainnet",
"customRewardsCsvUrl": "https://example.com/rewards.csv",
"customRewardsApiUrl": "https://api.example.com/rewards",
"subscriptionId": "sub12345",
"functionId": "func12345",
"collectionAddress": "0x1234567890abcdef1234567890abcdef12345678",
"collections": [
{
"address": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"network": "mainnet",
"symbol": "COLL"
}
],
"hideInUi": False,
"trackProgress": True,
"progressType": "percentage",
"showBeforeStart": False,
"isRequired": True,
"oauthCredentialsId": "123e4567-e89b-12d3-a456-426614174003",
"loyaltyCurrencyId": "456e1234-e89b-12d3-a456-426614174003",
"loyaltyRuleGroupId": "123e4567-e89b-12d3-a456-426614174004",
"rewardType": "points",
"loyaltyBadgeId": "123e4567-e89b-12d3-a456-426614174004",
"mediaUrl": "https://example.com/media.png",
"loyaltyUserAllotmentCsvUrl": "https://example.com/loyalty-user-allotment.csv",
"maxAmountPerInterval": 100,
"maxAmountInterval": "daily",
"shopifyStoreUrl": "https://example.com",
"externalIntegrationId": "123e4567-e89b-12d3-a456-426614174005",
"duplicatedFromId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rewardLifetime": "permanent",
"claimType": "auto",
"contractIds": ["123e4567-e89b-12d3-a456-426614174005"],
"dappDeployedWithin": "daily",
"dappDataWindow": "daily",
"isDappRule": False
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
organizationId: '123e4567-e89b-12d3-a456-426614174001',
websiteId: '123e4567-e89b-12d3-a456-426614174002',
name: 'Referral Bonus Rule',
type: 'TokenHold',
frequency: 'daily',
interval: 'weekly',
startTime: '2024-01-01T00:00:00Z',
endTime: '2024-12-31T23:59:00Z',
effectiveStartTime: '2024-01-01T00:00:00Z',
effectiveEndTime: '2024-12-31T23:59:00Z',
amount: '10.5',
metadata: {
isCheckInOnEveryTxn: true,
hasPaidFullRoyalty: false,
royaltyAddress: '0x1234567890abcdef1234567890abcdef12345678',
royaltyPercentage: 5,
hasVerifiedTwitter: true,
onlyRewardExistingUser: true,
hasNeverSold: false,
onlyNative: true,
hasFillSource: true,
fillSource: 'opensea.io',
liquidity: {
network: 'mainnet',
protocol: 'Uniswap V2',
onlyRewardInRangeLiquidity: true,
liquidityPerDay: 1000,
customFunction: 'x = y * 1000',
calculationType: 'fixed',
pools: [{id: '0xabcdefabcdefabcdefabcdefabcdefabcdef'}]
},
twitterUsername: '@example_user',
twitterUserId: '1234567890',
twitterHashtag: '#loyalty',
enableVerifiedMultiplier: true,
verifiedMultiplier: 1.5,
isMultiplierApplied: true,
onlyKnownUsers: false,
firstReferralReward: 10,
referrerReward: 50,
referrerRewardLoyaltyCurrencyId: '1234567890',
secondReferralReward: 5,
enableStreaks: true,
promoCode: 'PROMO123',
promoCodeType: 'code',
promoCodeLength: 10,
promoCodeCsvUrl: 'https://example.com/promo_codes.csv',
enableJoinDiscordServers: true,
discordServersToJoin: [
{
id: '123456789012345678',
channels: [{id: '987654321098765432', text: 'Hello', emojis: [{id: '1f600'}]}],
roles: [{id: 'role123'}]
}
],
streakArray: [{streakMilestone: 5, streakAmount: 10}],
dripQuestsToComplete: [{id: 'drip123'}],
collection: [
{
address: '0xabcdefabcdefabcdefabcdefabcdefabcdef',
network: 'mainnet',
multiplier: 2
}
],
range: [
{
startRange: 1,
endRange: 10,
amount: 5,
loyaltyBadgeId: 'badge123',
loyaltyMultiplierAmount: 1.5
}
],
customRewardsApiKey: 'api-key-1234',
link: 'https://example.com',
socialPlatform: 'X(Twitter)',
socialPlatformName: 'Twitter',
socialPlatformLogo: 'https://example.com/logo.png',
rewardPerImpression: true,
snapshotProposals: [{id: 'proposal123', space: 'space123'}],
cta: {label: 'Click Here', href: 'https://example.com'},
hasSaleCurrency: false,
isTokenHoldMultiplier: true,
saleCurrency: 'USD',
isRetroactive: true,
timeDelayToVerifySeconds: 300,
referralRequirements: {
points: {amount: 50, loyaltyCurrecyId: 'currency123'},
achievePoints: true,
completeProfile: false,
connectTwitter: true,
connectDiscord: true,
connectEmail: true
},
multiplierLoyaltyCurrencyIds: ['currency123', 'currency456'],
verifyPlaceHolderText: 'Enter your verification code here.',
verificationTextMinimumLength: 10,
buttonText: 'Verify Now',
telegramChannelId: 'telegram-channel-123',
twitterAccountUrl: 'https://twitter.com/example_user',
twitterPostUrl: 'https://twitter.com/example/status/1234567890',
checkLike: true,
checkRepost: true,
checkComment: true,
maxLikes: 200,
maxReposts: 200,
maxComments: 200,
reactionStats: {likeCount: 123, repostCount: 123, commentCount: 123, syncedAt: '<string>'},
checkText: 'loyalty',
requirePostLink: true,
requirePostMediaLink: true,
preGeneratedPostText: true,
rewardCriteria: 'IMPRESSIONS_COUNT',
smartContract: {
contractId: '123e4567-e89b-12d3-a456-426614174000',
event: 'Transfer',
type: 'event',
criteria: 'everyEvent',
params: [{name: 'value', condition: '>=', value: '100'}],
addressMapping: '0x123...789',
amountMultiplier: {valueMapping: 'amount'}
},
walletType: 'evm',
imageUrl: 'https://example.com/image.png',
onlyRewardSingleTokenOwnership: true,
skipMultiplier: true,
completeProfileConditions: {twitter: true, discord: false},
steamAppId: '1234567890',
githubRepoUrl: 'https://github.com/owner/repo',
githubBranchName: 'main',
resetProgressOnClaim: true,
rewardPerAction: true,
rewardByBatch: true,
batchSize: 100,
youtubeVideoId: '1234567890',
youtubeChannelId: '1234567890',
redditPostId: '1234567890',
isRestrictedToNewUsers: false,
allowMultipleRedemptions: false,
rewardBadgePerRange: false,
swap: {
relayReferrerId: '<string>',
from: {
chain: 'any',
tokens: [{address: '<string>', chainId: '<string>'}],
trackAmount: true
},
to: {
chain: 'any',
tokens: [{address: '<string>', chainId: '<string>'}],
trackAmount: true
},
requireCrossChainSwap: true
},
rewardPerValue: false,
conditionDescription: 'Complete the specific task on external platform',
directRpc: false,
erc20Type: 'erc20',
rewardQualityPosts: false,
minimumFollowerCount: 25,
autoCheckInRuleIds: ['123e4567-e89b-12d3-a456-426614174000'],
robinhoodSymbols: ['<string>']
},
backgroundAssetUrl: 'https://example.com/background.png',
description: 'A loyalty rule rewarding users for referrals.',
network: 'mainnet',
customRewardsCsvUrl: 'https://example.com/rewards.csv',
customRewardsApiUrl: 'https://api.example.com/rewards',
subscriptionId: 'sub12345',
functionId: 'func12345',
collectionAddress: '0x1234567890abcdef1234567890abcdef12345678',
collections: [
{
address: '0xabcdefabcdefabcdefabcdefabcdefabcdef',
network: 'mainnet',
symbol: 'COLL'
}
],
hideInUi: false,
trackProgress: true,
progressType: 'percentage',
showBeforeStart: false,
isRequired: true,
oauthCredentialsId: '123e4567-e89b-12d3-a456-426614174003',
loyaltyCurrencyId: '456e1234-e89b-12d3-a456-426614174003',
loyaltyRuleGroupId: '123e4567-e89b-12d3-a456-426614174004',
rewardType: 'points',
loyaltyBadgeId: '123e4567-e89b-12d3-a456-426614174004',
mediaUrl: 'https://example.com/media.png',
loyaltyUserAllotmentCsvUrl: 'https://example.com/loyalty-user-allotment.csv',
maxAmountPerInterval: 100,
maxAmountInterval: 'daily',
shopifyStoreUrl: 'https://example.com',
externalIntegrationId: '123e4567-e89b-12d3-a456-426614174005',
duplicatedFromId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
rewardLifetime: 'permanent',
claimType: 'auto',
contractIds: ['123e4567-e89b-12d3-a456-426614174005'],
dappDeployedWithin: 'daily',
dappDataWindow: 'daily',
isDappRule: false
})
};
fetch('https://admin.snagsolutions.io/api/loyalty/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://admin.snagsolutions.io/api/loyalty/rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'organizationId' => '123e4567-e89b-12d3-a456-426614174001',
'websiteId' => '123e4567-e89b-12d3-a456-426614174002',
'name' => 'Referral Bonus Rule',
'type' => 'TokenHold',
'frequency' => 'daily',
'interval' => 'weekly',
'startTime' => '2024-01-01T00:00:00Z',
'endTime' => '2024-12-31T23:59:00Z',
'effectiveStartTime' => '2024-01-01T00:00:00Z',
'effectiveEndTime' => '2024-12-31T23:59:00Z',
'amount' => '10.5',
'metadata' => [
'isCheckInOnEveryTxn' => true,
'hasPaidFullRoyalty' => false,
'royaltyAddress' => '0x1234567890abcdef1234567890abcdef12345678',
'royaltyPercentage' => 5,
'hasVerifiedTwitter' => true,
'onlyRewardExistingUser' => true,
'hasNeverSold' => false,
'onlyNative' => true,
'hasFillSource' => true,
'fillSource' => 'opensea.io',
'liquidity' => [
'network' => 'mainnet',
'protocol' => 'Uniswap V2',
'onlyRewardInRangeLiquidity' => true,
'liquidityPerDay' => 1000,
'customFunction' => 'x = y * 1000',
'calculationType' => 'fixed',
'pools' => [
[
'id' => '0xabcdefabcdefabcdefabcdefabcdefabcdef'
]
]
],
'twitterUsername' => '@example_user',
'twitterUserId' => '1234567890',
'twitterHashtag' => '#loyalty',
'enableVerifiedMultiplier' => true,
'verifiedMultiplier' => 1.5,
'isMultiplierApplied' => true,
'onlyKnownUsers' => false,
'firstReferralReward' => 10,
'referrerReward' => 50,
'referrerRewardLoyaltyCurrencyId' => '1234567890',
'secondReferralReward' => 5,
'enableStreaks' => true,
'promoCode' => 'PROMO123',
'promoCodeType' => 'code',
'promoCodeLength' => 10,
'promoCodeCsvUrl' => 'https://example.com/promo_codes.csv',
'enableJoinDiscordServers' => true,
'discordServersToJoin' => [
[
'id' => '123456789012345678',
'channels' => [
[
'id' => '987654321098765432',
'text' => 'Hello',
'emojis' => [
[
'id' => '1f600'
]
]
]
],
'roles' => [
[
'id' => 'role123'
]
]
]
],
'streakArray' => [
[
'streakMilestone' => 5,
'streakAmount' => 10
]
],
'dripQuestsToComplete' => [
[
'id' => 'drip123'
]
],
'collection' => [
[
'address' => '0xabcdefabcdefabcdefabcdefabcdefabcdef',
'network' => 'mainnet',
'multiplier' => 2
]
],
'range' => [
[
'startRange' => 1,
'endRange' => 10,
'amount' => 5,
'loyaltyBadgeId' => 'badge123',
'loyaltyMultiplierAmount' => 1.5
]
],
'customRewardsApiKey' => 'api-key-1234',
'link' => 'https://example.com',
'socialPlatform' => 'X(Twitter)',
'socialPlatformName' => 'Twitter',
'socialPlatformLogo' => 'https://example.com/logo.png',
'rewardPerImpression' => true,
'snapshotProposals' => [
[
'id' => 'proposal123',
'space' => 'space123'
]
],
'cta' => [
'label' => 'Click Here',
'href' => 'https://example.com'
],
'hasSaleCurrency' => false,
'isTokenHoldMultiplier' => true,
'saleCurrency' => 'USD',
'isRetroactive' => true,
'timeDelayToVerifySeconds' => 300,
'referralRequirements' => [
'points' => [
'amount' => 50,
'loyaltyCurrecyId' => 'currency123'
],
'achievePoints' => true,
'completeProfile' => false,
'connectTwitter' => true,
'connectDiscord' => true,
'connectEmail' => true
],
'multiplierLoyaltyCurrencyIds' => [
'currency123',
'currency456'
],
'verifyPlaceHolderText' => 'Enter your verification code here.',
'verificationTextMinimumLength' => 10,
'buttonText' => 'Verify Now',
'telegramChannelId' => 'telegram-channel-123',
'twitterAccountUrl' => 'https://twitter.com/example_user',
'twitterPostUrl' => 'https://twitter.com/example/status/1234567890',
'checkLike' => true,
'checkRepost' => true,
'checkComment' => true,
'maxLikes' => 200,
'maxReposts' => 200,
'maxComments' => 200,
'reactionStats' => [
'likeCount' => 123,
'repostCount' => 123,
'commentCount' => 123,
'syncedAt' => '<string>'
],
'checkText' => 'loyalty',
'requirePostLink' => true,
'requirePostMediaLink' => true,
'preGeneratedPostText' => true,
'rewardCriteria' => 'IMPRESSIONS_COUNT',
'smartContract' => [
'contractId' => '123e4567-e89b-12d3-a456-426614174000',
'event' => 'Transfer',
'type' => 'event',
'criteria' => 'everyEvent',
'params' => [
[
'name' => 'value',
'condition' => '>=',
'value' => '100'
]
],
'addressMapping' => '0x123...789',
'amountMultiplier' => [
'valueMapping' => 'amount'
]
],
'walletType' => 'evm',
'imageUrl' => 'https://example.com/image.png',
'onlyRewardSingleTokenOwnership' => true,
'skipMultiplier' => true,
'completeProfileConditions' => [
'twitter' => true,
'discord' => false
],
'steamAppId' => '1234567890',
'githubRepoUrl' => 'https://github.com/owner/repo',
'githubBranchName' => 'main',
'resetProgressOnClaim' => true,
'rewardPerAction' => true,
'rewardByBatch' => true,
'batchSize' => 100,
'youtubeVideoId' => '1234567890',
'youtubeChannelId' => '1234567890',
'redditPostId' => '1234567890',
'isRestrictedToNewUsers' => false,
'allowMultipleRedemptions' => false,
'rewardBadgePerRange' => false,
'swap' => [
'relayReferrerId' => '<string>',
'from' => [
'chain' => 'any',
'tokens' => [
[
'address' => '<string>',
'chainId' => '<string>'
]
],
'trackAmount' => true
],
'to' => [
'chain' => 'any',
'tokens' => [
[
'address' => '<string>',
'chainId' => '<string>'
]
],
'trackAmount' => true
],
'requireCrossChainSwap' => true
],
'rewardPerValue' => false,
'conditionDescription' => 'Complete the specific task on external platform',
'directRpc' => false,
'erc20Type' => 'erc20',
'rewardQualityPosts' => false,
'minimumFollowerCount' => 25,
'autoCheckInRuleIds' => [
'123e4567-e89b-12d3-a456-426614174000'
],
'robinhoodSymbols' => [
'<string>'
]
],
'backgroundAssetUrl' => 'https://example.com/background.png',
'description' => 'A loyalty rule rewarding users for referrals.',
'network' => 'mainnet',
'customRewardsCsvUrl' => 'https://example.com/rewards.csv',
'customRewardsApiUrl' => 'https://api.example.com/rewards',
'subscriptionId' => 'sub12345',
'functionId' => 'func12345',
'collectionAddress' => '0x1234567890abcdef1234567890abcdef12345678',
'collections' => [
[
'address' => '0xabcdefabcdefabcdefabcdefabcdefabcdef',
'network' => 'mainnet',
'symbol' => 'COLL'
]
],
'hideInUi' => false,
'trackProgress' => true,
'progressType' => 'percentage',
'showBeforeStart' => false,
'isRequired' => true,
'oauthCredentialsId' => '123e4567-e89b-12d3-a456-426614174003',
'loyaltyCurrencyId' => '456e1234-e89b-12d3-a456-426614174003',
'loyaltyRuleGroupId' => '123e4567-e89b-12d3-a456-426614174004',
'rewardType' => 'points',
'loyaltyBadgeId' => '123e4567-e89b-12d3-a456-426614174004',
'mediaUrl' => 'https://example.com/media.png',
'loyaltyUserAllotmentCsvUrl' => 'https://example.com/loyalty-user-allotment.csv',
'maxAmountPerInterval' => 100,
'maxAmountInterval' => 'daily',
'shopifyStoreUrl' => 'https://example.com',
'externalIntegrationId' => '123e4567-e89b-12d3-a456-426614174005',
'duplicatedFromId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'rewardLifetime' => 'permanent',
'claimType' => 'auto',
'contractIds' => [
'123e4567-e89b-12d3-a456-426614174005'
],
'dappDeployedWithin' => 'daily',
'dappDataWindow' => 'daily',
'isDappRule' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://admin.snagsolutions.io/api/loyalty/rules"
payload := strings.NewReader("{\n \"organizationId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"websiteId\": \"123e4567-e89b-12d3-a456-426614174002\",\n \"name\": \"Referral Bonus Rule\",\n \"type\": \"TokenHold\",\n \"frequency\": \"daily\",\n \"interval\": \"weekly\",\n \"startTime\": \"2024-01-01T00:00:00Z\",\n \"endTime\": \"2024-12-31T23:59:00Z\",\n \"effectiveStartTime\": \"2024-01-01T00:00:00Z\",\n \"effectiveEndTime\": \"2024-12-31T23:59:00Z\",\n \"amount\": \"10.5\",\n \"metadata\": {\n \"isCheckInOnEveryTxn\": true,\n \"hasPaidFullRoyalty\": false,\n \"royaltyAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"royaltyPercentage\": 5,\n \"hasVerifiedTwitter\": true,\n \"onlyRewardExistingUser\": true,\n \"hasNeverSold\": false,\n \"onlyNative\": true,\n \"hasFillSource\": true,\n \"fillSource\": \"opensea.io\",\n \"liquidity\": {\n \"network\": \"mainnet\",\n \"protocol\": \"Uniswap V2\",\n \"onlyRewardInRangeLiquidity\": true,\n \"liquidityPerDay\": 1000,\n \"customFunction\": \"x = y * 1000\",\n \"calculationType\": \"fixed\",\n \"pools\": [\n {\n \"id\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\"\n }\n ]\n },\n \"twitterUsername\": \"@example_user\",\n \"twitterUserId\": \"1234567890\",\n \"twitterHashtag\": \"#loyalty\",\n \"enableVerifiedMultiplier\": true,\n \"verifiedMultiplier\": 1.5,\n \"isMultiplierApplied\": true,\n \"onlyKnownUsers\": false,\n \"firstReferralReward\": 10,\n \"referrerReward\": 50,\n \"referrerRewardLoyaltyCurrencyId\": \"1234567890\",\n \"secondReferralReward\": 5,\n \"enableStreaks\": true,\n \"promoCode\": \"PROMO123\",\n \"promoCodeType\": \"code\",\n \"promoCodeLength\": 10,\n \"promoCodeCsvUrl\": \"https://example.com/promo_codes.csv\",\n \"enableJoinDiscordServers\": true,\n \"discordServersToJoin\": [\n {\n \"id\": \"123456789012345678\",\n \"channels\": [\n {\n \"id\": \"987654321098765432\",\n \"text\": \"Hello\",\n \"emojis\": [\n {\n \"id\": \"1f600\"\n }\n ]\n }\n ],\n \"roles\": [\n {\n \"id\": \"role123\"\n }\n ]\n }\n ],\n \"streakArray\": [\n {\n \"streakMilestone\": 5,\n \"streakAmount\": 10\n }\n ],\n \"dripQuestsToComplete\": [\n {\n \"id\": \"drip123\"\n }\n ],\n \"collection\": [\n {\n \"address\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\",\n \"network\": \"mainnet\",\n \"multiplier\": 2\n }\n ],\n \"range\": [\n {\n \"startRange\": 1,\n \"endRange\": 10,\n \"amount\": 5,\n \"loyaltyBadgeId\": \"badge123\",\n \"loyaltyMultiplierAmount\": 1.5\n }\n ],\n \"customRewardsApiKey\": \"api-key-1234\",\n \"link\": \"https://example.com\",\n \"socialPlatform\": \"X(Twitter)\",\n \"socialPlatformName\": \"Twitter\",\n \"socialPlatformLogo\": \"https://example.com/logo.png\",\n \"rewardPerImpression\": true,\n \"snapshotProposals\": [\n {\n \"id\": \"proposal123\",\n \"space\": \"space123\"\n }\n ],\n \"cta\": {\n \"label\": \"Click Here\",\n \"href\": \"https://example.com\"\n },\n \"hasSaleCurrency\": false,\n \"isTokenHoldMultiplier\": true,\n \"saleCurrency\": \"USD\",\n \"isRetroactive\": true,\n \"timeDelayToVerifySeconds\": 300,\n \"referralRequirements\": {\n \"points\": {\n \"amount\": 50,\n \"loyaltyCurrecyId\": \"currency123\"\n },\n \"achievePoints\": true,\n \"completeProfile\": false,\n \"connectTwitter\": true,\n \"connectDiscord\": true,\n \"connectEmail\": true\n },\n \"multiplierLoyaltyCurrencyIds\": [\n \"currency123\",\n \"currency456\"\n ],\n \"verifyPlaceHolderText\": \"Enter your verification code here.\",\n \"verificationTextMinimumLength\": 10,\n \"buttonText\": \"Verify Now\",\n \"telegramChannelId\": \"telegram-channel-123\",\n \"twitterAccountUrl\": \"https://twitter.com/example_user\",\n \"twitterPostUrl\": \"https://twitter.com/example/status/1234567890\",\n \"checkLike\": true,\n \"checkRepost\": true,\n \"checkComment\": true,\n \"maxLikes\": 200,\n \"maxReposts\": 200,\n \"maxComments\": 200,\n \"reactionStats\": {\n \"likeCount\": 123,\n \"repostCount\": 123,\n \"commentCount\": 123,\n \"syncedAt\": \"<string>\"\n },\n \"checkText\": \"loyalty\",\n \"requirePostLink\": true,\n \"requirePostMediaLink\": true,\n \"preGeneratedPostText\": true,\n \"rewardCriteria\": \"IMPRESSIONS_COUNT\",\n \"smartContract\": {\n \"contractId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"event\": \"Transfer\",\n \"type\": \"event\",\n \"criteria\": \"everyEvent\",\n \"params\": [\n {\n \"name\": \"value\",\n \"condition\": \">=\",\n \"value\": \"100\"\n }\n ],\n \"addressMapping\": \"0x123...789\",\n \"amountMultiplier\": {\n \"valueMapping\": \"amount\"\n }\n },\n \"walletType\": \"evm\",\n \"imageUrl\": \"https://example.com/image.png\",\n \"onlyRewardSingleTokenOwnership\": true,\n \"skipMultiplier\": true,\n \"completeProfileConditions\": {\n \"twitter\": true,\n \"discord\": false\n },\n \"steamAppId\": \"1234567890\",\n \"githubRepoUrl\": \"https://github.com/owner/repo\",\n \"githubBranchName\": \"main\",\n \"resetProgressOnClaim\": true,\n \"rewardPerAction\": true,\n \"rewardByBatch\": true,\n \"batchSize\": 100,\n \"youtubeVideoId\": \"1234567890\",\n \"youtubeChannelId\": \"1234567890\",\n \"redditPostId\": \"1234567890\",\n \"isRestrictedToNewUsers\": false,\n \"allowMultipleRedemptions\": false,\n \"rewardBadgePerRange\": false,\n \"swap\": {\n \"relayReferrerId\": \"<string>\",\n \"from\": {\n \"chain\": \"any\",\n \"tokens\": [\n {\n \"address\": \"<string>\",\n \"chainId\": \"<string>\"\n }\n ],\n \"trackAmount\": true\n },\n \"to\": {\n \"chain\": \"any\",\n \"tokens\": [\n {\n \"address\": \"<string>\",\n \"chainId\": \"<string>\"\n }\n ],\n \"trackAmount\": true\n },\n \"requireCrossChainSwap\": true\n },\n \"rewardPerValue\": false,\n \"conditionDescription\": \"Complete the specific task on external platform\",\n \"directRpc\": false,\n \"erc20Type\": \"erc20\",\n \"rewardQualityPosts\": false,\n \"minimumFollowerCount\": 25,\n \"autoCheckInRuleIds\": [\n \"123e4567-e89b-12d3-a456-426614174000\"\n ],\n \"robinhoodSymbols\": [\n \"<string>\"\n ]\n },\n \"backgroundAssetUrl\": \"https://example.com/background.png\",\n \"description\": \"A loyalty rule rewarding users for referrals.\",\n \"network\": \"mainnet\",\n \"customRewardsCsvUrl\": \"https://example.com/rewards.csv\",\n \"customRewardsApiUrl\": \"https://api.example.com/rewards\",\n \"subscriptionId\": \"sub12345\",\n \"functionId\": \"func12345\",\n \"collectionAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"collections\": [\n {\n \"address\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\",\n \"network\": \"mainnet\",\n \"symbol\": \"COLL\"\n }\n ],\n \"hideInUi\": false,\n \"trackProgress\": true,\n \"progressType\": \"percentage\",\n \"showBeforeStart\": false,\n \"isRequired\": true,\n \"oauthCredentialsId\": \"123e4567-e89b-12d3-a456-426614174003\",\n \"loyaltyCurrencyId\": \"456e1234-e89b-12d3-a456-426614174003\",\n \"loyaltyRuleGroupId\": \"123e4567-e89b-12d3-a456-426614174004\",\n \"rewardType\": \"points\",\n \"loyaltyBadgeId\": \"123e4567-e89b-12d3-a456-426614174004\",\n \"mediaUrl\": \"https://example.com/media.png\",\n \"loyaltyUserAllotmentCsvUrl\": \"https://example.com/loyalty-user-allotment.csv\",\n \"maxAmountPerInterval\": 100,\n \"maxAmountInterval\": \"daily\",\n \"shopifyStoreUrl\": \"https://example.com\",\n \"externalIntegrationId\": \"123e4567-e89b-12d3-a456-426614174005\",\n \"duplicatedFromId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rewardLifetime\": \"permanent\",\n \"claimType\": \"auto\",\n \"contractIds\": [\n \"123e4567-e89b-12d3-a456-426614174005\"\n ],\n \"dappDeployedWithin\": \"daily\",\n \"dappDataWindow\": \"daily\",\n \"isDappRule\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://admin.snagsolutions.io/api/loyalty/rules")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"organizationId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"websiteId\": \"123e4567-e89b-12d3-a456-426614174002\",\n \"name\": \"Referral Bonus Rule\",\n \"type\": \"TokenHold\",\n \"frequency\": \"daily\",\n \"interval\": \"weekly\",\n \"startTime\": \"2024-01-01T00:00:00Z\",\n \"endTime\": \"2024-12-31T23:59:00Z\",\n \"effectiveStartTime\": \"2024-01-01T00:00:00Z\",\n \"effectiveEndTime\": \"2024-12-31T23:59:00Z\",\n \"amount\": \"10.5\",\n \"metadata\": {\n \"isCheckInOnEveryTxn\": true,\n \"hasPaidFullRoyalty\": false,\n \"royaltyAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"royaltyPercentage\": 5,\n \"hasVerifiedTwitter\": true,\n \"onlyRewardExistingUser\": true,\n \"hasNeverSold\": false,\n \"onlyNative\": true,\n \"hasFillSource\": true,\n \"fillSource\": \"opensea.io\",\n \"liquidity\": {\n \"network\": \"mainnet\",\n \"protocol\": \"Uniswap V2\",\n \"onlyRewardInRangeLiquidity\": true,\n \"liquidityPerDay\": 1000,\n \"customFunction\": \"x = y * 1000\",\n \"calculationType\": \"fixed\",\n \"pools\": [\n {\n \"id\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\"\n }\n ]\n },\n \"twitterUsername\": \"@example_user\",\n \"twitterUserId\": \"1234567890\",\n \"twitterHashtag\": \"#loyalty\",\n \"enableVerifiedMultiplier\": true,\n \"verifiedMultiplier\": 1.5,\n \"isMultiplierApplied\": true,\n \"onlyKnownUsers\": false,\n \"firstReferralReward\": 10,\n \"referrerReward\": 50,\n \"referrerRewardLoyaltyCurrencyId\": \"1234567890\",\n \"secondReferralReward\": 5,\n \"enableStreaks\": true,\n \"promoCode\": \"PROMO123\",\n \"promoCodeType\": \"code\",\n \"promoCodeLength\": 10,\n \"promoCodeCsvUrl\": \"https://example.com/promo_codes.csv\",\n \"enableJoinDiscordServers\": true,\n \"discordServersToJoin\": [\n {\n \"id\": \"123456789012345678\",\n \"channels\": [\n {\n \"id\": \"987654321098765432\",\n \"text\": \"Hello\",\n \"emojis\": [\n {\n \"id\": \"1f600\"\n }\n ]\n }\n ],\n \"roles\": [\n {\n \"id\": \"role123\"\n }\n ]\n }\n ],\n \"streakArray\": [\n {\n \"streakMilestone\": 5,\n \"streakAmount\": 10\n }\n ],\n \"dripQuestsToComplete\": [\n {\n \"id\": \"drip123\"\n }\n ],\n \"collection\": [\n {\n \"address\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\",\n \"network\": \"mainnet\",\n \"multiplier\": 2\n }\n ],\n \"range\": [\n {\n \"startRange\": 1,\n \"endRange\": 10,\n \"amount\": 5,\n \"loyaltyBadgeId\": \"badge123\",\n \"loyaltyMultiplierAmount\": 1.5\n }\n ],\n \"customRewardsApiKey\": \"api-key-1234\",\n \"link\": \"https://example.com\",\n \"socialPlatform\": \"X(Twitter)\",\n \"socialPlatformName\": \"Twitter\",\n \"socialPlatformLogo\": \"https://example.com/logo.png\",\n \"rewardPerImpression\": true,\n \"snapshotProposals\": [\n {\n \"id\": \"proposal123\",\n \"space\": \"space123\"\n }\n ],\n \"cta\": {\n \"label\": \"Click Here\",\n \"href\": \"https://example.com\"\n },\n \"hasSaleCurrency\": false,\n \"isTokenHoldMultiplier\": true,\n \"saleCurrency\": \"USD\",\n \"isRetroactive\": true,\n \"timeDelayToVerifySeconds\": 300,\n \"referralRequirements\": {\n \"points\": {\n \"amount\": 50,\n \"loyaltyCurrecyId\": \"currency123\"\n },\n \"achievePoints\": true,\n \"completeProfile\": false,\n \"connectTwitter\": true,\n \"connectDiscord\": true,\n \"connectEmail\": true\n },\n \"multiplierLoyaltyCurrencyIds\": [\n \"currency123\",\n \"currency456\"\n ],\n \"verifyPlaceHolderText\": \"Enter your verification code here.\",\n \"verificationTextMinimumLength\": 10,\n \"buttonText\": \"Verify Now\",\n \"telegramChannelId\": \"telegram-channel-123\",\n \"twitterAccountUrl\": \"https://twitter.com/example_user\",\n \"twitterPostUrl\": \"https://twitter.com/example/status/1234567890\",\n \"checkLike\": true,\n \"checkRepost\": true,\n \"checkComment\": true,\n \"maxLikes\": 200,\n \"maxReposts\": 200,\n \"maxComments\": 200,\n \"reactionStats\": {\n \"likeCount\": 123,\n \"repostCount\": 123,\n \"commentCount\": 123,\n \"syncedAt\": \"<string>\"\n },\n \"checkText\": \"loyalty\",\n \"requirePostLink\": true,\n \"requirePostMediaLink\": true,\n \"preGeneratedPostText\": true,\n \"rewardCriteria\": \"IMPRESSIONS_COUNT\",\n \"smartContract\": {\n \"contractId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"event\": \"Transfer\",\n \"type\": \"event\",\n \"criteria\": \"everyEvent\",\n \"params\": [\n {\n \"name\": \"value\",\n \"condition\": \">=\",\n \"value\": \"100\"\n }\n ],\n \"addressMapping\": \"0x123...789\",\n \"amountMultiplier\": {\n \"valueMapping\": \"amount\"\n }\n },\n \"walletType\": \"evm\",\n \"imageUrl\": \"https://example.com/image.png\",\n \"onlyRewardSingleTokenOwnership\": true,\n \"skipMultiplier\": true,\n \"completeProfileConditions\": {\n \"twitter\": true,\n \"discord\": false\n },\n \"steamAppId\": \"1234567890\",\n \"githubRepoUrl\": \"https://github.com/owner/repo\",\n \"githubBranchName\": \"main\",\n \"resetProgressOnClaim\": true,\n \"rewardPerAction\": true,\n \"rewardByBatch\": true,\n \"batchSize\": 100,\n \"youtubeVideoId\": \"1234567890\",\n \"youtubeChannelId\": \"1234567890\",\n \"redditPostId\": \"1234567890\",\n \"isRestrictedToNewUsers\": false,\n \"allowMultipleRedemptions\": false,\n \"rewardBadgePerRange\": false,\n \"swap\": {\n \"relayReferrerId\": \"<string>\",\n \"from\": {\n \"chain\": \"any\",\n \"tokens\": [\n {\n \"address\": \"<string>\",\n \"chainId\": \"<string>\"\n }\n ],\n \"trackAmount\": true\n },\n \"to\": {\n \"chain\": \"any\",\n \"tokens\": [\n {\n \"address\": \"<string>\",\n \"chainId\": \"<string>\"\n }\n ],\n \"trackAmount\": true\n },\n \"requireCrossChainSwap\": true\n },\n \"rewardPerValue\": false,\n \"conditionDescription\": \"Complete the specific task on external platform\",\n \"directRpc\": false,\n \"erc20Type\": \"erc20\",\n \"rewardQualityPosts\": false,\n \"minimumFollowerCount\": 25,\n \"autoCheckInRuleIds\": [\n \"123e4567-e89b-12d3-a456-426614174000\"\n ],\n \"robinhoodSymbols\": [\n \"<string>\"\n ]\n },\n \"backgroundAssetUrl\": \"https://example.com/background.png\",\n \"description\": \"A loyalty rule rewarding users for referrals.\",\n \"network\": \"mainnet\",\n \"customRewardsCsvUrl\": \"https://example.com/rewards.csv\",\n \"customRewardsApiUrl\": \"https://api.example.com/rewards\",\n \"subscriptionId\": \"sub12345\",\n \"functionId\": \"func12345\",\n \"collectionAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"collections\": [\n {\n \"address\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\",\n \"network\": \"mainnet\",\n \"symbol\": \"COLL\"\n }\n ],\n \"hideInUi\": false,\n \"trackProgress\": true,\n \"progressType\": \"percentage\",\n \"showBeforeStart\": false,\n \"isRequired\": true,\n \"oauthCredentialsId\": \"123e4567-e89b-12d3-a456-426614174003\",\n \"loyaltyCurrencyId\": \"456e1234-e89b-12d3-a456-426614174003\",\n \"loyaltyRuleGroupId\": \"123e4567-e89b-12d3-a456-426614174004\",\n \"rewardType\": \"points\",\n \"loyaltyBadgeId\": \"123e4567-e89b-12d3-a456-426614174004\",\n \"mediaUrl\": \"https://example.com/media.png\",\n \"loyaltyUserAllotmentCsvUrl\": \"https://example.com/loyalty-user-allotment.csv\",\n \"maxAmountPerInterval\": 100,\n \"maxAmountInterval\": \"daily\",\n \"shopifyStoreUrl\": \"https://example.com\",\n \"externalIntegrationId\": \"123e4567-e89b-12d3-a456-426614174005\",\n \"duplicatedFromId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rewardLifetime\": \"permanent\",\n \"claimType\": \"auto\",\n \"contractIds\": [\n \"123e4567-e89b-12d3-a456-426614174005\"\n ],\n \"dappDeployedWithin\": \"daily\",\n \"dappDataWindow\": \"daily\",\n \"isDappRule\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://admin.snagsolutions.io/api/loyalty/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"organizationId\": \"123e4567-e89b-12d3-a456-426614174001\",\n \"websiteId\": \"123e4567-e89b-12d3-a456-426614174002\",\n \"name\": \"Referral Bonus Rule\",\n \"type\": \"TokenHold\",\n \"frequency\": \"daily\",\n \"interval\": \"weekly\",\n \"startTime\": \"2024-01-01T00:00:00Z\",\n \"endTime\": \"2024-12-31T23:59:00Z\",\n \"effectiveStartTime\": \"2024-01-01T00:00:00Z\",\n \"effectiveEndTime\": \"2024-12-31T23:59:00Z\",\n \"amount\": \"10.5\",\n \"metadata\": {\n \"isCheckInOnEveryTxn\": true,\n \"hasPaidFullRoyalty\": false,\n \"royaltyAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"royaltyPercentage\": 5,\n \"hasVerifiedTwitter\": true,\n \"onlyRewardExistingUser\": true,\n \"hasNeverSold\": false,\n \"onlyNative\": true,\n \"hasFillSource\": true,\n \"fillSource\": \"opensea.io\",\n \"liquidity\": {\n \"network\": \"mainnet\",\n \"protocol\": \"Uniswap V2\",\n \"onlyRewardInRangeLiquidity\": true,\n \"liquidityPerDay\": 1000,\n \"customFunction\": \"x = y * 1000\",\n \"calculationType\": \"fixed\",\n \"pools\": [\n {\n \"id\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\"\n }\n ]\n },\n \"twitterUsername\": \"@example_user\",\n \"twitterUserId\": \"1234567890\",\n \"twitterHashtag\": \"#loyalty\",\n \"enableVerifiedMultiplier\": true,\n \"verifiedMultiplier\": 1.5,\n \"isMultiplierApplied\": true,\n \"onlyKnownUsers\": false,\n \"firstReferralReward\": 10,\n \"referrerReward\": 50,\n \"referrerRewardLoyaltyCurrencyId\": \"1234567890\",\n \"secondReferralReward\": 5,\n \"enableStreaks\": true,\n \"promoCode\": \"PROMO123\",\n \"promoCodeType\": \"code\",\n \"promoCodeLength\": 10,\n \"promoCodeCsvUrl\": \"https://example.com/promo_codes.csv\",\n \"enableJoinDiscordServers\": true,\n \"discordServersToJoin\": [\n {\n \"id\": \"123456789012345678\",\n \"channels\": [\n {\n \"id\": \"987654321098765432\",\n \"text\": \"Hello\",\n \"emojis\": [\n {\n \"id\": \"1f600\"\n }\n ]\n }\n ],\n \"roles\": [\n {\n \"id\": \"role123\"\n }\n ]\n }\n ],\n \"streakArray\": [\n {\n \"streakMilestone\": 5,\n \"streakAmount\": 10\n }\n ],\n \"dripQuestsToComplete\": [\n {\n \"id\": \"drip123\"\n }\n ],\n \"collection\": [\n {\n \"address\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\",\n \"network\": \"mainnet\",\n \"multiplier\": 2\n }\n ],\n \"range\": [\n {\n \"startRange\": 1,\n \"endRange\": 10,\n \"amount\": 5,\n \"loyaltyBadgeId\": \"badge123\",\n \"loyaltyMultiplierAmount\": 1.5\n }\n ],\n \"customRewardsApiKey\": \"api-key-1234\",\n \"link\": \"https://example.com\",\n \"socialPlatform\": \"X(Twitter)\",\n \"socialPlatformName\": \"Twitter\",\n \"socialPlatformLogo\": \"https://example.com/logo.png\",\n \"rewardPerImpression\": true,\n \"snapshotProposals\": [\n {\n \"id\": \"proposal123\",\n \"space\": \"space123\"\n }\n ],\n \"cta\": {\n \"label\": \"Click Here\",\n \"href\": \"https://example.com\"\n },\n \"hasSaleCurrency\": false,\n \"isTokenHoldMultiplier\": true,\n \"saleCurrency\": \"USD\",\n \"isRetroactive\": true,\n \"timeDelayToVerifySeconds\": 300,\n \"referralRequirements\": {\n \"points\": {\n \"amount\": 50,\n \"loyaltyCurrecyId\": \"currency123\"\n },\n \"achievePoints\": true,\n \"completeProfile\": false,\n \"connectTwitter\": true,\n \"connectDiscord\": true,\n \"connectEmail\": true\n },\n \"multiplierLoyaltyCurrencyIds\": [\n \"currency123\",\n \"currency456\"\n ],\n \"verifyPlaceHolderText\": \"Enter your verification code here.\",\n \"verificationTextMinimumLength\": 10,\n \"buttonText\": \"Verify Now\",\n \"telegramChannelId\": \"telegram-channel-123\",\n \"twitterAccountUrl\": \"https://twitter.com/example_user\",\n \"twitterPostUrl\": \"https://twitter.com/example/status/1234567890\",\n \"checkLike\": true,\n \"checkRepost\": true,\n \"checkComment\": true,\n \"maxLikes\": 200,\n \"maxReposts\": 200,\n \"maxComments\": 200,\n \"reactionStats\": {\n \"likeCount\": 123,\n \"repostCount\": 123,\n \"commentCount\": 123,\n \"syncedAt\": \"<string>\"\n },\n \"checkText\": \"loyalty\",\n \"requirePostLink\": true,\n \"requirePostMediaLink\": true,\n \"preGeneratedPostText\": true,\n \"rewardCriteria\": \"IMPRESSIONS_COUNT\",\n \"smartContract\": {\n \"contractId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"event\": \"Transfer\",\n \"type\": \"event\",\n \"criteria\": \"everyEvent\",\n \"params\": [\n {\n \"name\": \"value\",\n \"condition\": \">=\",\n \"value\": \"100\"\n }\n ],\n \"addressMapping\": \"0x123...789\",\n \"amountMultiplier\": {\n \"valueMapping\": \"amount\"\n }\n },\n \"walletType\": \"evm\",\n \"imageUrl\": \"https://example.com/image.png\",\n \"onlyRewardSingleTokenOwnership\": true,\n \"skipMultiplier\": true,\n \"completeProfileConditions\": {\n \"twitter\": true,\n \"discord\": false\n },\n \"steamAppId\": \"1234567890\",\n \"githubRepoUrl\": \"https://github.com/owner/repo\",\n \"githubBranchName\": \"main\",\n \"resetProgressOnClaim\": true,\n \"rewardPerAction\": true,\n \"rewardByBatch\": true,\n \"batchSize\": 100,\n \"youtubeVideoId\": \"1234567890\",\n \"youtubeChannelId\": \"1234567890\",\n \"redditPostId\": \"1234567890\",\n \"isRestrictedToNewUsers\": false,\n \"allowMultipleRedemptions\": false,\n \"rewardBadgePerRange\": false,\n \"swap\": {\n \"relayReferrerId\": \"<string>\",\n \"from\": {\n \"chain\": \"any\",\n \"tokens\": [\n {\n \"address\": \"<string>\",\n \"chainId\": \"<string>\"\n }\n ],\n \"trackAmount\": true\n },\n \"to\": {\n \"chain\": \"any\",\n \"tokens\": [\n {\n \"address\": \"<string>\",\n \"chainId\": \"<string>\"\n }\n ],\n \"trackAmount\": true\n },\n \"requireCrossChainSwap\": true\n },\n \"rewardPerValue\": false,\n \"conditionDescription\": \"Complete the specific task on external platform\",\n \"directRpc\": false,\n \"erc20Type\": \"erc20\",\n \"rewardQualityPosts\": false,\n \"minimumFollowerCount\": 25,\n \"autoCheckInRuleIds\": [\n \"123e4567-e89b-12d3-a456-426614174000\"\n ],\n \"robinhoodSymbols\": [\n \"<string>\"\n ]\n },\n \"backgroundAssetUrl\": \"https://example.com/background.png\",\n \"description\": \"A loyalty rule rewarding users for referrals.\",\n \"network\": \"mainnet\",\n \"customRewardsCsvUrl\": \"https://example.com/rewards.csv\",\n \"customRewardsApiUrl\": \"https://api.example.com/rewards\",\n \"subscriptionId\": \"sub12345\",\n \"functionId\": \"func12345\",\n \"collectionAddress\": \"0x1234567890abcdef1234567890abcdef12345678\",\n \"collections\": [\n {\n \"address\": \"0xabcdefabcdefabcdefabcdefabcdefabcdef\",\n \"network\": \"mainnet\",\n \"symbol\": \"COLL\"\n }\n ],\n \"hideInUi\": false,\n \"trackProgress\": true,\n \"progressType\": \"percentage\",\n \"showBeforeStart\": false,\n \"isRequired\": true,\n \"oauthCredentialsId\": \"123e4567-e89b-12d3-a456-426614174003\",\n \"loyaltyCurrencyId\": \"456e1234-e89b-12d3-a456-426614174003\",\n \"loyaltyRuleGroupId\": \"123e4567-e89b-12d3-a456-426614174004\",\n \"rewardType\": \"points\",\n \"loyaltyBadgeId\": \"123e4567-e89b-12d3-a456-426614174004\",\n \"mediaUrl\": \"https://example.com/media.png\",\n \"loyaltyUserAllotmentCsvUrl\": \"https://example.com/loyalty-user-allotment.csv\",\n \"maxAmountPerInterval\": 100,\n \"maxAmountInterval\": \"daily\",\n \"shopifyStoreUrl\": \"https://example.com\",\n \"externalIntegrationId\": \"123e4567-e89b-12d3-a456-426614174005\",\n \"duplicatedFromId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"rewardLifetime\": \"permanent\",\n \"claimType\": \"auto\",\n \"contractIds\": [\n \"123e4567-e89b-12d3-a456-426614174005\"\n ],\n \"dappDeployedWithin\": \"daily\",\n \"dappDataWindow\": \"daily\",\n \"isDappRule\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "123e4567-e89b-12d3-a456-426614174001",
"websiteId": "123e4567-e89b-12d3-a456-426614174002",
"name": "Referral Bonus Rule",
"type": "TokenHold",
"frequency": "daily",
"interval": "weekly",
"startTime": "2024-01-01T00:00:00Z",
"endTime": "2024-12-31T23:59:00Z",
"effectiveStartTime": "2024-01-01T00:00:00Z",
"effectiveEndTime": "2024-12-31T23:59:00Z",
"amount": "10.5",
"metadata": {
"isCheckInOnEveryTxn": true,
"hasPaidFullRoyalty": false,
"royaltyAddress": "0x1234567890abcdef1234567890abcdef12345678",
"royaltyPercentage": 5,
"hasVerifiedTwitter": true,
"onlyRewardExistingUser": true,
"hasNeverSold": false,
"onlyNative": true,
"hasFillSource": true,
"fillSource": "opensea.io",
"liquidity": {
"network": "mainnet",
"protocol": "Uniswap V2",
"onlyRewardInRangeLiquidity": true,
"liquidityPerDay": 1000,
"customFunction": "x = y * 1000",
"calculationType": "fixed",
"pools": [
{
"id": "0xabcdefabcdefabcdefabcdefabcdefabcdef"
}
]
},
"twitterUsername": "@example_user",
"twitterUserId": "1234567890",
"twitterHashtag": "#loyalty",
"enableVerifiedMultiplier": true,
"verifiedMultiplier": 1.5,
"isMultiplierApplied": true,
"onlyKnownUsers": false,
"firstReferralReward": 10,
"referrerReward": 50,
"referrerRewardLoyaltyCurrencyId": "1234567890",
"secondReferralReward": 5,
"enableStreaks": true,
"promoCode": "PROMO123",
"promoCodeType": "code",
"promoCodeLength": 10,
"promoCodeCsvUrl": "https://example.com/promo_codes.csv",
"enableJoinDiscordServers": true,
"discordServersToJoin": [
{
"id": "123456789012345678",
"channels": [
{
"id": "987654321098765432",
"text": "Hello",
"emojis": [
{
"id": "1f600"
}
]
}
],
"roles": [
{
"id": "role123"
}
]
}
],
"streakArray": [
{
"streakMilestone": 5,
"streakAmount": 10
}
],
"dripQuestsToComplete": [
{
"id": "drip123"
}
],
"collection": [
{
"address": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"network": "mainnet",
"multiplier": 2
}
],
"range": [
{
"startRange": 1,
"endRange": 10,
"amount": 5,
"loyaltyBadgeId": "badge123",
"loyaltyMultiplierAmount": 1.5
}
],
"customRewardsApiKey": "api-key-1234",
"link": "https://example.com",
"socialPlatform": "X(Twitter)",
"socialPlatformName": "Twitter",
"socialPlatformLogo": "https://example.com/logo.png",
"rewardPerImpression": true,
"snapshotProposals": [
{
"id": "proposal123",
"space": "space123"
}
],
"cta": {
"label": "Click Here",
"href": "https://example.com"
},
"hasSaleCurrency": false,
"isTokenHoldMultiplier": true,
"saleCurrency": "USD",
"isRetroactive": true,
"timeDelayToVerifySeconds": 300,
"referralRequirements": {
"points": {
"amount": 50,
"loyaltyCurrecyId": "currency123"
},
"achievePoints": true,
"completeProfile": false,
"connectTwitter": true,
"connectDiscord": true,
"connectEmail": true
},
"multiplierLoyaltyCurrencyIds": [
"currency123",
"currency456"
],
"verifyPlaceHolderText": "Enter your verification code here.",
"verificationTextMinimumLength": 10,
"buttonText": "Verify Now",
"telegramChannelId": "telegram-channel-123",
"twitterAccountUrl": "https://twitter.com/example_user",
"twitterPostUrl": "https://twitter.com/example/status/1234567890",
"checkLike": true,
"checkRepost": true,
"checkComment": true,
"maxLikes": 200,
"maxReposts": 200,
"maxComments": 200,
"reactionStats": {
"likeCount": 123,
"repostCount": 123,
"commentCount": 123,
"syncedAt": "<string>"
},
"checkText": "loyalty",
"requirePostLink": true,
"requirePostMediaLink": true,
"preGeneratedPostText": true,
"rewardCriteria": "IMPRESSIONS_COUNT",
"smartContract": {
"contractId": "123e4567-e89b-12d3-a456-426614174000",
"event": "Transfer",
"type": "event",
"criteria": "everyEvent",
"params": [
{
"name": "value",
"condition": ">=",
"value": "100"
}
],
"addressMapping": "0x123...789",
"amountMultiplier": {
"valueMapping": "amount"
}
},
"walletType": "evm",
"imageUrl": "https://example.com/image.png",
"onlyRewardSingleTokenOwnership": true,
"skipMultiplier": true,
"completeProfileConditions": {
"twitter": true,
"discord": false
},
"steamAppId": "1234567890",
"githubRepoUrl": "https://github.com/owner/repo",
"githubBranchName": "main",
"resetProgressOnClaim": true,
"rewardPerAction": true,
"rewardByBatch": true,
"batchSize": 100,
"youtubeVideoId": "1234567890",
"youtubeChannelId": "1234567890",
"redditPostId": "1234567890",
"isRestrictedToNewUsers": false,
"allowMultipleRedemptions": false,
"rewardBadgePerRange": false,
"swap": {
"relayReferrerId": "<string>",
"from": {
"chain": 123,
"tokens": [
{
"address": "<string>",
"chainId": "<string>"
}
],
"trackAmount": true
},
"to": {
"chain": 123,
"tokens": [
{
"address": "<string>",
"chainId": "<string>"
}
],
"trackAmount": true
},
"requireCrossChainSwap": true
},
"rewardPerValue": false,
"conditionDescription": "Complete the specific task on external platform",
"directRpc": false,
"erc20Type": "erc20",
"rewardQualityPosts": false,
"minimumFollowerCount": 25,
"autoCheckInRuleIds": [
"123e4567-e89b-12d3-a456-426614174000"
],
"robinhoodSymbols": [
"<string>"
]
},
"backgroundAssetUrl": "https://example.com/background.png",
"description": "A loyalty rule rewarding users for referrals.",
"network": "mainnet",
"customRewardsCsvUrl": "https://example.com/rewards.csv",
"customRewardsApiUrl": "https://api.example.com/rewards",
"subscriptionId": "sub12345",
"functionId": "func12345",
"collectionAddress": "0x1234567890abcdef1234567890abcdef12345678",
"collections": [
{
"address": "0xabcdefabcdefabcdefabcdefabcdefabcdef",
"network": "mainnet",
"symbol": "COLL"
}
],
"hideInUi": false,
"trackProgress": true,
"progressType": "percentage",
"showBeforeStart": false,
"isRequired": true,
"oauthCredentialsId": "123e4567-e89b-12d3-a456-426614174003",
"loyaltyCurrencyId": "456e1234-e89b-12d3-a456-426614174003",
"tokenReward": {
"relayerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contractId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isNative": true
},
"loyaltyRuleGroupId": "123e4567-e89b-12d3-a456-426614174004",
"rewardType": "points",
"loyaltyBadgeId": "123e4567-e89b-12d3-a456-426614174004",
"mediaUrl": "https://example.com/media.png",
"loyaltyUserAllotmentCsvUrl": "https://example.com/loyalty-user-allotment.csv",
"maxAmountPerInterval": 100,
"maxAmountInterval": "daily",
"shopifyStoreUrl": "https://example.com",
"externalIntegrationId": "123e4567-e89b-12d3-a456-426614174005",
"duplicatedFromId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rewardLifetime": "permanent",
"claimType": "auto",
"contractIds": [
"123e4567-e89b-12d3-a456-426614174005"
],
"dappDeployedWithin": "daily",
"dappDataWindow": "daily",
"isDappRule": false
}"Forbidden, Could not validate api key"Authorizations
Body
Body
Schema for creating a new loyalty rule with detailed validations
Unique identifier for the organization creating the rule
"123e4567-e89b-12d3-a456-426614174001"
Unique identifier for the associated website
"123e4567-e89b-12d3-a456-426614174002"
Name of the loyalty rule
1"Referral Bonus Rule"
Type of loyalty rule being created
Bonus, BoughtOn, BoughtWithRoyalties, DiscordMessages, Listing, Lodging, PoapClaim, SnagSocialsConnected, SnapshotFullset, SnapshotHold, SoldWithRoyalties, TwitterBio, TwitterHashTagPost, MintOn, SoldOn, TokenHold, Retweet, check_in, code_entry, connect_wallet, connected_discord, connected_email, connected_epic, connected_github, connected_steam, connected_telegram, connected_twitter, create_partner_account, discord_member, drip_x_follow, drip_x_new_tweet, drip_x_text_in_bio, drip_x_text_in_comment, drip_x_text_in_name, drip_x_tweet, external_rule, link_click, manual_upload, profile_completed, referred_user, smart_contract_event, snapshot_governance, telegram_join, telegram_messages, text_input, token_hold_erc20, tweet_liked_by_project, twitter_comment, twitter_follow, twitter_followers, twitter_like, twitter_post_hashtag, quiz, poll, steam_wishlist, liquidity_uniswap_v2, liquidity_uniswap_v3, points_airdrop, youtube_subscribers, youtube_comment, shopify_spend, swap, tiktok_post, post_impressions, discord_join, connected_youtube, stratus_function, connected_tiktok, tiktok_follow, github_repo_star, github_repo_fork, github_repo_collaborator, github_merge_PR, discord_role_grant, connected_reddit, reddit_comment, robinhood_token_hold, connected_instagram, instagram_post, instagram_follow, connected_phone, dapps_by_gas_spent, dapps_by_active_users, dapps_by_new_users, dapps_by_transaction_count, dapps_by_user_retention "TokenHold"
Execution frequency of the loyalty rule
none, once, hourly, daily, weekly, monthly, immediately "daily"
Interval between rule executions
hourly, daily, weekly, monthly, once, custom, every_message, unlimited "weekly"
When the rule becomes active
"2024-01-01T00:00:00Z"
When the rule becomes inactive
"2024-12-31T23:59:00Z"
The effective start time of the rule
"2024-01-01T00:00:00Z"
The effective end time of the rule
"2024-12-31T23:59:00Z"
Reward amount associated with the rule
"10.5"
Additional metadata for the loyalty rule
Show child attributes
Show child attributes
URL of the background asset to be displayed
"https://example.com/background.png"
Optional detailed description of the rule
"A loyalty rule rewarding users for referrals."
Blockchain network where the rule will apply
abstract, abstractTestnet, apechain, arbitrum, avalanche, avalancheFuji, base, baseSepolia, berachain, berachainArtio, berachainBepolia, binance, bscTestnet, campTestnet, fantom, fantomTestnet, flowMainnet, mainnet, nexus, nexusTestnet, optimism, polygon, polygon_mumbai, skaleNebula, skaleEuropa, skaleCalypso, solana, sophon, sophonTestnet, sui, superseed, superseedSepolia, vanar, xai, zksync, coti, cotiTestnet, dogeosTestnet, morph, morphTestnet, morphHolesky, ultra, ultraTestnet, nitrograph, sepolia, optimism_sepolia, arbitrumSepolia, goerli, optimism_goerli, arbitrumGoerli, basecamp, somnia, zkverify, polkadot, kusama, horizen, horizenTestnet, robinhoodChain, robinhoodChainTestnet, flow_cadence "mainnet"
URL for uploading custom rewards via CSV
"https://example.com/rewards.csv"
URL for fetching custom rewards
"https://api.example.com/rewards"
Optional stratus subscription id for the rule
"sub12345"
Optional stratus function id for the rule
"func12345"
Blockchain address of the associated collection
"0x1234567890abcdef1234567890abcdef12345678"
List of associated collections
Show child attributes
Show child attributes
Whether to hide this rule in the user interface
false
Flag indicating if the progress is tracked. If enabled, the rule can only be completed once the progress is 100%.
true
How tracked progress is interpreted. "percentage" counts 0-100 and is shown as a percentage. "counter" counts up to the highest reward range end and is shown as a raw count.
counter, percentage "percentage"
Whether to show this rule before the start time
false
Whether this rule is mandatory
true
OAuth credentials associated with the rule
"123e4567-e89b-12d3-a456-426614174003"
Unique identifier for the loyalty currency. Optional when rewardType is token and tokenReward is provided; backend will find or create the currency from the selected contract.
"456e1234-e89b-12d3-a456-426614174003"
When rewardType is token, provide relayer and either an ERC-20 contract or isNative=true to find or create loyalty currency and onchain token.
Show child attributes
Show child attributes
Unique identifier for the loyalty rule group
no-section "123e4567-e89b-12d3-a456-426614174004"
Type of reward issued by the rule
points, multiplier, badge, token "points"
Unique identifier for the loyalty badge
"123e4567-e89b-12d3-a456-426614174004"
URL of the media to be displayed
"https://example.com/media.png"
URL for uploading loyalty user allotment via CSV
"https://example.com/loyalty-user-allotment.csv"
The maximum amount of points a user can earn per interval. Available for the smart contract and external rules.
100
The interval for the max amount. Available for the smart contract and external rules.
daily, weekly, monthly, lifetime "daily"
URL of the Shopify store
"https://example.com"
ID of the external integration
"123e4567-e89b-12d3-a456-426614174005"
The lifetime of the reward
permanent, dynamic "permanent"
The type of claim for the reward
manual, auto "auto"
The IDs of the contracts
["123e4567-e89b-12d3-a456-426614174005"]
Filter dApps by deployment age before ranking.
daily, weekly, monthly "daily"
Reward based on data usage within the last day, week, or month. Leave it empty for all time usage.
daily, weekly, monthly "daily"
Routes rule rewards to the dApp owner address (for substitution-type rules: external_rule, smart_contract_event, stratus_function) or marks the rule as a dApp-attribution rule (for the dapps_by_* family). Defaults to true at the API for the dapps_by_* family when omitted, false otherwise. Immutable after creation.
false
Response
200
Schema for creating a new loyalty rule with detailed validations
Unique identifier for the organization creating the rule
"123e4567-e89b-12d3-a456-426614174001"
Unique identifier for the associated website
"123e4567-e89b-12d3-a456-426614174002"
Name of the loyalty rule
1"Referral Bonus Rule"
Type of loyalty rule being created
Bonus, BoughtOn, BoughtWithRoyalties, DiscordMessages, Listing, Lodging, PoapClaim, SnagSocialsConnected, SnapshotFullset, SnapshotHold, SoldWithRoyalties, TwitterBio, TwitterHashTagPost, MintOn, SoldOn, TokenHold, Retweet, check_in, code_entry, connect_wallet, connected_discord, connected_email, connected_epic, connected_github, connected_steam, connected_telegram, connected_twitter, create_partner_account, discord_member, drip_x_follow, drip_x_new_tweet, drip_x_text_in_bio, drip_x_text_in_comment, drip_x_text_in_name, drip_x_tweet, external_rule, link_click, manual_upload, profile_completed, referred_user, smart_contract_event, snapshot_governance, telegram_join, telegram_messages, text_input, token_hold_erc20, tweet_liked_by_project, twitter_comment, twitter_follow, twitter_followers, twitter_like, twitter_post_hashtag, quiz, poll, steam_wishlist, liquidity_uniswap_v2, liquidity_uniswap_v3, points_airdrop, youtube_subscribers, youtube_comment, shopify_spend, swap, tiktok_post, post_impressions, discord_join, connected_youtube, stratus_function, connected_tiktok, tiktok_follow, github_repo_star, github_repo_fork, github_repo_collaborator, github_merge_PR, discord_role_grant, connected_reddit, reddit_comment, robinhood_token_hold, connected_instagram, instagram_post, instagram_follow, connected_phone, dapps_by_gas_spent, dapps_by_active_users, dapps_by_new_users, dapps_by_transaction_count, dapps_by_user_retention "TokenHold"
Execution frequency of the loyalty rule
none, once, hourly, daily, weekly, monthly, immediately "daily"
Interval between rule executions
hourly, daily, weekly, monthly, once, custom, every_message, unlimited "weekly"
When the rule becomes active
"2024-01-01T00:00:00Z"
When the rule becomes inactive
"2024-12-31T23:59:00Z"
The effective start time of the rule
"2024-01-01T00:00:00Z"
The effective end time of the rule
"2024-12-31T23:59:00Z"
Reward amount associated with the rule
"10.5"
Additional metadata for the loyalty rule
Show child attributes
Show child attributes
URL of the background asset to be displayed
"https://example.com/background.png"
Optional detailed description of the rule
"A loyalty rule rewarding users for referrals."
Blockchain network where the rule will apply
abstract, abstractTestnet, apechain, arbitrum, avalanche, avalancheFuji, base, baseSepolia, berachain, berachainArtio, berachainBepolia, binance, bscTestnet, campTestnet, fantom, fantomTestnet, flowMainnet, mainnet, nexus, nexusTestnet, optimism, polygon, polygon_mumbai, skaleNebula, skaleEuropa, skaleCalypso, solana, sophon, sophonTestnet, sui, superseed, superseedSepolia, vanar, xai, zksync, coti, cotiTestnet, dogeosTestnet, morph, morphTestnet, morphHolesky, ultra, ultraTestnet, nitrograph, sepolia, optimism_sepolia, arbitrumSepolia, goerli, optimism_goerli, arbitrumGoerli, basecamp, somnia, zkverify, polkadot, kusama, horizen, horizenTestnet, robinhoodChain, robinhoodChainTestnet, flow_cadence "mainnet"
URL for uploading custom rewards via CSV
"https://example.com/rewards.csv"
URL for fetching custom rewards
"https://api.example.com/rewards"
Optional stratus subscription id for the rule
"sub12345"
Optional stratus function id for the rule
"func12345"
Blockchain address of the associated collection
"0x1234567890abcdef1234567890abcdef12345678"
List of associated collections
Show child attributes
Show child attributes
Whether to hide this rule in the user interface
false
Flag indicating if the progress is tracked. If enabled, the rule can only be completed once the progress is 100%.
true
How tracked progress is interpreted. "percentage" counts 0-100 and is shown as a percentage. "counter" counts up to the highest reward range end and is shown as a raw count.
counter, percentage "percentage"
Whether to show this rule before the start time
false
Whether this rule is mandatory
true
OAuth credentials associated with the rule
"123e4567-e89b-12d3-a456-426614174003"
Unique identifier for the loyalty currency. Optional when rewardType is token and tokenReward is provided; backend will find or create the currency from the selected contract.
"456e1234-e89b-12d3-a456-426614174003"
When rewardType is token, provide relayer and either an ERC-20 contract or isNative=true to find or create loyalty currency and onchain token.
Show child attributes
Show child attributes
Unique identifier for the loyalty rule group
no-section "123e4567-e89b-12d3-a456-426614174004"
Type of reward issued by the rule
points, multiplier, badge, token "points"
Unique identifier for the loyalty badge
"123e4567-e89b-12d3-a456-426614174004"
URL of the media to be displayed
"https://example.com/media.png"
URL for uploading loyalty user allotment via CSV
"https://example.com/loyalty-user-allotment.csv"
The maximum amount of points a user can earn per interval. Available for the smart contract and external rules.
100
The interval for the max amount. Available for the smart contract and external rules.
daily, weekly, monthly, lifetime "daily"
URL of the Shopify store
"https://example.com"
ID of the external integration
"123e4567-e89b-12d3-a456-426614174005"
The lifetime of the reward
permanent, dynamic "permanent"
The type of claim for the reward
manual, auto "auto"
The IDs of the contracts
["123e4567-e89b-12d3-a456-426614174005"]
Filter dApps by deployment age before ranking.
daily, weekly, monthly "daily"
Reward based on data usage within the last day, week, or month. Leave it empty for all time usage.
daily, weekly, monthly "daily"
Routes rule rewards to the dApp owner address (for substitution-type rules: external_rule, smart_contract_event, stratus_function) or marks the rule as a dApp-attribution rule (for the dapps_by_* family). Defaults to true at the API for the dapps_by_* family when omitted, false otherwise. Immutable after creation.
false
Was this page helpful?