> ## 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.pipelines.attachDataset()

> Attach a dataset to a pipeline.

Send `datasetId` to set the Start node's source dataset. Optionally set `itemLimit` and `itemFilter`. Returns the updated pipeline; an active run prevents changes.

## Signature

Method signature on `client.pipelines`:

```ts theme={null}
attachDataset(args: {
  pipelineId: string;
  datasetId: string;
  itemLimit?: number;
  itemFilter?: DatasetItemFilter;
}): Promise<Pipeline>;
```

## Parameters

**pipelineId** `string` *required*

Pipeline ID with prefix `pl.`.

**datasetId** `string` *required*

Dataset ID with prefix `ds.` to attach to the pipeline.

**itemLimit** `number`

Optional cap on how many items the run will process.

**itemFilter** `DatasetItemFilter`

Optional filter selecting which dataset items a run processes — by field values, field sources, missing revision fields, a created-before cutoff, the rows of a slice, and the parts of a split field to keep or to leave out. A slice selects its rows, and reads its frozen fields and their split parts, as they were at its cutoff; the other filters, excluded parts included, match the latest values. Omitted means all items; supplying it replaces any previously attached filter.

**Fields**

**fieldValues** `DatasetFieldValueConditions`

Field-value conditions that selected rows must satisfy; defaults to no conditions.

See the [HTTP endpoint](https://docs.platform.toloka.ai/docs/api-reference/pipelines/attach-pipeline-dataset.md) for the complete schema.

**fieldSources** `DatasetFieldSourceConditions`

Field-author conditions that selected rows must satisfy; defaults to no conditions.

See the [HTTP endpoint](https://docs.platform.toloka.ai/docs/api-reference/pipelines/attach-pipeline-dataset.md) for the complete schema.

**missingRevisionFields** `string[]`

Field IDs with prefix `df.` that must have no revision on a selected row; defaults to an empty array.

**slice** `DatasetSliceSelection`

Slice whose frozen rows and fields to read; omit to use live dataset rows.

**Fields**

**sliceId** `string` *required*

Dataset slice ID with prefix `dsl.`.

**parts** `DatasetSplitPartInclusion`

Split parts to include; omit to include every part.

**Fields**

**fieldId** `string` *required*

Split field ID with prefix `df.`.

**names** `string[]` *required*

Names of the split parts to select.

See the [HTTP endpoint](https://docs.platform.toloka.ai/docs/api-reference/pipelines/attach-pipeline-dataset.md) for the complete schema.

**excludeParts** `DatasetSplitPartExclusions`

Split-part selections to exclude; omit when no parts should be excluded.

See the [HTTP endpoint](https://docs.platform.toloka.ai/docs/api-reference/pipelines/attach-pipeline-dataset.md) for the complete schema.

**createdBefore** `string`

Cutoff for dataset items and field revisions, as an ISO 8601 timestamp; omit to use the endpoint's cutoff.

## Returns

`Promise<Pipeline>`

A pipeline within a project.

**id** `PipelineId` *required*

Pipeline ID with prefix `pl.`.

**projectId** `ProjectId` *required*

Project ID with prefix `pp.`.

**name** `string` *required*

Name of the pipeline.

**version** `number` *required*

Pipeline version number; copying a pipeline increments the source version.

**createdAt** `string` *required*

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

**updatedAt** `string` *required*

Time the pipeline was last updated, as an ISO 8601 timestamp.

## Errors

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

| Status | Description |
| - | - |
| 404 | Pipeline or dataset not found |
| 409 | Pipeline has an active run and cannot be changed |
| 429 | Rate limit exceeded |

HTTP endpoint: [`POST /pipelines/{pipelineId}/dataset`](https://docs.platform.toloka.ai/docs/api-reference/pipelines/attach-pipeline-dataset).

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

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

const pipeline = await client.pipelines.attachDataset({
  pipelineId: "pl.019a0000-0000-7000-8000-000000000001",
  datasetId: "ds.019a0000-0000-7000-8000-000000000001",
  itemLimit: 100
});
console.log(pipeline);
```

```json attachDataset() theme={null}
{
  "id": "pl.019a0000-0000-7000-8000-000000000001",
  "projectId": "pp.019a0000-0000-7000-8000-000000000001",
  "name": "<string>",
  "version": 0,
  "createdAt": "2026-01-01T00:00:00Z",
  "updatedAt": "2026-01-01T00:00:00Z"
}
```


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