> ## 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.datasets.startExport()

> Start a dataset export.

Send field names or IDs in `fields`. Returns an export to poll for a download link. The file is a JSON array of dataset values; it does not contain pipeline run outputs.

## Signature

Method signature on `client.datasets`:

```ts theme={null}
startExport(args: {
  datasetId: string;
  format?: "json-array";
  fields: string[];
}): Promise<ExportJob>;
```

## Parameters

**datasetId** `string` *required*

Dataset ID with prefix `ds.`.

**format** `"json-array"` (default: json-array)

Emit the selected fields as one JSON array. The default when format is omitted.

**fields** `string[]` *required*

Fields to include in the export, identified by field name or id.

## Returns

`Promise<ExportJob>`

An asynchronous dataset export job. Failed jobs include an error. Successful file exports include a download URL; exports prepared for training cost estimates include a validation report and a null download URL.

**id** `ExportId` *required*

Dataset export ID with prefix `dex.`.

**datasetId** `DatasetId` *required*

Dataset ID with prefix `ds.`.

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

Export state: `running` while preparing, `succeeded` when complete, or `failed` after an error.

**createdAt** `string` *required*

Time the export was requested, as an ISO 8601 timestamp.

**result** `object` *required*

Download details for the export.

**Fields**

**downloadUrl** `string | null` *required*

Signed file download URL, or null before completion, after failure, or for validation-only exports.

**report** `DatasetExportReport | null` *required*

Training-example validation report, or null for ordinary file exports or before validation finishes.

**Fields**

**validCount** `number` *required*

Number of valid training examples in the selection.

**invalidCount** `number` *required*

Number of examples rejected during validation.

**errors** `object[]` *required*

Sample of validation errors, up to 50 entries.

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

**tokens** `object` *required*

Token-count statistics for the valid examples.

**Fields**

**p50** `number` *required*

Median number of tokens per valid example.

**p95** `number` *required*

95th percentile of tokens per valid example.

**max** `number` *required*

Largest token count among valid examples.

**total** `number | null` (default: null)

Total tokens across valid examples, or null when unavailable.

**estimatorVersion** `"utf16-code-units-div-4-v1" | "script-weighted-v1" | null` *required*

Token estimator version used for these statistics, or null when unavailable.

**error** `object | null` *required*

Failure details, or null when the export has not failed.

**Fields**

**timestamp** `string` *required*

Time the export failed, as an ISO 8601 timestamp.

**code** `"empty_selection" | "size_limit_exceeded" | "assembly_failed"` *required*

Failure category: `empty_selection` when no rows match, `size_limit_exceeded` when the export is too large, or `assembly_failed` when preparation fails.

**message** `string` *required*

Explanation of why the export failed.

## Errors

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

| Status | Description |
| - | - |
| 400 | Unknown field name or id |
| 404 | Dataset not found |
| 429 | Rate limit exceeded |

HTTP endpoint: [`POST /datasets/{datasetId}/exports`](https://docs.platform.toloka.ai/docs/api-reference/dataset-exports/create-dataset-export).

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

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

const exportJob = await client.datasets.startExport({
  datasetId: "ds.019a0000-0000-7000-8000-000000000001",
  fields: [
    "text"
  ]
});
console.log(exportJob);
```

```json startExport() theme={null}
{
  "id": "dex.019a0000-0000-7000-8000-000000000001",
  "datasetId": "ds.019a0000-0000-7000-8000-000000000001",
  "status": "running",
  "createdAt": "2026-01-01T00:00:00Z",
  "result": {
    "downloadUrl": null
  },
  "report": null,
  "error": null
}
```


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