Your activities and their rewards, referral links and redeem codes.
An activity is a way to earn, such as placing an order, following you on Instagram or celebrating a birthday. Each activity has a reward, which can differ by customer segment. A referral has two sides: the customer who shares their link, the referrer, earns a reward, and the friend they bring gets a discount.
getActivitiesLists your active ways to earn, with each one's reward and the customer's progress.getReferralDataReturns a customer's referral code and link, and what the referrer and the friend get.redeemCodeRedeems a code from one of your Redeem code activities and gives the customer its reward.Lists your active ways to earn, with each one's reward and the customer's progress.
Works for guests, who see the activities with a reward for everyone. For a signed-in customer, the reward for their segment sets rewardMessage, and completed, limitReached and pendingReview show their progress. Without ids, the most recently updated activity comes first.
idsstring[]Only these activities, in this order.
typesstring[]Only activities of these types, such as ["BIRTHDAY", "REFER_A_FRIEND"]; see typeIdentifier.
excludeTypesstring[]Leave out activities of these types.
idstringtypeIdentifierstringThe kind of activity. Purchases: SHOPIFY_PURCHASE, SHOPIFY_BASED_ON_SPEND (a spending goal). Referrals: REFER_A_FRIEND, SHARE_WITH_FRIENDS (refer a friend to the brand), REFER_A_FRIEND_TO_COMPLETE_AN_ACTIVITY. Engagement: JOIN_REWARDS_PROGRAM, COLLECT_ZERO_PARTY_DATA (surveys), QUIZ, VOTING (polls), PICTURE_SUBMISSION, BIRTHDAY, LOYALTY_ANNIVERSARY, LINK_CLICKS. Social: INSTAGRAM_FOLLOW, INSTAGRAM_LIKE_POST, INSTAGRAM_COMMENT_POST, INSTAGRAM_POST_UGC, TIKTOK_FOLLOW, TIKTOK_LIKE_POST, TIKTOK_VIDEO_CREATION, FACEBOOK_LIKE_PAGE, FACEBOOK_LIKE_POST, FACEBOOK_COMMENT_POST, FACEBOOK_JOIN_GROUP, TWITTER_FOLLOW, TWITTER_LIKE_POST, TWITTER_COMMENT_POST, TWITTER_RETWEET, DISCORD_JOIN_CHANNEL, YOUTUBE_SUBSCRIBE, PINTEREST_FOLLOW, SHARE_PURCHASE_ON_SOCIAL. Subscriptions: SUBSCRIPTION_SIGN_UP, SUBSCRIPTION_CONTINUATION. Other: CHALLENGE, NON_INTEGRATION_CUSTOM, DOWNLOAD_PASS, NEWSLETTER_SIGN_UP, SIGN_IN_REWARDS, SCAN_QR_CODE, SPIN_WHEEL, LOTTERY, CHARITY, REDEEM_CODE. Integrations: KLAVIYO_SIGNUP, POSTSCRIPT_SMS_SIGN_UP, TAGGUN_SEND_RECEIPT, GREENSPARK_IMPACT. Reviews and surveys: REVIEWS, JUDGE_ME_CREATE_REVIEW, ACTION_LOOX_REVIEWS, ACTION_OKENDO, ACTION_REVIEWS_IO, ACTION_STAMPED, ACTION_YOTPO, ACTION_FAIRING.
namestringAs you entered it.
descriptionstringAs you entered it; empty when there's none.
rewardMessagestringThe customer's reward in words, in the storefront language, such as "100 Points", "$5 Discount" or "5% back in Points".
urlstringThe activity's link, such as your Instagram profile; empty when it has none.
imagestring | nullImage URL.
iconImagestring | nullIcon URL.
completedbooleantrue once the customer has done a one-time activity or reached completionsLimit.
limitReachedbooleanThe customer has reached completionsLimit for the current period.
pendingReviewbooleanOne of the customer's completions is waiting for your approval.
completionsLimitobjectHow often a customer can complete the activity: { type: "unlimited" }, { type: "fixed", amount } in total, { type: "per-day" }, "per-week" or "per-month" with an amount, or { type: "custom", amount, interval, period }.
additionalFieldsobjectSettings that depend on the type. For SHOPIFY_BASED_ON_SPEND and a signed-in customer, spendProgress holds currentSpend, targetSpend and remainder, in your store currency.
Returns a customer's referral code and link, and what the referrer and the friend get.
Each customer has a referral code for each of your referral activities, and the link opens your store with it, so the friend gets their discount. It returns the signed-in customer's code. Pass email to get the code of the member with that email instead, such as a guest who typed theirs in; Toki creates a member for a new email.
Rejects when activityId isn't one of your active referral activities.
activityIdstringA refer-a-friend activity, or one of type REFER_A_FRIEND_TO_COMPLETE_AN_ACTIVITY. Defaults to your most recently updated refer-a-friend activity.
emailstringThe email of the member whose code you want.
codestringThe referral code.
linkstringThe referral link: your store, or the custom link you set, with the code in tkr, such as https://acme-coffee.com/?tkr=ANNA10&utm_source=toki&utm_medium=referral&utm_campaign=ANNA10.
discountCodestring | nullWith Referral code as discount code on, the code the friend can type at checkout; otherwise null.
activityReferralActivityidstringamountToRewardstring | nullThe referrer's reward, such as "500": points when tokenToReward is set, otherwise an amount in your store currency.
amountToRewardPercentagenumber | nullFor a reward based on spend: the points the referrer earns per unit of currency the friend spends.
discountPercentnumber | nullThe friend's discount in percent, such as 15.
discountAbsolutestring | nullThe friend's discount as an amount in your store currency, such as "10".
tokenToReward{ id: string; name: string; image_url: string }OptionalThe store credit the referrer earns, when their reward is points.
additionalFieldsobjectThe activity's settings. minimumOrderAmount is the order total, in your store currency, a friend's order needs to count.
Redeems a code from one of your Redeem code activities and gives the customer its reward.
Completes the code's activity for the customer, so they get its reward. Each code can be used as many times as the activity's usage limits allow. Read the balance again afterwards to show the new points.
When the activity has Allow redemption without login on, a guest can redeem with the email they type in, and Toki creates a member for a new email. Otherwise the customer needs to be signed in.
Rejects with a message for the customer, such as "Invalid code", "Code has expired" or "You have already used this code".
codestringRequiredThe code. Letter case and surrounding spaces don't matter.
emailstringFor guests: the email of the member to credit.
rewardMessagestringThe reward in words, in the storefront language, such as "500 Points".