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

# On document deleted

> Run an automation when Convex deletes a document.

`convex.onDocumentDeleted` watches one table and starts the automation when Convex emits a document tombstone.

```ts automations/deleted-convex-message.automation.ts theme={null}
import { automation } from "automate.ax"
import { convex } from "automate.ax/convex"

export default automation("Deleted Convex message", () => {
  const event = convex.onDocumentDeleted({ table: "messages" })
  // Remove state tied to the deleted Convex document.
})
```

Options are `table`, optional `component` (default `""`), optional OAuth `deployment` (default `prod`), and optional `account`. Trigger data includes `documentId`, `revision`, `table`, `component`, `action: "deleted"`, and `document: null`.

This trigger requires Convex Pro Data Sync and `deployment:data:view`.
