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

> Search saved Apollo accounts with stages, lists, sorting, and explicit pagination.

`searchAccounts` searches accounts saved in the connected workspace. Use
`searchOrganizations` instead when you want companies from Apollo's broader
intelligence database.

```ts automations/search-apollo-accounts.automation.ts theme={null}
import { automation, onHttpRequest } from "automate.ax"
import { searchAccounts } from "automate.ax/apollo"

export default automation("Find target accounts", () => {
  onHttpRequest({ scope: "automation" })
  searchAccounts({ query: "Acme", stages: ["Qualified"], page: 1 })
})
```

| Input           | Type                                                                           | Required | Default         | Description                                            |
| --------------- | ------------------------------------------------------------------------------ | -------- | --------------- | ------------------------------------------------------ |
| `query`         | `string`                                                                       | No       | None            | Account-name keywords.                                 |
| `stages`        | `ApolloReference[]`                                                            | No       | All             | Stage IDs, exact names, or `{ id }` references.        |
| `lists`         | `ApolloReference[]`                                                            | No       | All             | Account-list IDs, exact names, or `{ id }` references. |
| `sortBy`        | `"account_created_at" \| "account_last_activity_date" \| "account_updated_at"` | No       | Provider order  | Field used to sort.                                    |
| `sortAscending` | `boolean`                                                                      | No       | `false`         | Sort oldest to newest.                                 |
| `page`          | `number`                                                                       | No       | `1`             | One-based page.                                        |
| `perPage`       | `number`                                                                       | No       | `100`           | Page size from 1 through 100.                          |
| `account`       | `string \| IntegrationAccountReference<"apollo">`                              | No       | Project default | Connected Apollo workspace.                            |

Returns `{ accounts: ApolloAccount[]; pagination: ApolloPagination }`.
Pagination includes `page`, `perPage`, `totalEntries`, and `totalPages`.
