> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Search Loyalty Events

> Searches for loyalty events.

`square.searchLoyaltyEvents` searches for loyalty events.

## Example

```ts automations/square-search-loyalty-events.automation.ts theme={null}
import { automation, onDashboardRun } from "automate.ax"
import { square } from "automate.ax/square"

export default automation("Search Square Loyalty Events", () => {
  onDashboardRun({ title: "Search Square Loyalty Events" })

  square.searchLoyaltyEvents({
    query: {
      filter: {
        orderFilter: {
          orderId: "PyATxhYLfsMqpVkcKJITPydgEYfZY",
        },
      },
    },
    limit: 30,
  })
})
```

## Inputs

Every input accepts a compatible signal. It requires `LOYALTY_READ`.

| Field    | Type                       | Required | Default | Description                                                                                                                                                                                                                                                          |
| -------- | -------------------------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `query`  | `Square.LoyaltyEventQuery` | No       | —       | 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.                                 |
| `limit`  | `number`                   | No       | —       | The maximum number of results to include in the response. The last page might contain fewer events. The default is 30 events.                                                                                                                                        |
| `cursor` | `string`                   | No       | —       | 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). |

Use the official [SearchLoyaltyEvents reference](https://developer.squareup.com/reference/square/loyalty-api/search-loyalty-events) for provider field semantics and limits.

## Output

Returns the official `Square.SearchLoyaltyEventsResponse` response as a codec-safe object. Square integer money amounts remain `bigint` values.
