action squareup_search_loyalty_rewards { label: "SearchLoyaltyRewards" description: "Searches for loyalty rewards in a loyalty account. \n\nIn the current implementation, the endpoint supports search by the reward `status`.\n\nIf you know a reward ID, use the \n[RetrieveLoyaltyReward](https://developer.squareup.com/reference/square_2021-08-18/loyalty-api/retrieve-loyalty-reward) endpoint.\n\nSearch results are sorted by `updated_at` in descending order." provider: squareup method: POST path: "/v2/loyalty/rewards/search" encoding: json input: { type: "object" description: "A request to search for loyalty rewards." properties: { cursor: { type: "string" description: "A pagination cursor returned by a previous call to \nthis endpoint. Provide this to retrieve the next set of \nresults for the original query.\nFor more information, \nsee [Pagination](https://developer.squareup.com/docs/basics/api101/pagination)." } limit: { type: "integer" description: "The maximum number of results to return in the response." } query: { type: "object" description: "The set of search requirements." required: ["loyalty_account_id"] properties: { loyalty_account_id: { type: "string" description: "The ID of the [loyalty account](https://developer.squareup.com/reference/square_2021-08-18/objects/LoyaltyAccount) to which the loyalty reward belongs." } status: { type: "string" description: "The status of the loyalty reward." } } } } } output: { type: "object" description: "A response that includes the loyalty rewards satisfying the search criteria." properties: { cursor: { type: "string" description: "The pagination cursor to be used in a subsequent \nrequest. If empty, this is the final response." } errors: { type: "array" description: "Any errors that occurred during the request." items: { type: "object" description: "Represents an error encountered during a request to the Connect API.\n\nSee [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information." required: ["category", "code"] properties: { category: { type: "string" description: "The high-level category for the error." } code: { type: "string" description: "The specific code of the error." } detail: { type: "string" description: "A human-readable description of the error for debugging purposes." } field: { type: "string" description: "The name of the field provided in the original request (if any) that\nthe error pertains to." } } } } rewards: { type: "array" description: "The loyalty rewards that satisfy the search criteria.\nThese are returned in descending order by `updated_at`." items: { type: "object" description: "Represents a contract to redeem loyalty points for a [reward tier](https://developer.squareup.com/reference/square_2021-08-18/objects/LoyaltyProgramRewardTier) discount. Loyalty rewards can be in an ISSUED, REDEEMED, or DELETED state. For more information, see [Redeem loyalty rewards](https://developer.squareup.com/docs/loyalty-api/overview#redeem-loyalty-rewards)." required: ["loyalty_account_id", "reward_tier_id"] properties: { created_at: { type: "string" description: "The timestamp when the reward was created, in RFC 3339 format." } id: { type: "string" description: "The Square-assigned ID of the loyalty reward." } loyalty_account_id: { type: "string" description: "The Square-assigned ID of the [loyalty account](https://developer.squareup.com/reference/square_2021-08-18/objects/LoyaltyAccount) to which the reward belongs." } order_id: { type: "string" description: "The Square-assigned ID of the [order](https://developer.squareup.com/reference/square_2021-08-18/objects/Order) to which the reward is attached." } points: { type: "integer" description: "The number of loyalty points used for the reward." } redeemed_at: { type: "string" description: "The timestamp when the reward was redeemed, in RFC 3339 format." } reward_tier_id: { type: "string" description: "The Square-assigned ID of the [reward tier](https://developer.squareup.com/reference/square_2021-08-18/objects/LoyaltyProgramRewardTier) used to create the reward." } status: { type: "string" description: "The status of a loyalty reward." } updated_at: { type: "string" description: "The timestamp when the reward was last updated, in RFC 3339 format." } } } } } } }