Square: Search Loyalty Events
Square loyalty.searchLoyaltyEvents: arguments, response, policy and SDK examples.
← Loyalty operations · Get started
Operation square.searchloyaltyevents
Provider route: POST /v2/loyalty/events/search. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/square with npm, or alter-sdk-square with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { SquareIntegration } from "@alter-ai/square";
async function execute(input: Parameters<SquareIntegration["loyalty"]["searchLoyaltyEvents"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new SquareIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.loyalty.searchLoyaltyEvents(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_square import SquareIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = SquareIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.loyalty.search_loyalty_events(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
body | Model | Required within parent | Expand Search Loyalty Events — request body — body |
Referenced models: Search Loyalty Events — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Search Loyalty Events — response body |
Referenced models: Search Loyalty Events — response body
Schemas
Section titled “Schemas”14 more schemas are linked from the tables above, on the schema pages.
Search Loyalty Events — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A response that contains loyalty events that satisfy the search criteria, in order by the `created_at` date. |
cursor | string | Optional | The pagination cursor to be used in a subsequent request. If empty, this is the final response. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
errors | array | Optional | Any errors that occurred during the request. |
errors[] | Model | Each item | Expand Get Shift — response body — errors item |
events | array | Optional | The loyalty events that satisfy the search criteria. |
events[] | Model | Each item | Expand Adjust Loyalty Points — response body — event |
Referenced models: Get Shift — response body — errors item, Adjust Loyalty Points — response body — event
Search Loyalty Events — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A request to search for loyalty events. |
cursor | string | Optional | A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
limit | integer | Optional | The maximum number of results to include in the response. The last page might contain fewer events. The default is 30 events. Maximum: 30 Minimum: 1 |
query | Model | Optional | Expand Search Loyalty Events — request body — body query A set of one or more predefined query filters to apply when searching for loyalty events. The endpoint performs a logical AND to evaluate multiple filters and performs a logical OR on arrays that specifies multiple field values. |
Referenced models: Search Loyalty Events — request body — body query
Get Shift — response body — errors item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents an error encountered during a request to the Connect API. See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information. |
category | string | Required within parent | Indicates which high-level category of error has occurred during a request to the Connect API. The high-level category for the error. See [ErrorCategory](#type-errorcategory) for possible values Known values: API_ERROR, AUTHENTICATION_ERROR, INVALID_REQUEST_ERROR, RATE_LIMIT_ERROR, PAYMENT_METHOD_ERROR, REFUND_ERROR, MERCHANT_SUBSCRIPTION_ERROR, EXTERNAL_VENDOR_ERROR |
code | Model | Required within parent | Expand Get Shift — response body — errors item code The specific code of the error. See [ErrorCode](#type-errorcode) for possible values |
detail | string | Optional | A human-readable description of the error for debugging purposes. |
field | string | Optional | The name of the field provided in the original request (if any) that the error pertains to. |
Referenced models: Get Shift — response body — errors item code
Adjust Loyalty Points — response body — event
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Provides information about a loyalty event. For more information, see [Search for Balance-Changing Loyalty Events](https://developer.squareup.com/docs/loyalty-api/loyalty-events). |
accumulate_points | Model | Optional | Expand Adjust Loyalty Points — response body — event accumulate points Provides metadata when the event `type` is `ACCUMULATE_POINTS`. Read only: true |
accumulate_promotion_points | Model | Optional | Expand Adjust Loyalty Points — response body — event accumulate promotion points Provides metadata when the event `type` is `ACCUMULATE_PROMOTION_POINTS`. Read only: true |
adjust_points | Model | Optional | Expand Adjust Loyalty Points — response body — event adjust points Provides metadata when the event `type` is `ADJUST_POINTS`. Read only: true |
create_reward | Model | Optional | Expand Adjust Loyalty Points — response body — event create reward Provides metadata when the event `type` is `CREATE_REWARD`. Read only: true |
created_at | string | Required within parent | The timestamp when the event was created, in RFC 3339 format. Minimum length: 1 Read only: true |
delete_reward | Model | Optional | Expand Adjust Loyalty Points — response body — event delete reward Provides metadata when the event `type` is `DELETE_REWARD`. Read only: true |
expire_points | Model | Optional | Expand Adjust Loyalty Points — response body — event expire points Provides metadata when the event `type` is `EXPIRE_POINTS`. Read only: true |
id | string | Required within parent | The Square-assigned ID of the loyalty event. Minimum length: 1 Read only: true |
location_id | string | Optional | The ID of the [location](entity:Location) where the event occurred. Read only: true |
loyalty_account_id | string | Required within parent | The ID of the [loyalty account](entity:LoyaltyAccount) associated with the event. Maximum length: 36 Minimum length: 1 Read only: true |
other_event | Model | Optional | Expand Adjust Loyalty Points — response body — event other event Provides metadata when the event `type` is `OTHER`. Read only: true |
redeem_reward | Model | Optional | Expand Adjust Loyalty Points — response body — event redeem reward Provides metadata when the event `type` is `REDEEM_REWARD`. Read only: true |
source | string | Required within parent | Defines whether the event was generated by the Square Point of Sale. Defines whether the event was generated by the Square Point of Sale. See [LoyaltyEventSource](#type-loyaltyeventsource) for possible values Known values: SQUARE, LOYALTY_API Read only: true |
type | string | Required within parent | The type of the loyalty event. The type of the loyalty event. See [LoyaltyEventType](#type-loyaltyeventtype) for possible values Known values: ACCUMULATE_POINTS, CREATE_REWARD, REDEEM_REWARD, DELETE_REWARD, ADJUST_POINTS, EXPIRE_POINTS, OTHER, ACCUMULATE_PROMOTION_POINTS Read only: true |
Referenced models: Adjust Loyalty Points — response body — event redeem reward, Adjust Loyalty Points — response body — event accumulate points, Adjust Loyalty Points — response body — event accumulate promotion points, Adjust Loyalty Points — response body — event adjust points, Adjust Loyalty Points — response body — event create reward, Adjust Loyalty Points — response body — event delete reward, Adjust Loyalty Points — response body — event expire points, Adjust Loyalty Points — response body — event other event
Search Loyalty Events — request body — body query
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents a query used to search for loyalty events. |
filter | JSON | Optional | |
filter (anyOf 1) | Model | Alternative | Expand Search Loyalty Events — request body — body query filter date time filter, location filter, loyalty account filter, order filter, type filter The query filter criteria. |
filter (anyOf 2) | null | Alternative |
Referenced models: Search Loyalty Events — request body — body query filter date time filter, location filter, loyalty account filter, order filter, type filter
Adjust Loyalty Points — response body — event redeem reward
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Provides metadata when the event `type` is `REDEEM_REWARD`. |
loyalty_program_id | string | Required within parent | The ID of the [loyalty program](entity:LoyaltyProgram). Maximum length: 36 Minimum length: 1 Read only: true |
order_id | string | Optional | The ID of the [order](entity:Order) that redeemed the reward. This field is returned only if the Orders API is used to process orders. Read only: true |
reward_id | string | Optional | The ID of the redeemed [loyalty reward](entity:LoyaltyReward). This field is returned only if the event source is `LOYALTY_API`. Maximum length: 36 Read only: true |
Adjust Loyalty Points — response body — event adjust points
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Provides metadata when the event `type` is `ADJUST_POINTS`. |
loyalty_program_id | string | Optional | The Square-assigned ID of the [loyalty program](entity:LoyaltyProgram). Maximum length: 36 Read only: true |
points | JSON | Required within parent | |
points (anyOf 1) | integer | Alternative | The number of points added or removed. |
points (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
reason | JSON | Optional | |
reason (anyOf 1) | string | Alternative | The reason for the adjustment of points. Maximum length: 3500 |
reason (anyOf 2) | null | Alternative |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: square.searchloyaltyevents. Catalog operation: SearchLoyaltyEvents. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["LOYALTY_READ"]
Pinned headers: {"Square-Version": "2026-11-18"}