# List Failed Workflow Runs

> List and paginate through all failed workflow runs currently in the DLQ.

## Endpoint

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

List and paginate through all failed workflow runs currently in the DLQ.

Failed workflows end up in the DLQ after exhausting all retry attempts. You can filter,
paginate, and inspect these failures to understand what went wrong and decide whether to
resume, restart, or delete them.


## Parameters

- `cursor` (query, string): Pagination cursor. If provided, returns the next page of results.
- `count` (query, integer): The maximum number of failed workflow runs to return per page.
- `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 - List of failed workflow runs

- `cursor` (string): Pagination cursor for the next page. Empty if no more results.
- `messages` (object[]): Array of failed workflow messages.
  - `dlqId` (string): The DLQ ID of the failed workflow message.
  - `workflowUrl` (string): The URL of the workflow.
  - `workflowRunId` (string): The ID of the workflow run.
  - `workflowCreatedAt` (integer): The timestamp when the workflow run was created (Unix timestamp in milliseconds).
  - `url` (string): The URL of the failed workflow step.
  - `method` (string): The HTTP method used for the workflow step.
  - `header` (object): The HTTP headers sent to the workflow step.
  - `body` (string): The body of the message if it is composed of utf8 chars only, empty otherwise.
  - `bodyBase64` (string): The base64 encoded body if the body contains a non-utf8 char only, empty otherwise.
  - `maxRetries` (integer): The number of retries that should be attempted in case of delivery failure.
  - `createdAt` (integer): The unix timestamp in milliseconds when the message was created.
  - `failureCallback` (string): The url where we send a callback to after the workflow fails.
  - `callerIP` (string): IP address of the publisher of this workflow.
  - `label` (string): The label assigned to the workflow run. Deprecated in favor of `labels`.
  - `labels` (string[]): The list of labels assigned to the workflow run.
  - `flowControlKey` (string): The flow control key used for rate limiting.
  - `failureFunctionState` (string): The state of the failure function if applicable.
  - `responseStatus` (integer): The HTTP status code received from the destination API.
  - `responseHeader` (object): The HTTP response headers received from the destination API.
  - `responseBody` (string): The body of the response if it is composed of utf8 chars only, empty otherwise.
  - `responseBodyBase64` (string): The base64 encoded body of the response if the body contains a non-utf8 char only, empty otherwise.

### 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 GET \
  --url https://qstash-{region}.upstash.io/v2/workflows/dlq \
  --header 'Authorization: Bearer <token>'
```
