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

# Get saved query

> Retrieves one saved APL query.

`axiom.getSavedQuery` retrieves one saved APL query. The result includes its query text, time range, metadata, dataset hint, and owner.

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

export default automation("Get saved query", () => {
  onHttpRequest({ scope: "automation" })
  axiom.getSavedQuery({ savedQueryId: "saved-query-id" })
})
```

## Input

`savedQueryId` is required and selects one saved query.

## Output

Returns `id`, `name`, `kind: "apl"`, string `metadata`, `who`, the complete query request, and the optional dataset hint.

## Permission and failures

The API token needs the dataset-level `starredQueries|read` capability. Axiom returns an error when the saved query does not exist or the token cannot access it.
