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

> Searches for invoices from a location specified in the filter.

`square.searchInvoices` searches for invoices from a location specified in the filter.

## Example

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

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

  square.searchInvoices({
    query: {
      filter: {
        locationIds: ["ES0RJRZYEC39A"],
        customerIds: ["JDKYHBWT1D4F8MFH63DBMEN8Y4"],
      },
      sort: {
        field: "INVOICE_SORT_DATE",
        order: "DESC",
      },
    },
    limit: 100,
  })
})
```

## Inputs

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

| Field    | Type                  | Required | Default | Description                                                                                                                                                                                                                                                                 |
| -------- | --------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `query`  | `Square.InvoiceQuery` | Yes      | —       | Describes the query criteria for searching invoices.                                                                                                                                                                                                                        |
| `limit`  | `number`              | No       | —       | The maximum number of invoices to return (200 is the maximum `limit`). If not provided, the server uses a default limit of 100 invoices.                                                                                                                                    |
| `cursor` | `string`              | No       | —       | A pagination cursor returned by a previous call to this endpoint. Provide this cursor 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 [SearchInvoices reference](https://developer.squareup.com/reference/square/invoices-api/search-invoices) for provider field semantics and limits.

## Output

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