# client.dlq.restart

The `dlq.restart` method restarts one or more workflow runs from **Dead Letter Queue (DLQ)**.
This allows you to reprocess workflow runs that previously failed after exhausting retries.

## Arguments

The first argument specifies which DLQ entries to restart. The optional second argument provides flow control and retry settings.

### By DLQ ID

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

```ts
await client.dlq.restart("dlq-12345");
await client.dlq.restart(["dlq-12345", "dlq-67890"]);
```

### By filters

Pass an object with a `filter` field:

<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>
            Restart 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>
            Restart workflows created after this date.
        </ParamField>

        <ParamField body="toDate" type="Date | number" optional>
            Restart workflows created before this date.
        </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>

### Restart all

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

### Options (second argument)

<ParamField body="flowControl" type="object" optional>
    An optional flow control configuration to limit concurrency and execution rate of restarted workflow runs.

    See [Flow Control](/workflow/features/flow-control) for details.

    <Expandable title="properties">
        <ParamField body="key" type="string">
          A logical grouping key that identifies which requests share the same flow control limits.
        </ParamField>

        <ParamField body="rate" type="number">
            The maximum number of allowed requests per second.
        </ParamField>

        <ParamField body="parallelism" type="number">
            The maximum number of concurrent requests allowed.
        </ParamField>

        <ParamField body="period" type="string|number">
            The time window used to enforce the defined rate limit. Default is `1s`.
        </ParamField>
    </Expandable>

</ParamField>

<ParamField body="retries" type="number" optional>
    Number of retry attempts to apply to the restarted workflow invocation.
    Defaults to `3` if not provided.
</ParamField>

## Response

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

<ResponseField name="workflowRuns" type="object[]">
    <Expandable defaultOpen>
        <ResponseField name="workflowRunId" type="string">
            The ID of the new workflow run created from the restarted DLQ message.
        </ResponseField>

        <ResponseField name="workflowCreatedAt" type="number">
            The Unix timestamp (in milliseconds) when the new workflow run was created.
        </ResponseField>
    </Expandable>
</ResponseField>

## Usage

<CodeGroup>
```ts Single
const { messages } = await client.dlq.list();

const response = await client.dlq.restart(messages[0].dlqId, {
  flowControl: {
    key: "my-flow-control-key",
    parallelism: 10,
  },
  retries: 3,
});
```
```ts Multiple
const response = await client.dlq.restart(["dlq-12345", "dlq-67890"]);
```
```ts By filters
let cursor: string | undefined;
do {
  const result = await client.dlq.restart({
    filter: { label: "my-label" },
    cursor,
  });
  cursor = result.cursor;
} while (cursor);
```
```ts All
let cursor: string | undefined;
do {
  const result = await client.dlq.restart({ all: true, cursor });
  cursor = result.cursor;
} while (cursor);
```
</CodeGroup>
