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

# Run query

> Run a public or internal Convex query.

`convex.runQuery` calls a named query on a connected Convex deployment and returns its Convex value.

```ts automations/read-convex-messages.automation.ts theme={null}
import { automation, onSchedule } from "automate.ax"
import { convex } from "automate.ax/convex"

export default automation("Read Convex messages", () => {
  onSchedule({ schedule: "0 * * * *" })
  convex.runQuery({
    functionName: "messages:list",
    arguments: { limit: 25 },
  })
})
```

## Inputs

| Input                          | Type                                              | Required | Default         | Description                                                                                   |
| ------------------------------ | ------------------------------------------------- | -------- | --------------- | --------------------------------------------------------------------------------------------- |
| `functionName`                 | `string`                                          | Yes      | None            | Exported HTTP API path, such as `messages:list` or `reports:get`.                             |
| `arguments`                    | `Record<string, ConvexValue>`                     | No       | `{}`            | Convex function arguments.                                                                    |
| `deployment`                   | `string`                                          | No       | `prod`          | Deployment reference for a project OAuth connection. Omit it for a deployment-key connection. |
| Second argument: `{ account }` | `string \| IntegrationAccountReference<"convex">` | No       | Project default | Connected Convex account.                                                                     |

The result is a `ConvexValue`, including Convex `bigint` and `ArrayBuffer` values. For an internal query, omit the `internal.` prefix used by generated Convex references and connect credentials with the corresponding run-internal permission.

The selected deployment must use a hosted `.convex.cloud` URL. Automate.ax can't reach a local development deployment.
