> ## 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 Customers

> Searches the customer profiles associated with a Square account using one or more supported query filters.

`square.searchCustomers` searches the customer profiles associated with a Square account using one or more supported query filters.

## Example

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

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

  square.searchCustomers({
    limit: BigInt("2"),
    query: {
      filter: {
        creationSource: {
          values: ["THIRD_PARTY"],
          rule: "INCLUDE",
        },
        createdAt: {
          startAt: "2018-01-01T00:00:00-00:00",
          endAt: "2018-02-01T00:00:00-00:00",
        },
        emailAddress: {
          fuzzy: "example.com",
        },
        groupIds: {
          all: ["545AXB44B4XXWMVQ4W8SBT3HHF"],
        },
      },
      sort: {
        field: "CREATED_AT",
        order: "ASC",
      },
    },
  })
})
```

## Inputs

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

| Field    | Type                   | Required | Default | Description                                                                                                                                                                                                                                                                                                                                                                                   |
| -------- | ---------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cursor` | `string`               | No       | —       | Include the pagination cursor in subsequent calls to this endpoint to retrieve the next set of results associated with the original query. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).                                                                                                                           |
| `limit`  | `bigint`               | No       | 100     | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. If the specified limit is invalid, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100. For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). |
| `query`  | `Square.CustomerQuery` | No       | —       | The filtering and sorting criteria for the search request. If a query is not specified, Square returns all customer profiles ordered alphabetically by `given_name` and `family_name`.                                                                                                                                                                                                        |
| `count`  | `boolean`              | No       | `false` | Indicates whether to return the total count of matching customers in the `count` field of the response. The default value is `false`.                                                                                                                                                                                                                                                         |

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

## Output

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