> ## Documentation Index
> Fetch the complete documentation index at: https://docs.platform.toloka.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# client.runs.cancel()

> Cancel a pipeline run.

Stop processing remaining items and return the current run state. Completed items are retained. Poll until the run reports `failed` with `Run canceled`. `pendingHumanQa` defaults to `wait_for_review`; reviews can finish after cancellation. After 14 days on the node, eligible waiting items are accepted and charged. Set `accept_without_review` to accept eligible waiting items immediately. Returns 409 before deployment or once cancellation or finalization has started.

## Signature

Method signature on `client.runs`:

```ts theme={null}
cancel(args: {
  runId: string;
  pendingHumanQa?: "accept_without_review" | "wait_for_review";
}): Promise<RunJob>;
```

## Parameters

**runId** `string` *required*

Pipeline run ID with prefix `plr.`.

**pendingHumanQa** `"accept_without_review" | "wait_for_review"`

How to handle items waiting for Human QA. `wait_for_review` (default) keeps them waiting; after 14 days on the node, eligible items are accepted without review. `accept_without_review` accepts eligible waiting items now. Items rejected by LLM QA or already under review are excluded. Accepted items are charged as completed items.

## Returns

`Promise<RunJob>`

A pipeline run job. Poll until status is succeeded or failed.

**id** `RunId` *required*

Pipeline run ID with prefix `plr.`.

**datasetId** `DatasetId` *required*

Dataset ID with prefix `ds.`.

**status** `"pending" | "running" | "succeeded" | "failed"` *required*

Run state: `pending` before deployment, `running` while processing, `succeeded` when processing ends, or `failed` if deployment fails; individual item failures are counted in `result`.

**createdAt** `string` *required*

Time the run was created, as an ISO 8601 timestamp.

**error** `string | null` *required*

Deployment failure message, or null when the run deployed successfully.

**result** `RunStats` *required*

Counts of items and their current outcomes.

**Fields**

**total** `number` *required*

Total number of items in this run.

**completed** `number` *required*

Number of items that completed successfully.

**failed** `number` *required*

Number of items that failed.

**canceled** `number` *required*

Number of items that were canceled.

**paused** `number` *required*

Number of items currently paused.

## Errors

HTTP errors throw [`PotatoApiError`](https://docs.platform.toloka.ai/docs/sdk/errors). The endpoint documents these error responses:

| Status | Description |
| - | - |
| 404 | Run not found |
| 409 | Run cannot be canceled (not yet deployed, or already canceling/finished) |
| 429 | Rate limit exceeded |

HTTP endpoint: [`POST /runs/{runId}/cancel`](https://docs.platform.toloka.ai/docs/api-reference/runs/cancel-pipeline-run).

```ts cancel() theme={null}
import { createClient } from "@toloka-platform/sdk";

const client = createClient({
  baseUrl: "https://platform.toloka.ai",
  apiKey: process.env.TOLOKA_API_KEY!,
});

const run = await client.runs.cancel({
  runId: "plr.019a0000-0000-7000-8000-000000000001"
});
console.log(run);
```

```json cancel() theme={null}
{
  "id": "plr.019a0000-0000-7000-8000-000000000001",
  "datasetId": "ds.019a0000-0000-7000-8000-000000000001",
  "status": "pending",
  "createdAt": "2026-01-01T00:00:00Z",
  "error": null,
  "result": {
    "total": 0,
    "completed": 0,
    "failed": 0,
    "canceled": 0,
    "paused": 0
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.