# Export dataset

URL: https://docs.hanzo.ai/docs/openapi/dataset/riskexportdataset

> Reads a published version's rows back, one bounded page at a time, in the version's own stable row order.

`GET /v1/dataset/{name}/export`

> [Dataset →](https://docs.hanzo.ai/docs/openapi/dataset) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                 |
| ------------- | ----------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/dataset/{name}/export` |
| **Method**    | `GET`                                           |
| **Operation** | `riskExportDataset`                             |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`          |

Reads a published version's rows back, one bounded page at a
time, in the version's own stable row order.

Only a published version can be exported. Rows written by an attempt that never
completed are inert — no register row names them — and they are disposed of with
the dataset.

## Request

5 fields.

| Field     | In    | Type    | Required | Description                                                                                                                          |
| --------- | ----- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `name`    | path  | string  | yes      | Name is the dataset, from the path.                                                                                                  |
| `version` | query | integer | —        | Version is the version to read.                                                                                                      |
| `split`   | query | string  | —        | Split narrows to train, val or test.                                                                                                 |
| `offset`  | query | integer | —        | Offset is where the page starts, in the version's own row order (by id, which is derived from the row and therefore stable forever). |
| `limit`   | query | integer | —        | Limit is how many rows to return.                                                                                                    |

## Response

| Status    | Body                    | Meaning |
| --------- | ----------------------- | ------- |
| `200`     | dataset.riskDatasetRows | ok      |
| `default` | problem-details         | refused |

`200` body — 13 fields.

| Field            | In   | Type                      | Always | Description                                                                                                                       |
| ---------------- | ---- | ------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------- |
| `dataset`        | body | string                    | —      | Dataset is the dataset the page was read from.                                                                                    |
| `digest`         | body | string                    | —      | Digest is the version's fingerprint.                                                                                              |
| `dims`           | body | string\[]                 | —      | Dims names what each coordinate of Point means, in Point's own order.                                                             |
| `limit`          | body | integer (int64)           | —      | Limit is the page size actually served: the one asked for, clamped to the plane's own bound of 5000.                              |
| `offset`         | body | integer (int64)           | —      | Offset is where this page starts in the version's own row order, which is by row id and therefore stable forever.                 |
| `rows`           | body | dataset.riskDatasetRow\[] | —      | Rows is the page.                                                                                                                 |
| `rows[].at`      | body | string                    | —      | At is the row's instant.                                                                                                          |
| `rows[].id`      | body | string                    | —      | ID names the row forever.                                                                                                         |
| `rows[].kind`    | body | string                    | —      | Kind is the subject kind: person, session or account.                                                                             |
| `rows[].point`   | body | number (double)\[]        | —      | Point is the coordinates, in the order the version's spec names its dims.                                                         |
| `rows[].split`   | body | string                    | —      | Split is train, val or test.                                                                                                      |
| `rows[].subject` | body | string                    | —      | Subject is the identity within that kind — whose row this is.                                                                     |
| `version`        | body | integer (int64)           | —      | Version is which published version it was read from — the one asked for, or the newest published one when the request named none. |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo dataset export <name>
```

**SDK**

**.ts**

```ts
import { Configuration, DatasetApi } from 'hanzoai';

const api = new DatasetApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.riskExportDataset({ name: 'name' });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import DatasetApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = DatasetApi(client).risk_export_dataset(name='name')
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.DatasetAPI.RiskExportDataset(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, dataset_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = dataset_api::risk_export_dataset(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.DatasetApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new DatasetApi(client).riskExportDataset();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/dataset/<name>/export \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

Tool `dataset`, op `riskExportDataset` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "dataset",
         "arguments": {
           "op": "riskExportDataset",
           "input": {
             "name": "<name>"
           }
         }
       }
     }'
```

---

[Dataset API](https://docs.hanzo.ai/docs/openapi/dataset) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
