# Delete a workflow

**DELETE** `/api/workflows/{id}`

Deletes a workflow for good, with its versions and every run.

Needs [an API token](https://docs.gorunner.io/api/authentication#scopes) with the **Delete** permission for workflows (`workflow:delete`).

> **Danger** There is no undo. A live workflow is deleted without being unpublished, and its webhook address stops working.

## Parameters

### Path

- `id` · Required · UUID: The workflow’s ID.

## What goes with it

Its versions, its runs (held and waiting ones too), their steps, and the step data kept in storage, which workers remove shortly after.

A workflow that calls it as a sub-flow, or names it as its error workflow, isn’t stopped. Its runs fail when they reach it.

## Responses

- 200 OK

  Deleted.

- 400 `VALIDATION_ERROR`

  `id` isn’t a UUID.

- 403 `FORBIDDEN`

  The token lacks the **Delete** permission for workflows. Write isn’t enough.

- 404 `NOT_FOUND`

  No workflow with this ID in the token’s workspace.

- 409 `BUSY`

  Something else held the workflow, and the call gave up waiting after 30 seconds. Nothing changed. Try again.

- 500 `DELETE_FAILED`

  Nothing was deleted, and the workflow is still there. Try again.

Any call can also answer: [`401 UNAUTHORIZED`](https://docs.gorunner.io/errors#UNAUTHORIZED) · [`401 TOKEN_ENDED`](https://docs.gorunner.io/errors#TOKEN_ENDED) · [`403 TOKEN_SURFACE_OFF`](https://docs.gorunner.io/errors#TOKEN_SURFACE_OFF) · [`403 FEATURE_OFF`](https://docs.gorunner.io/errors#FEATURE_OFF) · [`403 EMBED_NOT_ALLOWED`](https://docs.gorunner.io/errors#EMBED_NOT_ALLOWED) · [`403 EMBED_NOT_AVAILABLE`](https://docs.gorunner.io/errors#EMBED_NOT_AVAILABLE) · [`403 ACCOUNT_SUSPENDED`](https://docs.gorunner.io/errors#ACCOUNT_SUSPENDED) · [`429 RATE_LIMITED`](https://docs.gorunner.io/errors#RATE_LIMITED) · [`503 BUSY`](https://docs.gorunner.io/errors#BUSY) · [`503 PAUSED`](https://docs.gorunner.io/errors#PAUSED) · [`503 SERVICE_UNAVAILABLE`](https://docs.gorunner.io/errors#SERVICE_UNAVAILABLE). See [Errors](https://docs.gorunner.io/api/errors#by-status).

Request

**curl**

```bash
GORUNNER="https://api.gorunner.io"
GORUNNER_TOKEN="grt_…"  # needs Delete for workflows
WORKFLOW_ID="your-workflow-id"

curl -X DELETE "$GORUNNER/api/workflows/$WORKFLOW_ID" \
  -H "Authorization: Bearer $GORUNNER_TOKEN"
```

**JavaScript**

```js
const GORUNNER = "https://api.gorunner.io";
const TOKEN = process.env.GORUNNER_TOKEN;
const WORKFLOW_ID = process.env.WORKFLOW_ID;

const res = await fetch(
  `${GORUNNER}/api/workflows/${WORKFLOW_ID}`,
  {
    method: "DELETE",
    headers: { Authorization: `Bearer ${TOKEN}` },
  },
);
const { data } = await res.json();
```

**Python**

```python
import os, requests

GORUNNER = "https://api.gorunner.io"
TOKEN = os.environ["GORUNNER_TOKEN"]
WORKFLOW_ID = os.environ["WORKFLOW_ID"]

res = requests.delete(
    f"{GORUNNER}/api/workflows/{WORKFLOW_ID}",
    headers={"Authorization": f"Bearer {TOKEN}"},
)
data = res.json()["data"]
```

Response · 200 OK

```json
{
  "data": {
    "message": "Workflow deleted"
  }
}
```

**Every field**

It takes no body.

### Response · 200 OK

- `data` · object
  - `message` · string

Related: [Unpublish a workflow](https://docs.gorunner.io/api/publish/unpublish-workflow) · [Change many workflows at once](https://docs.gorunner.io/api/workflows/bulk-update-workflows)

Source: https://docs.gorunner.io/api/workflows/delete-workflow
