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

# Trim dataset

> Deletes events older than the relative `maxDuration`.

`axiom.trimDataset` deletes events older than the relative `maxDuration`. Axiom evaluates the duration at execution time and returns no response body.

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

export default automation("Trim dataset", () => {
  onHttpRequest({ scope: "automation" })
  axiom.trimDataset({ datasetName: "production", maxDuration: "720h" })
})
```

<Warning>
  This operation changes or deletes provider data. Confirm the target before
  deployment.
</Warning>

## Inputs

`datasetName` selects the dataset by name or ID. `maxDuration` is a required, non-empty relative duration such as `"720h"`; Axiom removes events older than that duration when it processes the request. There are no defaults.

## Output

Returns `null` after Axiom accepts the trim request. A successful response means Axiom queued the deletion, not that every matching event has already disappeared; completion can take several hours.

## Permission and failures

The API token needs the dataset-level `trim|update` capability for `datasetName`. Axiom rejects missing or inaccessible datasets and invalid duration expressions. This destructive mutation is not retried automatically after an ambiguous provider response.
