# Bulk Delete Failed Workflow Runs

> Delete multiple failed workflow runs from the DLQ.

## Endpoint

`DELETE https://qstash-{region}.upstash.io/v2/workflows/dlq`

Delete multiple failed workflow runs from the DLQ.

When a workflow run fails, it is moved to the DLQ. You can manually remove a failed workflow run from the DLQ using this endpoint. This is useful for cleaning up failed runs that you no longer wish to retry or analyze.

You can either specify specific DLQ IDs to delete, or use filters to delete matching workflows.
When using filters without DLQ IDs, the operation supports pagination via cursor.


## Parameters

- `dlqIds` (query, string[]): List of specific DLQ IDs to delete. If provided, other filters are ignored.
- `cursor` (query, string): Pagination cursor for deleting in batches.
- `count` (query, integer): Maximum number of workflows to delete per request.
- `fromDate` (query, integer): Filter by starting date in milliseconds (Unix timestamp). This is inclusive.
- `toDate` (query, integer): Filter by ending date in milliseconds (Unix timestamp). This is inclusive.
- `workflowUrl` (query, string[]): Filter by workflow URL. Supports multiple values.
- `workflowRunId` (query, string): Filter by workflow run ID.
- `workflowCreatedAt` (query, integer): Filter by workflow creation timestamp in milliseconds (Unix timestamp).
- `label` (query, string[]): Filter by label assigned to the workflow run. Supports multiple values. You can pass multiple values to match workflow runs with any of the given labels (OR logic).

Examples:
- `label=my_label`
- `label=label_1&label=label_2`
- `label=label_1,label_2`

- `failureFunctionState` (query, string[]): Filter by failure function state. Supports multiple values.

| State | Description |
|--------|--------------|
| CALLBACK_INPROGRESS | The failure function is in progress. |
| CALLBACK_SUCCESS | The failure function run successfully. |
| CALLBACK_FAIL | The failure function failed to run. |
| CALLBACK_CANCELED | The failure function was manually canceled |

- `callerIp` (query, string[]): Filter by IP address of the publisher. Supports multiple values.
- `flowControlKey` (query, string[]): Filter by Flow Control Key. Supports multiple values.

## Responses

### 200 - Workflows deleted successfully

- `deleted` (integer): The number of workflow runs that were deleted.
- `cursor` (string): Pagination cursor for the next batch. Only present when using filters without DLQ IDs.

### 400 - Bad Request

- `error` (string, required): Error message

### 401 - Unauthorized

- `error` (string, required): Error message

### 500 - Internal Server Error

- `error` (string, required): Error message

## cURL

```bash
curl --request DELETE \
  --url https://qstash-{region}.upstash.io/v2/workflows/dlq \
  --header 'Authorization: Bearer <token>'
```
