# client.dlq.delete

The `dlq.delete` method deletes one or more workflow runs from the **Dead Letter Queue (DLQ)**.

## Arguments

You can delete DLQ entries by ID, by an array of IDs, or by filters.

### By DLQ ID

Pass a single DLQ ID or an array of IDs directly:

```ts
await client.dlq.delete("dlq-123");
await client.dlq.delete(["dlq-123", "dlq-456"]);
```

Or as an object with `dlqIds`:

```ts
await client.dlq.delete({ dlqIds: ["dlq-123", "dlq-456"] });
```

### By filters

<ParamField body="filter" type="object">
    <Expandable defaultOpen>
        <ParamField body="workflowUrl" type="string" optional>
            Filter by exact workflow URL.
        </ParamField>

        <ParamField body="workflowRunId" type="string" optional>
            Filter by workflow run ID.
        </ParamField>

        <ParamField body="label" type="string | string[]" optional>
            Delete workflows with this label. Pass an array to match runs that
            have any of the given labels (OR semantics).
        </ParamField>

        <ParamField body="fromDate" type="Date | number" optional>
            Delete workflows created after this date. Accepts `Date` objects or Unix timestamps (ms).
        </ParamField>

        <ParamField body="toDate" type="Date | number" optional>
            Delete workflows created before this date. Accepts `Date` objects or Unix timestamps (ms).
        </ParamField>

        <ParamField body="callerIp" type="string" optional>
            Filter by the IP address that triggered the workflow.
        </ParamField>

        <ParamField body="flowControlKey" type="string" optional>
            Filter by flow control key.
        </ParamField>

        <ParamField body="workflowCreatedAt" type="number" optional>
            Filter by workflow creation time (Unix timestamp in ms).
        </ParamField>

        <ParamField body="failureFunctionState" type="string" optional>
            Filter by failure callback state.
        </ParamField>
    </Expandable>
</ParamField>

<ParamField body="count" type="number" optional>
    Maximum number of messages to process per call. Defaults to `100`.
</ParamField>

<ParamField body="cursor" type="string" optional>
    A pagination cursor from a previous request.
</ParamField>

### Delete all

<ParamField body="all" type="boolean">
    Set to `true` to delete all DLQ entries.
</ParamField>

## Response

<ResponseField name="deleted" type="number">
    The number of DLQ entries that were deleted.
</ResponseField>

<ResponseField name="cursor" type="string">
    A pagination cursor. If not returned, all matching entries have been processed.
</ResponseField>

## Usage

<CodeGroup>
```ts Single
await client.dlq.delete("dlq-123");
```
```ts Multiple
await client.dlq.delete(["dlq-123", "dlq-456"]);
```
```ts By filters
// delete by label
let cursor: string | undefined;
do {
  const result = await client.dlq.delete({
    filter: { label: "my-label" },
    cursor,
  });
  cursor = result.cursor;
} while (cursor);
```
```ts All
let cursor: string | undefined;
do {
  const result = await client.dlq.delete({ all: true, cursor });
  cursor = result.cursor;
} while (cursor);
```
</CodeGroup>
