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

# Delete a draft

> Permanently delete an unsent Gmail draft.

`deleteDraft` permanently removes an unsent draft from Gmail. Use it to discard
a draft that should never be sent.

## Example

```ts automations/delete-expired-draft.automation.ts theme={null}
import { automation, onHttpRequest } from "automate.ax"
import { deleteDraft } from "automate.ax/gmail"

export default automation("Delete an expired Gmail draft", () => {
  onHttpRequest({ scope: "automation" })

  deleteDraft({
    draftId: "r1234567890",
  })
})
```

## Inputs

| Input     | Type                                              | Required | Default         | Description                                     |
| --------- | ------------------------------------------------- | -------- | --------------- | ----------------------------------------------- |
| `draftId` | `string`                                          | Yes      | —               | Immutable Gmail draft ID to delete permanently. |
| `account` | `string \| IntegrationAccountReference<"google">` | No       | Project default | Connected Google account that owns the draft.   |

Every input, including `account`, also accepts a compatible `Signal`.

<Warning>
  Gmail does not provide a way to restore a draft deleted by this action. Pass
  the `draftId` returned by a draft action, not the draft's `messageId`.
</Warning>

The action fails if the draft was already sent or deleted, or belongs to a
different connected account.

## Output

The action returns the deleted `draftId` as a `Signal<string>`. This lets a
later action record exactly which draft was removed.
