> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # QueryReferralRewards # Package: referralProgram # Namespace: ReferralRewards # Method link: https://dev.wix.com/docs/api-reference/business-management/marketing/referral-program/referral-rewards/query-referral-rewards.md ## Permission Scopes: Manage Referrals: SCOPE.DC-REFERRALS.MANAGE-REFERRALS ## Introduction Retrieves a list of referral rewards, given the provided paging, filtering, and sorting. To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language), [Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination), and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection). --- ## REST API ### Schema ``` Method: queryReferralRewards Description: Retrieves a list of referral rewards, given the provided paging, filtering, and sorting. To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language), [Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination), and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection). URL: https://www.wixapis.com/v1/referral-rewards/query Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: query Method parameters: param name: contactId | type: contactId | description: Contact GUID to filter rewards by. Use `"me"` for current identity's rewards. param name: query | type: CursorQuery | required: true - name: cursorPaging | type: CursorPaging | description: Cursor paging options. Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#cursor-paging). - name: limit | type: integer | description: Maximum number of items to return in the results. - name: cursor | type: string | description: Pointer to the next or previous page in the list of results. Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request. - name: filter | type: object | description: Filter object. Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#filters). - name: sort | type: array | description: Sort object. Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#sorting). - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: QueryReferralRewardsResponse - name: referralRewards | type: array | description: Retrieved referral rewards. - ONE-OF: - name: coupon | type: Coupon | description: Details of a coupon reward. Present when `rewardType` is `COUPON`. - name: id | type: string | description: Coupon GUID. Example: `8934b045-7052-4a90-be2b-832c70afc9da`. - name: code | type: string | description: The code that customers can use to apply the coupon. Example: `6RFD2A3HSPXW`. - name: status | type: Status | description: Current status of the coupon. - enum: - UNKNOWN: Coupon status is unknown or not specified. - ACTIVE: Coupon is active and can be applied to purchases. - APPLIED: Coupon was applied and can't be used again. - DELETED: Coupon was deleted and is no longer valid. - name: couponSpecification | type: Coupon | description: Detailed specifications of the coupon. - ONE-OF: - name: fixedAmountOptions | type: FixedAmountDiscount | description: Options for fixed amount discount. - name: amount | type: number | description: Amount of the discount as a fixed value. - name: percentageOptions | type: PercentageDiscount | description: Options for percentage discounts. - name: percentage | type: number | description: Percentage of discount. - ONE-OF: - name: minimumSubtotal | type: number | description: Limit the coupon to carts with a subtotal above this number. - name: scope | type: CouponScope | description: Specifies the type of line items this coupon will apply to. See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values). - name: namespace | type: string | description: Scope namespace (Wix Stores, Wix Bookings, Wix Events, Wix Pricing Plans) - name: group | type: Group | description: Coupon scope's applied group, for example, Event or ticket in Wix Events. - name: name | type: string | description: Name of the group. - name: entityId | type: string | description: Entity GUID of the group. - name: name | type: string | description: Coupon name. - name: discountType | type: DiscountType | description: Coupon discount type. - enum: - UNKNOWN: Unknown discount type. - FIXED_AMOUNT: Discount as a fixed amount. - PERCENTAGE: Discount as a percentage. - FREE_SHIPPING: Free shipping. If `true`, the coupon applies to all items in all `namespaces`. - name: limitedToOneItem | type: boolean | description: Whether the coupon is limited to one item. If `true` and a customer pays for multiple items, the discount applies to only the lowest priced item. Coupons with a bookings `scope.namespace` are always limited to one item. - name: appliesToSubscriptions | type: boolean | description: Whether the coupon applies to subscription products. - name: discountedCycleCount | type: integer | description: Specifies the amount of discounted cycles for a subscription item. - Can only be set when `scope.namespace = pricingPlans`. - If `discountedCycleCount` is empty, the coupon applies to all available cycles. - `discountedCycleCount` is ignored if `appliesToSubscriptions = true`. Max: `999` - name: loyaltyPoints | type: LoyaltyPoints | description: Details of a loyalty points reward. Present when `rewardType` is `LOYALTY_POINTS`. - name: transactionId | type: string | description: Loyalty transaction GUID. - name: amount | type: integer | description: The number of loyalty points awarded. - name: id | type: string | description: Referral reward GUID. - name: revision | type: string | description: Revision number, which increments by 1 each time the referral reward is updated. To prevent conflicting changes, the current revision must be passed when updating the referral reward. - name: createdDate | type: string | description: Date and time the referral reward was created. - name: updatedDate | type: string | description: Date and time the referral reward was last updated. - name: rewardType | type: Type | description: Type of reward given. - enum: - UNKNOWN: Unknown reward type. - COUPON: Loyalty coupon is given. - LOYALTY_POINTS: Loyalty points are awarded. - NOTHING: No reward is given. - name: metadata | type: CursorPagingMetadata | description: Metadata for paging. - name: count | type: integer | description: Number of items returned in current page. - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both. - name: next | type: string | description: Cursor string pointing to the next page in the list of results. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page. + `true`: Another page of results can be retrieved. + `false`: This is the last page. ``` ### Examples ### Query Referral Rewards ```curl curl -X POST \ 'https://www.wixapis.com/_api/referral-rewards/v1/referral-rewards/query' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "query": { "sort": [ { "order": "DESC", "fieldName": "revision" } ], "filter": { "rewardType": "CouponReward" } }, "contactId": "me" }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.referralProgram.ReferralRewards.queryReferralRewards(query, options) Description: Retrieves a list of referral rewards, given the provided paging, filtering, and sorting. To learn about working with _Query_ endpoints, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language), [Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination), and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection). # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: query Method parameters: param name: options | type: QueryReferralRewardsOptions none - name: contactId | type: string | description: Contact GUID to filter rewards by. Use `"me"` for current identity's rewards. param name: query | type: ReferralRewardQuery | required: true - name: cursorPaging | type: CursorPaging | description: Cursor paging options. Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#cursor-paging). - name: limit | type: integer | description: Maximum number of items to return in the results. - name: cursor | type: string | description: Pointer to the next or previous page in the list of results. Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request. - name: filter | type: object | description: Filter object. Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#filters). - name: sort | type: array | description: Sort object. Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#sorting). - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: PROMISE - name: referralRewards | type: array | description: Retrieved referral rewards. - ONE-OF: - name: coupon | type: Coupon | description: Details of a coupon reward. Present when `rewardType` is `COUPON`. - name: _id | type: string | description: Coupon GUID. Example: `8934b045-7052-4a90-be2b-832c70afc9da`. - name: code | type: string | description: The code that customers can use to apply the coupon. Example: `6RFD2A3HSPXW`. - name: status | type: Status | description: Current status of the coupon. - enum: - UNKNOWN: Coupon status is unknown or not specified. - ACTIVE: Coupon is active and can be applied to purchases. - APPLIED: Coupon was applied and can't be used again. - DELETED: Coupon was deleted and is no longer valid. - name: couponSpecification | type: Coupon | description: Detailed specifications of the coupon. - ONE-OF: - name: fixedAmountOptions | type: FixedAmountDiscount | description: Options for fixed amount discount. - name: amount | type: number | description: Amount of the discount as a fixed value. - name: percentageOptions | type: PercentageDiscount | description: Options for percentage discounts. - name: percentage | type: number | description: Percentage of discount. - ONE-OF: - name: minimumSubtotal | type: number | description: Limit the coupon to carts with a subtotal above this number. - name: scope | type: CouponScope | description: Specifies the type of line items this coupon will apply to. See [valid scope values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values). - name: namespace | type: string | description: Scope namespace (Wix Stores, Wix Bookings, Wix Events, Wix Pricing Plans) - name: group | type: Group | description: Coupon scope's applied group, for example, Event or ticket in Wix Events. - name: name | type: string | description: Name of the group. - name: entityId | type: string | description: Entity GUID of the group. - name: name | type: string | description: Coupon name. - name: discountType | type: DiscountType | description: Coupon discount type. - enum: - UNKNOWN: Unknown discount type. - FIXED_AMOUNT: Discount as a fixed amount. - PERCENTAGE: Discount as a percentage. - FREE_SHIPPING: Free shipping. If `true`, the coupon applies to all items in all `namespaces`. - name: limitedToOneItem | type: boolean | description: Whether the coupon is limited to one item. If `true` and a customer pays for multiple items, the discount applies to only the lowest priced item. Coupons with a bookings `scope.namespace` are always limited to one item. - name: appliesToSubscriptions | type: boolean | description: Whether the coupon applies to subscription products. - name: discountedCycleCount | type: integer | description: Specifies the amount of discounted cycles for a subscription item. - Can only be set when `scope.namespace = pricingPlans`. - If `discountedCycleCount` is empty, the coupon applies to all available cycles. - `discountedCycleCount` is ignored if `appliesToSubscriptions = true`. Max: `999` - name: loyaltyPoints | type: LoyaltyPoints | description: Details of a loyalty points reward. Present when `rewardType` is `LOYALTY_POINTS`. - name: transactionId | type: string | description: Loyalty transaction GUID. - name: amount | type: integer | description: The number of loyalty points awarded. - name: _id | type: string | description: Referral reward GUID. - name: revision | type: string | description: Revision number, which increments by 1 each time the referral reward is updated. To prevent conflicting changes, the current revision must be passed when updating the referral reward. - name: _createdDate | type: Date | description: Date and time the referral reward was created. - name: _updatedDate | type: Date | description: Date and time the referral reward was last updated. - name: rewardType | type: Type | description: Type of reward given. - enum: - UNKNOWN: Unknown reward type. - COUPON: Loyalty coupon is given. - LOYALTY_POINTS: Loyalty points are awarded. - NOTHING: No reward is given. - name: metadata | type: CursorPagingMetadata | description: Metadata for paging. - name: count | type: integer | description: Number of items returned in current page. - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both. - name: next | type: string | description: Cursor string pointing to the next page in the list of results. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page. + `true`: Another page of results can be retrieved. + `false`: This is the last page. ``` ### Examples ### queryReferralRewards ```javascript import { rewards } from '@wix/referral'; async function queryReferralRewards(query,options) { const response = await rewards.queryReferralRewards(query,options); }; ``` ### queryReferralRewards (with elevated permissions) ```javascript import { rewards } from '@wix/referral'; import { auth } from '@wix/essentials'; async function myQueryReferralRewardsMethod(query,options) { const elevatedQueryReferralRewards = auth.elevate(rewards.queryReferralRewards); const response = await elevatedQueryReferralRewards(query,options); } ``` ### queryReferralRewards (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { rewards } from '@wix/referral'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { rewards }, // Include the auth strategy and host as relevant }); async function queryReferralRewards(query,options) { const response = await myWixClient.rewards.queryReferralRewards(query,options); }; ``` ---