# destroy()

Canonical URL: https://developers.iagenify.com/sdk/ref/workflow/destroy/
Language: en

`workflow.destroy() → Promise<void>`

Deletes the workflow. Its runs are kept, and a run in flight is not stopped.

Status: DELETE · runs are kept · in-flight runs continue

```javascript
await workflow.destroy();
```

## The run history stays {#runs}

> **A run is a record of what happened**
>
> Deleting the definition does not rewrite history: the runs remain and are reachable by identifier with getRun(). What a workflow did is not undone by removing the workflow.

## A running run is not cancelled {#in-flight}

It carries its own copy of the definition and finishes. To stop one, call [cancel()](/sdk/ref/workflow-run/cancel) on it — deleting the workflow is not a way to stop work.

## Scheduled and inbound triggers stop {#triggers}

Nothing new starts: a schedule no longer fires, and an inbound request no longer has a workflow to start.

## There is no undo {#no-undo}

Keep the definition if you may want it back — `workflow.data` is exactly what [create()](/sdk/ref/workflows/create) takes.

- [cancel()](/sdk/ref/workflow-run/cancel): Stopping a run instead.
- [getRun()](/sdk/ref/workflows/get-run): Reaching a run afterwards.

```python
workflow.destroy()
```
