Points transactions, issued discounts and perks, and redeeming on a member's behalf.
Every change to a member's balance is recorded as a transfer. Rewards issued to members, such as discount codes, are perks. The redemption operations turn a balance or a membership perk into a discount code. A member's current balances are on TokiUser.balances.
userTransfersDeleteArchives selected transfers belonging to the member and this merchant's store credits, recalculates balances transactionally, then runs the existing follow-up jobs.transfersLists transfers across all members and store credits, newest first.userPerksLists perks, the discount codes issued to members, newest first.userSpendingRuleReturns a member's balance in your default store credit, their conversion rate, and the discount limits of the redemption rule that applies to them in the current store.userMembershipPerksLists the membership perks userRedeemPerk can turn into a code for the member: percentage discounts, fixed-amount discounts and free shipping.userSpendTurns part of the member's balance in your default store credit into a single-use discount code worth amount, created in each of your stores.userRedeemPerkGenerates the discount code for one of the member's membership perks in the current store; their balance doesn't change.Archives selected transfers belonging to the member and this merchant's store credits, recalculates balances transactionally, then runs the existing follow-up jobs. Unmatched IDs are ignored unless none match.
userIdID!RequiredThe member whose transfers are removed.
transferIds[String!]!RequiredIDs to archive. At least one must belong to this member and merchant.
true when the change was made. Anything that stops it comes back as an error.
Lists transfers across all members and store credits, newest first. Pass userId for one member's history, or select transfers on a TokiUser.
queryStringFilter with field:value terms such as created_at:>-30d. Operators: :, :!=, :>, :>=, :<, :<=; dates also accept relative values like -30d, -1w or -6m. Terms are combined with AND unless joined by OR. Fields: amount, created_at, description, source, to_user_id, token_id, transfer_id, type.
reverseBooleanReverse the sort order.
userIdStringOnly this member's transfers.
idIDOnly items whose id equals this value.
A page of TokiTransfer in nodes, with pageInfo for the next page. Each item:
One change to a member's balance, such as points earned, spent, expired or adjusted by hand.
idID!userIdID!The member whose balance changed.
amountFloat!Points moved, as a positive number whether they were added or taken. type tells which.
createdAtString!When the balance changed.
tokenIdID!The store credit whose balance changed; the same ID as TokiUserBalance.id.
typeStringWhether points were added or taken, for example ADDED, ADDED_NONCUMULATIVE (doesn't count toward tier progress), SPENT or PENALTY (also counts against tier progress).
descriptionStringThe transaction's title, which the member sees in their wallet's transaction history.
sourceStringWhat caused the change, for example manual (a manual adjustment), activity_reward, discount_code (points redeemed for a discount code) or token_expiration.
userTokiUserThe member whose balance changed.
issuedRewardTokiIssuedRewardThe activity reward that credited these points; null for transfers with another cause.
Lists perks, the discount codes issued to members, newest first. By default it returns every member's perks in the current store; pass userId for one member or allShops: true for all your stores.
queryStringFilter with field:value terms such as used:false or created_at:>-30d. Operators: :, :!=, :>, :>=, :<, :<=; dates also accept relative values like -30d, -1w or -6m. Terms are combined with AND unless joined by OR. Fields: code, created_at, expired_at, key, order_id, perk_id, reason, total_price, transfer_id, updated_at, used.
reverseBooleanReverse the sort order.
userIdIDOnly this member's perks. Required with groupByDiscount.
allShopsBooleantrue includes perks from all your stores; by default only the current store's.
availableOnlyBooleantrue returns only unused, unexpired codes with a reason the wallet lists as unused discounts: Activity, Refer a friend, Workflow, Custom, External API, Klaviyo, Exclusive Products (Checkout) or a Token Spend … value.
groupByDiscountBooleantrue merges the copies of each code across stores into one item and lists them in shopDetails; use it with allShops: true. Requires userId, and ignores availableOnly.
A page of TokiUserPerk in nodes, with pageInfo for the next page. Each item:
A perk: a discount code Toki issued to a member in one of your stores, for example as a reward or in exchange for points.
perkIdID!userIdID!The member the code was issued to.
createdAtString!When Toki issued the code.
updatedAtString!expiredAtStringWhen the code expires, in the past or the future; null if it has no expiry date.
expiredAtMsFloatexpiredAt as Unix time in milliseconds.
keyStringWhat the code was issued for, usually the ID of a reward rule (TokiReward.id).
codeString!The discount code the member enters at checkout.
valueTokiJSON!The discount as JSON: a type such as absolute, percentage or free-shipping, the code's settings, and for fixed and percentage discounts an amount in your store currency or a percent as a fraction (0.1 is 10%).
reasonString!Where the perk came from, for example Activity, Refer a friend, Workflow, or a Token Spend … value for codes bought with points. Discount and free shipping codes from membership perks carry the membership's name.
usedBooleanWhether the code was used. With groupByDiscount, whether any store's copy was used.
orderIdIDThe order that used the code.
totalPriceFloatThe total of the order that used the code, in your store currency.
shopIdID!The store the code was created in.
transferIdIDThe transfer that deducted the points the member paid for the code; null if it cost no points.
shopNameStringWith groupByDiscount, the name of the store whose copy this item shows; otherwise null.
shopDetails[TokiUserPerkShopDetails!]With groupByDiscount, every store's copy of the code, used ones first; otherwise null.
Returns a member's balance in your default store credit, their conversion rate, and the discount limits of the redemption rule that applies to them in the current store. userSpend works with the same figures.
userIdID!RequiredThe member.
A member's balance and spending limits for userSpend.
balanceFloat!The member's balance in your default store credit, in points.
maxToSpendFloatThe largest discount one code can be worth, in your store currency; null for no maximum.
minToSpendFloatThe smallest discount a code can be worth, in your store currency; null for no minimum.
minimumCartSpendFloatThe cart subtotal a code requires at checkout, in your store currency; null for none.
conversionRateFloat!How many points equal one unit of your store currency for this member.
Lists the membership perks userRedeemPerk can turn into a code for the member: percentage discounts, fixed-amount discounts and free shipping. For each of these kinds, only the highest-ranked membership the member holds that offers one counts.
userIdID!RequiredThe member.
The membership perks a member can redeem.
rewards[TokiUserMembershipPerksRewards!]!The perks: percentage discounts first, then fixed-amount discounts, then free shipping.
Turns part of the member's balance in your default store credit into a single-use discount code worth amount, created in each of your stores. The points are deducted at the member's conversion rate as a transfer, which fires the TRANSACTION_CREATED webhook. It fails if the member is suspended in the current store, has too few points, or no redemption rule allows the amount (see userSpendingRule).
userIdID!RequiredThe member.
amountFloat!RequiredThe discount value in your store currency, such as 12.5. Toki deducts amount times the member's conversion rate in points, rounded to a whole number.
The result of a redemption.
discountCodeStringThe discount code to give the member.
Generates the discount code for one of the member's membership perks in the current store; their balance doesn't change. Calling it again returns the same code while that code is unused and unexpired; unless the perk has an expiry date or period, a code expires an hour after it's generated. For a one-time perk that was already used, discountCode holds a message instead of a code.
userIdID!RequiredThe member.
rewardIdID!RequiredThe perk to redeem: an id from userMembershipPerks.
The result of a redemption.
discountCodeStringThe discount code to give the member.