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

# Query data

> Runs APL against events, logs, or traces and returns Axiom's v1 tabular query result.

`axiom.queryData` runs APL against events, logs, or traces and returns Axiom's v1 tabular result. The result includes `datasetNames`, `tables`, and query status such as `elapsedTime`, `isPartial`, row counts, cursors, and scanned-block metadata. The time window defaults to `now-30m` through `now`.

```ts automations/axiom-query-data.automation.ts theme={null}
import { automation, onHttpRequest } from "automate.ax"
import { axiom } from "automate.ax/axiom"

export default automation("Query data", () => {
  onHttpRequest({ scope: "automation" })
  axiom.queryData({
    apl: "['production'] | where severity == 'error' | take 20",
    startTime: "now-15m",
    endTime: "now",
  })
})
```

## Inputs

| Input       | Required | Default                                 | Description                                                  |
| ----------- | -------- | --------------------------------------- | ------------------------------------------------------------ |
| `apl`       | Yes      | —                                       | Non-empty Axiom Processing Language query.                   |
| `startTime` | No       | `"now-30m"`                             | Query-window start as an Axiom time expression or timestamp. |
| `endTime`   | No       | `"now"`                                 | Query-window end.                                            |
| `edgeUrl`   | No       | `"https://us-east-1.aws.edge.axiom.co"` | Axiom query edge or an HTTPS `*.edge.axiom.co` origin.       |

Optional inputs include pagination `cursor`, positive `defaultLimit`, `defaultOrder`, cursor-field flags, libraries, variables, and `queryOptions`. Query options control cache, statistics, tracing, priority, resolution, series and data-point limits, null display, interpolation, aggregation, shown columns, and time-series presentation. Automate.ax adds no defaults for these options.

## Output

Returns a tabular result with `datasetNames`, `format: "tabular"`, `tables`, and query `status`. Status includes elapsed time, partial and estimate flags, examined and matched rows, block bounds, group count, cache status, cursors, continuation token, and provider messages when present. Each table describes its fields, groups, order, sources, columns, range, and optional buckets.

## Permission and failures

The API token needs the dataset-level `query|read` capability for every dataset referenced by the query. Axiom rejects invalid APL, inaccessible datasets, and invalid time or query options. A partial result has `status.isPartial: true`; inspect its status and messages before treating it as complete. Request-rate limits return `429`, exhausted query-cost limits return `430`, and queries that exceed memory constraints can return `432`. Automate.ax uses Axiom's reset timing when available.
